Under -fmodules, accept #public <macroname> and #private <macroname>
to make a macro public (the default for headers) or private,
respectively.

llvm-svn: 147455
diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp
index 690a1f5..4368ff7 100644
--- a/clang/lib/Basic/IdentifierTable.cpp
+++ b/clang/lib/Basic/IdentifierTable.cpp
@@ -216,18 +216,17 @@
   CASE( 6, 'i', 'n', ifndef);
   CASE( 6, 'i', 'p', import);
   CASE( 6, 'p', 'a', pragma);
-
+  CASE( 6, 'p', 'b', public);
+      
   CASE( 7, 'd', 'f', defined);
   CASE( 7, 'i', 'c', include);
+  CASE( 7, 'p', 'i', private);
   CASE( 7, 'w', 'r', warning);
 
   CASE( 8, 'u', 'a', unassert);
   CASE(12, 'i', 'c', include_next);
 
   CASE(16, '_', 'i', __include_macros);
-  CASE(16, '_', 'e', __export_macro__);
-      
-  CASE(17, '_', 'p', __private_macro__);
 #undef CASE
 #undef HASH
   }
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index 2dfae87..04d92b8 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -682,10 +682,15 @@
       //isExtension = true;  // FIXME: implement #unassert
       break;
         
-    case tok::pp___export_macro__:
-      return HandleMacroExportDirective(Result);
-    case tok::pp___private_macro__:
-      return HandleMacroPrivateDirective(Result);
+    case tok::pp_public:
+      if (getLangOptions().Modules)
+        return HandleMacroPublicDirective(Result);
+      break;
+        
+    case tok::pp_private:
+      if (getLangOptions().Modules)
+        return HandleMacroPrivateDirective(Result);
+      break;
     }
     break;
   }
@@ -1038,8 +1043,8 @@
   }
 }
 
-/// \brief Handle a #__export_macro__ directive.
-void Preprocessor::HandleMacroExportDirective(Token &Tok) {
+/// \brief Handle a #public directive.
+void Preprocessor::HandleMacroPublicDirective(Token &Tok) {
   Token MacroNameTok;
   ReadMacroName(MacroNameTok, 2);
   
@@ -1047,8 +1052,8 @@
   if (MacroNameTok.is(tok::eod))
     return;
 
-  // Check to see if this is the last token on the #__export_macro__ line.
-  CheckEndOfDirective("__export_macro__");
+  // Check to see if this is the last token on the #public line.
+  CheckEndOfDirective("public");
 
   // Okay, we finally have a valid identifier to undef.
   MacroInfo *MI = getMacroInfo(MacroNameTok.getIdentifierInfo());
@@ -1069,7 +1074,7 @@
     MI->setChangedAfterLoad();
 }
 
-/// \brief Handle a #__private_macro__ directive.
+/// \brief Handle a #private directive.
 void Preprocessor::HandleMacroPrivateDirective(Token &Tok) {
   Token MacroNameTok;
   ReadMacroName(MacroNameTok, 2);
@@ -1078,8 +1083,8 @@
   if (MacroNameTok.is(tok::eod))
     return;
   
-  // Check to see if this is the last token on the #__private_macro__ line.
-  CheckEndOfDirective("__private_macro__");
+  // Check to see if this is the last token on the #private line.
+  CheckEndOfDirective("private");
   
   // Okay, we finally have a valid identifier to undef.
   MacroInfo *MI = getMacroInfo(MacroNameTok.getIdentifierInfo());
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp
index a2994a3..3ecdae2 100644
--- a/clang/lib/Parse/ParseObjc.cpp
+++ b/clang/lib/Parse/ParseObjc.cpp
@@ -67,7 +67,11 @@
     SingleDecl = ParseObjCPropertyDynamic(AtLoc);
     break;
   case tok::objc_import:
-    return ParseModuleImport(AtLoc);
+    if (getLang().Modules)
+      return ParseModuleImport(AtLoc);
+      
+    // Fall through
+      
   default:
     Diag(AtLoc, diag::err_unexpected_at);
     SkipUntil(tok::semi);