diff --git a/src/libclang/preprocessor.cpp b/src/libclang/preprocessor.cpp index 9b40e49..45c3d52 100644 --- a/src/libclang/preprocessor.cpp +++ b/src/libclang/preprocessor.cpp @@ -36,9 +36,9 @@ namespace // -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 + // -C: keep comments // -dD: print macro definitions as well - auto flags = std::string("-x c++ -I. -E -CC -dD"); + auto flags = std::string("-x c++ -I. -E -C -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"; @@ -735,7 +735,7 @@ detail::preprocessor_output detail::preprocess(const libclang_compile_config& co { case linemarker::line_directive: break; // ignore - // no need to handle it, preprocessed output doesn't need to match line numbers precisely + // no need to handle it, preprocessed output doesn't need to match line numbers precisely case linemarker::enter_new: if (file_depth == 0u && lm.value().file.front() != '<') diff --git a/test/cpp_preprocessor.cpp b/test/cpp_preprocessor.cpp index a96188f..d2db720 100644 --- a/test/cpp_preprocessor.cpp +++ b/test/cpp_preprocessor.cpp @@ -173,23 +173,20 @@ f **/ #define g(name) \ class name \ { \ - /** i - i */ \ - void i(); \ }; /// h /// h g(h) -/// j -/// j -using j = int; +/// i +/// i +using i = int; -/// k -/// k +/// j +/// j template -void k(); +void j(); )"; auto file = parse({}, "comment-matching.cpp", code);