llunak added a comment.

The code uses a raw lexer, so it doesn't expand macros. Thus the piece of code 
quoted will not get the "#if QT_HAS_INCLUDE(<chrono>)" part rewritten. My 
specific use case is the Icecream distributed build tool which does remote 
builds in a chroot and so this #if will be false and the expanded contents of 
<chrono> will be ignored, leading to build errors 
(https://github.com/icecc/icecream/issues/471).

I can change the code to use 'while' instead of 'if' to handle nested macros, 
but I think such an approach should go only so far. My patch is simple and 
handles a realistic scenario, but if more complex macro handling is needed 
(which is a question), then IMO the code should be changed to do macro 
expansion properly. It was a long time ago when I wrote the code, but seeing 
that usage of Preprocessor::SetMacroExpansionOnlyInDirectives() I think such an 
expansion could be done similarly how handling macro expansion is handled in 
other directives - which IIRC is getting that information from PPCallbacks.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63508/new/

https://reviews.llvm.org/D63508



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to