diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-10-10 02:12:47 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-10-10 02:12:47 +0000 |
commit | 62288edde26ff4af9fc079c979a0e1bdc577ce9d (patch) | |
tree | 29130aae0c9d9738d9a35b4b883d222cf6ef7353 /lib/Frontend/ASTUnit.cpp | |
parent | 2a857180050fb78b356c17931e311eef7f2daf3e (diff) |
When indexing a module file, for the ppIncludedFile callback give
an invalid location if the location points to the synthetic buffer
for the module input.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165592 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/ASTUnit.cpp')
-rw-r--r-- | lib/Frontend/ASTUnit.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 136e72a6c6..6a4f0eb6d7 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -512,8 +512,9 @@ public: Predefines(Predefines), Counter(Counter), NumHeaderInfos(0), InitializedLanguage(false) {} - virtual bool ReadLanguageOptions(const LangOptions &LangOpts) { - if (InitializedLanguage) + virtual bool ReadLanguageOptions(const serialization::ModuleFile &M, + const LangOptions &LangOpts) { + if (InitializedLanguage || M.Kind != serialization::MK_MainFile) return false; LangOpt = LangOpts; @@ -530,9 +531,10 @@ public: return false; } - virtual bool ReadTargetTriple(StringRef Triple) { + virtual bool ReadTargetTriple(const serialization::ModuleFile &M, + StringRef Triple) { // If we've already initialized the target, don't do it again. - if (Target) + if (Target || M.Kind != serialization::MK_MainFile) return false; // FIXME: This is broken, we should store the TargetOptions in the AST file. @@ -563,7 +565,7 @@ public: HSI.setHeaderFileInfoForUID(HFI, NumHeaderInfos++); } - virtual void ReadCounter(unsigned Value) { + virtual void ReadCounter(const serialization::ModuleFile &M, unsigned Value) { Counter = Value; } @@ -2852,6 +2854,10 @@ const FileEntry *ASTUnit::getPCHFile() { return 0; } +bool ASTUnit::isModuleFile() { + return isMainFileAST() && !ASTFileLangOpts.CurrentModule.empty(); +} + void ASTUnit::PreambleData::countLines() const { NumLines = 0; if (empty()) |