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

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 7 16:08:15 PST 2016


rnk added a comment.

Fix seems reasonable.



================
Comment at: lib/Lex/PPMacroExpansion.cpp:115
+           "only built-ins should have an entry here");
+    assert(!OldMD->getPrevious() && "builtin should only have a singe entry");
+    ED->setPrevious(OldMD);
----------------
"single" entry


================
Comment at: test/PCH/builtin-macro.c:29
+
+const char s[] = __DATE__ " " __TIME__ " " __TIMESTAMP__;
+
----------------
This test doesn't seem to fail if `__DATE__` expands to something. I removed `-D__DATE__=` from the command line and it passes. Can we find a way to make it fail? `int x = __DATE__ 42;`?


https://reviews.llvm.org/D27545





More information about the cfe-commits mailing list