KDAB / codebrowser

Woboq CodeBrowser
http://woboq.com/codebrowser.html
Other
1.1k stars 161 forks source link

Fixes compilation error with clang(++)9. #80

Closed Jissynacktiv closed 5 years ago

Jissynacktiv commented 5 years ago

Preprocessor API EnterTokenStream prototype changes with clang(++)9, leading to this compilation error:

$ make
Scanning dependencies of target codebrowser_generator
[  8%] Building CXX object generator/CMakeFiles/codebrowser_generator.dir/main.cpp.o
[ 16%] Building CXX object generator/CMakeFiles/codebrowser_generator.dir/projectmanager.cpp.o
[ 25%] Building CXX object generator/CMakeFiles/codebrowser_generator.dir/annotator.cpp.o
[ 33%] Building CXX object generator/CMakeFiles/codebrowser_generator.dir/generator.cpp.o
[ 41%] Building CXX object generator/CMakeFiles/codebrowser_generator.dir/preprocessorcallback.cpp.o
./woboq_codebrowser/generator/preprocessorcallback.cpp: In member function ‘virtual void PreprocessorCallback::MacroExpands(const clang::Token&, PreprocessorCallback::MyMacroDefinition, clang::SourceRange, const clang::MacroArgs*)’:
./woboq_codebrowser/generator/preprocessorcallback.cpp:109:64: error: no matching function for call to ‘clang::Preprocessor::EnterTokenStream(std::vector<clang::Token, std::allocator<clang::Token> >&, bool)’
     PP.EnterTokenStream(tokens, /*DisableMacroExpansion=*/false);

According to the documentation, a boolean is added in the prototype.

As I don't really know woboq internals + how clang is going to evolve in future minor revisions, I added a preprocessor macro handling clang9 case.

clang revision:

$ clang --version
clang version 9.0.0 (https://github.com/llvm/llvm-project.git c3dbe2397792302232114ebb15507c3977b605d2)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin

Thanks for this awesome project :+1:

CLAassistant commented 5 years ago

CLA assistant check
All committers have signed the CLA.

ogoffart commented 5 years ago

Thanks for the patch. This should be >= 9 since the future version will continue to have the same API.

ogoffart commented 5 years ago

Thanks!