[cfe-commits] r139728 - in /cfe/trunk: lib/Serialization/ASTWriter.cpp test/Modules/macros.c

Douglas Gregor dgregor at apple.com
Wed Sep 14 13:36:30 PDT 2011


Author: dgregor
Date: Wed Sep 14 15:36:30 2011
New Revision: 139728

URL: http://llvm.org/viewvc/llvm-project?rev=139728&view=rev
Log:
Don't try to write a macro offset for an identifier that names a non-exported macro

Modified:
    cfe/trunk/lib/Serialization/ASTWriter.cpp
    cfe/trunk/test/Modules/macros.c

Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=139728&r1=139727&r2=139728&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Wed Sep 14 15:36:30 2011
@@ -2300,7 +2300,8 @@
     uint32_t Bits = 0;
     bool hasMacroDefinition 
       = II->hasMacroDefinition() && 
-        (Macro || (Macro = PP.getMacroInfo(II))) && !Macro->isBuiltinMacro();
+        (Macro || (Macro = PP.getMacroInfo(II))) && !Macro->isBuiltinMacro() &&
+        (!IsModule || Macro->isExported());
     Bits = (uint32_t)II->getObjCOrBuiltinID();
     Bits = (Bits << 1) | unsigned(hasMacroDefinition);
     Bits = (Bits << 1) | unsigned(II->isExtensionToken());

Modified: cfe/trunk/test/Modules/macros.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/macros.c?rev=139728&r1=139727&r2=139728&view=diff
==============================================================================
--- cfe/trunk/test/Modules/macros.c (original)
+++ cfe/trunk/test/Modules/macros.c Wed Sep 14 15:36:30 2011
@@ -9,6 +9,8 @@
 #__export_macro__ INTEGER
 #__export_macro__ DOUBLE
 
+int (INTEGER);
+
 #else
 
 __import_module__ macros;
@@ -30,4 +32,7 @@
 
 #__export_macro__ WIBBLE // expected-error{{no macro named 'WIBBLE' to export}}
 
+void f() {
+  int i = INTEGER; // the value was exported, the macro was not.
+}
 #endif





More information about the cfe-commits mailing list