[PATCH] D27545: Don't assert when redefining a built-in macro in a PCH, PR29119

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 7 14:07:51 PST 2016


thakis created this revision.
thakis added a reviewer: rnk.
thakis added subscribers: cfe-commits, rsmith.

PCH files store the macro history for a  given macro, and the whole history list for one identifier is given to the Preprocessor at once via Preprocessor::setLoadedMacroDirective(). This contained an assert that no macro history exists yet for that identifier. That's usually true, but it's not true for builtin macros, which are created in Preprocessor() before flags and pchs are processed. Luckily, ASTWriter stops writing macro history lists at builtins (see shouldIgnoreMacro() in ASTWriter.cpp), so the head of the history list was missing for builtin macros. So make the assert weaker, and splice the history list to the existing single define for builtins.


https://reviews.llvm.org/D27545

Files:
  include/clang/Lex/Preprocessor.h
  lib/Lex/PPMacroExpansion.cpp
  lib/Serialization/ASTReader.cpp
  test/PCH/builtin-macro.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27545.80657.patch
Type: text/x-patch
Size: 4147 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161207/d50cbdbe/attachment.bin>


More information about the cfe-commits mailing list