From 71c1af8760c2a2f42dfffd9797bf7c5528ef2eb7 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Fri, 1 Feb 2013 16:36:14 +0000 Subject: [PATCH] [modules] Introduce ModuleFile::DirectImportLoc which is the source location where the module was explicitly or implicitly imported in the local translation unit. llvm-svn: 174192 --- clang/include/clang/Serialization/Module.h | 8 ++++++++ clang/lib/Serialization/ASTReader.cpp | 1 + 2 files changed, 9 insertions(+) diff --git a/clang/include/clang/Serialization/Module.h b/clang/include/clang/Serialization/Module.h index 547bf4c..5b019bd 100644 --- a/clang/include/clang/Serialization/Module.h +++ b/clang/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/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 37db83e..604b23143 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/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 -- 2.7.4