r174191 - For ModuleLoader::makeModuleVisible() also pass the source location where the

Argyrios Kyrtzidis akyrtzi at gmail.com
Fri Feb 1 08:36:13 PST 2013


Author: akirtzidis
Date: Fri Feb  1 10:36:12 2013
New Revision: 174191

URL: http://llvm.org/viewvc/llvm-project?rev=174191&view=rev
Log:
For ModuleLoader::makeModuleVisible() also pass the source location where the
module import occurred.

Modified:
    cfe/trunk/include/clang/Frontend/ASTUnit.h
    cfe/trunk/include/clang/Frontend/CompilerInstance.h
    cfe/trunk/include/clang/Lex/ModuleLoader.h
    cfe/trunk/include/clang/Serialization/ASTReader.h
    cfe/trunk/lib/Frontend/CompilerInstance.cpp
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/lib/Serialization/ASTReader.cpp
    cfe/trunk/unittests/Basic/SourceManagerTest.cpp
    cfe/trunk/unittests/Lex/LexerTest.cpp
    cfe/trunk/unittests/Lex/PPCallbacksTest.cpp
    cfe/trunk/unittests/Lex/PPConditionalDirectiveRecordTest.cpp

Modified: cfe/trunk/include/clang/Frontend/ASTUnit.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/ASTUnit.h?rev=174191&r1=174190&r2=174191&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/ASTUnit.h (original)
+++ cfe/trunk/include/clang/Frontend/ASTUnit.h Fri Feb  1 10:36:12 2013
@@ -839,7 +839,8 @@ public:
   }
 
   virtual void makeModuleVisible(Module *Mod,
-                                 Module::NameVisibilityKind Visibility) { }
+                                 Module::NameVisibilityKind Visibility,
+                                 SourceLocation ImportLoc) { }
 
 };
 

Modified: cfe/trunk/include/clang/Frontend/CompilerInstance.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInstance.h?rev=174191&r1=174190&r2=174191&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/CompilerInstance.h (original)
+++ cfe/trunk/include/clang/Frontend/CompilerInstance.h Fri Feb  1 10:36:12 2013
@@ -662,7 +662,8 @@ public:
                                       bool IsInclusionDirective);
 
   virtual void makeModuleVisible(Module *Mod,
-                                 Module::NameVisibilityKind Visibility);
+                                 Module::NameVisibilityKind Visibility,
+                                 SourceLocation ImportLoc);
 
 };
 

Modified: cfe/trunk/include/clang/Lex/ModuleLoader.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/ModuleLoader.h?rev=174191&r1=174190&r2=174191&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/ModuleLoader.h (original)
+++ cfe/trunk/include/clang/Lex/ModuleLoader.h Fri Feb  1 10:36:12 2013
@@ -82,7 +82,8 @@ public:
 
   /// \brief Make the given module visible.
   virtual void makeModuleVisible(Module *Mod,
-                                 Module::NameVisibilityKind Visibility) = 0;
+                                 Module::NameVisibilityKind Visibility,
+                                 SourceLocation ImportLoc) = 0;
 };
   
 }

Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=174191&r1=174190&r2=174191&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTReader.h Fri Feb  1 10:36:12 2013
@@ -1164,7 +1164,8 @@ public:
   /// \param NameVisibility The level of visibility to give the names in the
   /// module.  Visibility can only be increased over time.
   void makeModuleVisible(Module *Mod, 
-                         Module::NameVisibilityKind NameVisibility);
+                         Module::NameVisibilityKind NameVisibility,
+                         SourceLocation ImportLoc);
   
   /// \brief Make the names within this set of hidden names visible.
   void makeNamesVisible(const HiddenNames &Names);

Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=174191&r1=174190&r2=174191&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Fri Feb  1 10:36:12 2013
@@ -890,7 +890,8 @@ CompilerInstance::loadModule(SourceLocat
   if (!ImportLoc.isInvalid() && LastModuleImportLoc == ImportLoc) {
     // Make the named module visible.
     if (LastModuleImportResult)
-      ModuleManager->makeModuleVisible(LastModuleImportResult, Visibility);
+      ModuleManager->makeModuleVisible(LastModuleImportResult, Visibility,
+                                       ImportLoc);
     return LastModuleImportResult;
   }
   
@@ -1178,7 +1179,7 @@ CompilerInstance::loadModule(SourceLocat
       return ModuleLoadResult();
     }
 
-    ModuleManager->makeModuleVisible(Module, Visibility);
+    ModuleManager->makeModuleVisible(Module, Visibility, ImportLoc);
   }
   
   // If this module import was due to an inclusion directive, create an 
