From 62288edde26ff4af9fc079c979a0e1bdc577ce9d Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Wed, 10 Oct 2012 02:12:47 +0000 Subject: 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 --- include/clang/Frontend/ASTUnit.h | 4 ++++ include/clang/Serialization/ASTReader.h | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h index cadf2810b9..d1e0edbeab 100644 --- a/include/clang/Frontend/ASTUnit.h +++ b/include/clang/Frontend/ASTUnit.h @@ -626,6 +626,10 @@ public: /// \brief Get the PCH file if one was included. const FileEntry *getPCHFile(); + /// \brief Returns true if the ASTUnit was constructed from a serialized + /// module file. + bool isModuleFile(); + llvm::MemoryBuffer *getBufferForFile(StringRef Filename, std::string *ErrorStr = 0); diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h index a5fb396a50..c7e3bb8ba9 100644 --- a/include/clang/Serialization/ASTReader.h +++ b/include/clang/Serialization/ASTReader.h @@ -105,14 +105,16 @@ public: /// \brief Receives the language options. /// /// \returns true to indicate the options are invalid or false otherwise. - virtual bool ReadLanguageOptions(const LangOptions &LangOpts) { + virtual bool ReadLanguageOptions(const serialization::ModuleFile &M, + const LangOptions &LangOpts) { return false; } /// \brief Receives the target triple. /// /// \returns true to indicate the target triple is invalid or false otherwise. - virtual bool ReadTargetTriple(StringRef Triple) { + virtual bool ReadTargetTriple(const serialization::ModuleFile &M, + StringRef Triple) { return false; } @@ -138,7 +140,8 @@ public: virtual void ReadHeaderFileInfo(const HeaderFileInfo &HFI, unsigned ID) {} /// \brief Receives __COUNTER__ value. - virtual void ReadCounter(unsigned Value) {} + virtual void ReadCounter(const serialization::ModuleFile &M, + unsigned Value) {} }; /// \brief ASTReaderListener implementation to validate the information of @@ -153,14 +156,16 @@ public: PCHValidator(Preprocessor &PP, ASTReader &Reader) : PP(PP), Reader(Reader), NumHeaderInfos(0) {} - virtual bool ReadLanguageOptions(const LangOptions &LangOpts); - virtual bool ReadTargetTriple(StringRef Triple); + virtual bool ReadLanguageOptions(const serialization::ModuleFile &M, + const LangOptions &LangOpts); + virtual bool ReadTargetTriple(const serialization::ModuleFile &M, + StringRef Triple); virtual bool ReadPredefinesBuffer(const PCHPredefinesBlocks &Buffers, StringRef OriginalFileName, std::string &SuggestedPredefines, FileManager &FileMgr); virtual void ReadHeaderFileInfo(const HeaderFileInfo &HFI, unsigned ID); - virtual void ReadCounter(unsigned Value); + virtual void ReadCounter(const serialization::ModuleFile &M, unsigned Value); private: void Error(const char *Msg); @@ -834,7 +839,7 @@ private: llvm::BitstreamCursor &SLocCursorForID(int ID); SourceLocation getImportLocation(ModuleFile *F); ASTReadResult ReadSubmoduleBlock(ModuleFile &F); - bool ParseLanguageOptions(const RecordData &Record); + bool ParseLanguageOptions(const ModuleFile &M, const RecordData &Record); struct RecordLocation { RecordLocation(ModuleFile *M, uint64_t O) -- cgit v1.2.1