From be6fc936830215eca6783d594ec7068561cfb671 Mon Sep 17 00:00:00 2001 From: eidheim Date: Wed, 13 Dec 2017 18:41:27 +0100 Subject: [PATCH] Fixed #357: Added CUDA support --- README.md | 1 + src/compile_commands.cc | 7 ++++++- src/source.cc | 6 ++++++ src/usages_clang.cc | 6 ++++-- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2ff0702..0975ff7 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ towards libclang with speed, stability, and ease of use in mind. * Highlighting of similar types (C++) * Automated documentation search (C++) * Go to declaration, implementation, methods and usages (C++) +* CUDA files are supported and parsed as C++ * Find symbol through Ctags * Spell checking depending on file context * Run shell commands within juCi++ diff --git a/src/compile_commands.cc b/src/compile_commands.cc index 2c0d7aa..18ac059 100644 --- a/src/compile_commands.cc +++ b/src/compile_commands.cc @@ -127,12 +127,17 @@ std::vector CompileCommands::get_arguments(const boost::filesystem: extension!=".c") arguments.emplace_back("-xc++"); - if(extension.empty() || (1 Source::guess_language(const boost::filesystem::path } } } + else if(language->get_id()=="cuda") { + if(file_path.extension()==".cuh") + language=language_manager->get_language("cpphdr"); + else + language=language_manager->get_language("cpp"); + } return language; } diff --git a/src/usages_clang.cc b/src/usages_clang.cc index 3762b78..7edd638 100644 --- a/src/usages_clang.cc +++ b/src/usages_clang.cc @@ -545,7 +545,8 @@ Usages::Clang::PathSet Usages::Clang::find_paths(const boost::filesystem::path & bool Usages::Clang::is_header(const boost::filesystem::path &path) { auto ext = path.extension(); if(ext == ".h" || // c headers - ext == ".hh" || ext == ".hp" || ext == ".hpp" || ext == ".h++" || ext == ".tcc") // c++ headers + ext == ".hh" || ext == ".hp" || ext == ".hpp" || ext == ".h++" || ext == ".tcc" || // c++ headers + ext == ".cuh") // CUDA headers return true; else return false; @@ -554,7 +555,8 @@ bool Usages::Clang::is_header(const boost::filesystem::path &path) { bool Usages::Clang::is_source(const boost::filesystem::path &path) { auto ext = path.extension(); if(ext == ".c" || // c sources - ext == ".cpp" || ext == ".cxx" || ext == ".cc" || ext == ".C" || ext == ".c++") // c++ sources + ext == ".cpp" || ext == ".cxx" || ext == ".cc" || ext == ".C" || ext == ".c++" || // c++ sources + ext == ".cu") // CUDA sources return true; else return false;