rnk added a comment.

I did some digging and I figured out where things go wrong. The issue is the 
repeated string-izing of the macro argument, the repetition of `#func` here. 
This hacky patch seems to fix the issue:

  diff --git a/clang/lib/Lex/MacroArgs.cpp b/clang/lib/Lex/MacroArgs.cpp
  index 5aa4679fad4..29fd25a43bb 100644
  --- a/clang/lib/Lex/MacroArgs.cpp
  +++ b/clang/lib/Lex/MacroArgs.cpp
  @@ -318,7 +318,7 @@ const Token &MacroArgs::getStringifiedArgument(unsigned 
ArgNo,
     if (StringifiedArgs.empty())
       StringifiedArgs.resize(getNumMacroArguments(), {});
  
  -  if (StringifiedArgs[ArgNo].isNot(tok::string_literal))
  +  //if (StringifiedArgs[ArgNo].isNot(tok::string_literal))
       StringifiedArgs[ArgNo] = StringifyArgument(getUnexpArgument(ArgNo), PP,
                                                  /*Charify=*/false,
                                                  ExpansionLocStart,

Basically, the second time we process a string-ized macro argument, we hit the 
cache, which uses the wrong expansion location for the second expansion. I'm 
going to try cleaning this up and we'll see if the cache is really needed.


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

https://reviews.llvm.org/D65426



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

Reply via email to