@@ -1199,7 +1200,8 @@ CompilerInstance::loadModule(SourceLocat
 }
 
 void CompilerInstance::makeModuleVisible(Module *Mod,
-                                         Module::NameVisibilityKind Visibility){
-  ModuleManager->makeModuleVisible(Mod, Visibility);
+                                         Module::NameVisibilityKind Visibility,
+                                         SourceLocation ImportLoc){
+  ModuleManager->makeModuleVisible(Mod, Visibility, ImportLoc);
 }
 

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=174191&r1=174190&r2=174191&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Feb  1 10:36:12 2013
@@ -11514,7 +11514,7 @@ void Sema::createImplicitModuleImport(So
   Consumer.HandleImplicitImportDecl(ImportD);
 
   // Make the module visible.
-  PP.getModuleLoader().makeModuleVisible(Mod, Module::AllVisible);
+  PP.getModuleLoader().makeModuleVisible(Mod, Module::AllVisible, Loc);
 }
 
 void Sema::ActOnPragmaRedefineExtname(IdentifierInfo* Name,

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=174191&r1=174190&r2=174191&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Fri Feb  1 10:36:12 2013
@@ -2591,7 +2591,8 @@ void ASTReader::makeNamesVisible(const H
 }
 
 void ASTReader::makeModuleVisible(Module *Mod, 
-                                  Module::NameVisibilityKind NameVisibility) {
+                                  Module::NameVisibilityKind NameVisibility,
+                                  SourceLocation ImportLoc) {
   llvm::SmallPtrSet<Module *, 4> Visited;
   SmallVector<Module *, 4> Stack;
   Stack.push_back(Mod);  
@@ -3082,7 +3083,8 @@ void ASTReader::InitializeContext() {  
   // Re-export any modules that were imported by a non-module AST file.
   for (unsigned I = 0, N = ImportedModules.size(); I != N; ++I) {
     if (Module *Imported = getSubmodule(ImportedModules[I]))
-      makeModuleVisible(Imported, Module::AllVisible);
+      makeModuleVisible(Imported, Module::AllVisible,
+                        /*ImportLoc=*/SourceLocation());
   }
   ImportedModules.clear();
 }

Modified: cfe/trunk/unittests/Basic/SourceManagerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Basic/SourceManagerTest.cpp?rev=174191&r1=174190&r2=174191&view=diff
==============================================================================
--- cfe/trunk/unittests/Basic/SourceManagerTest.cpp (original)
+++ cfe/trunk/unittests/Basic/SourceManagerTest.cpp Fri Feb  1 10:36:12 2013
@@ -60,7 +60,8 @@ class VoidModuleLoader : public ModuleLo
   }
 
   virtual void makeModuleVisible(Module *Mod,
-                                 Module::NameVisibilityKind Visibility) { }
+                                 Module::NameVisibilityKind Visibility,
+                                 SourceLocation ImportLoc) { }
 };
 
 TEST_F(SourceManagerTest, isBeforeInTranslationUnit) {

Modified: cfe/trunk/unittests/Lex/LexerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Lex/LexerTest.cpp?rev=174191&r1=174190&r2=174191&view=diff
==============================================================================
--- cfe/trunk/unittests/Lex/LexerTest.cpp (original)
+++ cfe/trunk/unittests/Lex/LexerTest.cpp Fri Feb  1 10:36:12 2013
@@ -61,7 +61,8 @@ class VoidModuleLoader : public ModuleLo
   }
 
   virtual void makeModuleVisible(Module *Mod,
-                                 Module::NameVisibilityKind Visibility) { }
+                                 Module::NameVisibilityKind Visibility,
+                                 SourceLocation ImportLoc) { }
 };
 
 TEST_F(LexerTest, LexAPI) {

Modified: cfe/trunk/unittests/Lex/PPCallbacksTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Lex/PPCallbacksTest.cpp?rev=174191&r1=174190&r2=174191&view=diff
==============================================================================
--- cfe/trunk/unittests/Lex/PPCallbacksTest.cpp (original)
+++ cfe/trunk/unittests/Lex/PPCallbacksTest.cpp Fri Feb  1 10:36:12 2013
@@ -38,7 +38,8 @@ class VoidModuleLoader : public ModuleLo
   }
 
   virtual void makeModuleVisible(Module *Mod,
-                                 Module::NameVisibilityKind Visibility) { }
+                                 Module::NameVisibilityKind Visibility,
+                                 SourceLocation ImportLoc) { }
 };
 
 // Stub to collect data from InclusionDirective callbacks.

Modified: cfe/trunk/unittests/Lex/PPConditionalDirectiveRecordTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Lex/PPConditionalDirectiveRecordTest.cpp?rev=174191&r1=174190&r2=174191&view=diff
==============================================================================
--- cfe/trunk/unittests/Lex/PPConditionalDirectiveRecordTest.cpp (original)
+++ cfe/trunk/unittests/Lex/PPConditionalDirectiveRecordTest.cpp Fri Feb  1 10:36:12 2013
@@ -61,7 +61,8 @@ class VoidModuleLoader : public ModuleLo
   }
 
   virtual void makeModuleVisible(Module *Mod,
-                                 Module::NameVisibilityKind Visibility) { }
+                                 Module::NameVisibilityKind Visibility,
+                                 SourceLocation ImportLoc) { }
 };
 
 TEST_F(PPConditionalDirectiveRecordTest, PPRecAPI) {





More information about the cfe-commits mailing list