]> granicus.if.org Git - clang/commitdiff
[modules] Introduce ModuleFile::DirectImportLoc which is the source location
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 1 Feb 2013 16:36:14 +0000 (16:36 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 1 Feb 2013 16:36:14 +0000 (16:36 +0000)
where the module was explicitly or implicitly imported in the local translation unit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174192 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Serialization/Module.h
lib/Serialization/ASTReader.cpp

index 547bf4c9212b84a278bf8a77e7115edaceecd9c4..5b019bd0545735e601fa7c2a36407314f14fb278 100644 (file)
@@ -124,6 +124,14 @@ public:
   /// \brief The main bitstream cursor for the main block.
   llvm::BitstreamCursor Stream;
 
+  /// \brief The source location where the module was explicitly or implicitly
+  /// imported in the local translation unit.
+  ///
+  /// If module A depends on and imports module B, both modules will have the
+  /// same DirectImportLoc, but different ImportLoc (B's ImportLoc will be a
+  /// source location inside module A).
+  SourceLocation DirectImportLoc;
+
   /// \brief The source location where this module was first imported.
   SourceLocation ImportLoc;
 
index 37db83e594a46851ba45e65188a683575145b4b4..604b23143e9d4d3d1163582a27158f9adcb878d5 100644 (file)
@@ -2779,6 +2779,7 @@ ASTReader::ASTReadResult ASTReader::ReadAST(const std::string &FileName,
                                               MEnd = Loaded.end();
        M != MEnd; ++M) {
     ModuleFile &F = *M->Mod;
+    F.DirectImportLoc = ImportLoc;
     if (!M->ImportedBy)
       F.ImportLoc = M->ImportLoc;
     else