Avoid executing __pragma when macro arguments are pre-expanded.
This is what clang currently does when parsing _Pragmas.
Fixes https://bugs.llvm.org/show_bug.cgi?id=41128, where clang crashes
when trying to get the length of annot_pragma tokens.
Paths
| Differential D68114
Fix for expanding __pragmas in macro arguments ClosedPublic Authored by akhuang on Sep 26 2019, 5:43 PM.
Details Summary Avoid executing __pragma when macro arguments are pre-expanded. Fixes https://bugs.llvm.org/show_bug.cgi?id=41128, where clang crashes
Diff Detail
Event TimelineComment Actions Nice, the solution was right in front of us the whole time. :) lgtm, but please share the TokenCollector class.
This revision is now accepted and ready to land.Oct 3 2019, 4:17 PM Comment Actions + @Bigcheese, for amusement. We discussed some interesting behavior of _Pragma and C++ raw string literals last night. Closed by commit rL373950: Fix for expanding __pragmas in macro arguments (authored by akhuang). · Explain WhyOct 7 2019, 10:18 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 223255 clang/lib/Lex/Pragma.cpp
clang/test/Preprocessor/pragma_microsoft.c
|
Let's pull this class out to file scope (and put it in an anonymous namespace) so we can reuse it instead of copying it.