aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Serialization/Module.h8
-rw-r--r--lib/Serialization/ASTReader.cpp1
2 files changed, 9 insertions, 0 deletions
diff --git a/include/clang/Serialization/Module.h b/include/clang/Serialization/Module.h
index 547bf4c921..5b019bd054 100644
--- a/include/clang/Serialization/Module.h
+++ b/include/clang/Serialization/Module.h
@@ -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;
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp
index 37db83e594..604b23143e 100644
--- a/lib/Serialization/ASTReader.cpp
+++ b/lib/Serialization/ASTReader.cpp
@@ -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