From b6767ffdebae2546c68261636f53e9b251416047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Wed, 12 Apr 2017 17:44:50 +0200 Subject: [PATCH] Force C++ and add current include dir when preprocessing --- src/libclang/preprocessor.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libclang/preprocessor.cpp b/src/libclang/preprocessor.cpp index fe3bcc7..fa2e18d 100644 --- a/src/libclang/preprocessor.cpp +++ b/src/libclang/preprocessor.cpp @@ -25,10 +25,12 @@ namespace // build the command that runs the preprocessor std::string get_command(const libclang_compile_config& c, const char* full_path) { + // -x c++: force C++ as input language + // -I.: add current working directory to include search path // -E: print preprocessor output // -CC: keep comments, even in macro // -dD: print macro definitions as well - auto flags = std::string("-E -CC -dD"); + auto flags = std::string("-x c++ -I. -E -CC -dD"); if (detail::libclang_compile_config_access::clang_version(c) >= 40000) // -Xclang -dI: print include directives as well (clang >= 4.0.0) flags += " -Xclang -dI";