Disable _Pragma during HTML macro rewriting to keep from crashing.
The preprocessor's handling of diagnostic push/pops is stateful, so encountering pragmas during a re-parse causes problems. HTMLRewrite already filters out normal # directives including #pragma, so it's clear it's not expected to be interpreting pragmas in this mode. This fix adds a flag to Preprocessor to explicitly disable pragmas. The "right" fix might be to separate pragma lexing from pragma parsing so that we can throw away pragmas like we do preprocessor directives, but right now it's important to get the fix in. Note that this has nothing to do with the "hack" of re-using the input preprocessor in HTMLRewrite. Even if we someday copy the preprocessor instead of re-using it, the copy would (and should) include the diagnostic level tables and have the same problems. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158214 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- include/clang/Lex/Preprocessor.h 6 additions, 0 deletionsinclude/clang/Lex/Preprocessor.h
- lib/Lex/Pragma.cpp 3 additions, 0 deletionslib/Lex/Pragma.cpp
- lib/Lex/Preprocessor.cpp 2 additions, 1 deletionlib/Lex/Preprocessor.cpp
- lib/Rewrite/HTMLRewrite.cpp 7 additions, 1 deletionlib/Rewrite/HTMLRewrite.cpp
- test/Misc/emit-html.c 8 additions, 0 deletionstest/Misc/emit-html.c
Loading
Please register or sign in to comment