From: Sebastian Redl Date: Wed, 18 Aug 2010 23:56:56 +0000 (+0000) Subject: Rename various classes from PCH to AST. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=571db7f0cb31789737be92fce1c1b738e6dbe795;p=clang Rename various classes from PCH to AST. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111471 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/ASTConsumer.h b/include/clang/AST/ASTConsumer.h index 3f964ad0e9..19cfae56c5 100644 --- a/include/clang/AST/ASTConsumer.h +++ b/include/clang/AST/ASTConsumer.h @@ -19,7 +19,7 @@ namespace clang { class CXXRecordDecl; class DeclGroupRef; class HandleTagDeclDefinition; - class PCHDeserializationListener; // layering violation because void* is ugly + class ASTDeserializationListener; // layering violation because void* is ugly class SemaConsumer; // layering violation required for safe SemaConsumer class TagDecl; class VarDecl; @@ -87,10 +87,10 @@ public: virtual void HandleVTable(CXXRecordDecl *RD, bool DefinitionRequired) {} /// \brief If the consumer is interested in entities being deserialized from - /// PCH, it should return a pointer to a PCHDeserializationListener here. + /// AST files, it should return a pointer to a ASTDeserializationListener here /// - /// The return type is void* because PCHDS lives in Frontend. - virtual PCHDeserializationListener *GetPCHDeserializationListener() { return 0; } + /// The return type is void* because ASTDS lives in Frontend. + virtual ASTDeserializationListener *GetASTDeserializationListener() { return 0; } /// PrintStats - If desired, print any statistics. virtual void PrintStats() {} diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h index 25f0aaaad0..aec9b0b810 100644 --- a/include/clang/Serialization/ASTWriter.h +++ b/include/clang/Serialization/ASTWriter.h @@ -74,7 +74,7 @@ struct UnsafeQualTypeDenseMapInfo { /// representation of a given abstract syntax tree and its supporting /// data structures. This bitstream can be de-serialized via an /// instance of the ASTReader class. -class ASTWriter : public PCHDeserializationListener { +class ASTWriter : public ASTDeserializationListener { public: typedef llvm::SmallVector RecordData; @@ -460,7 +460,7 @@ public: bool hasChain() const { return Chain; } - // PCHDeserializationListener implementation + // ASTDeserializationListener implementation void SetReader(ASTReader *Reader); void IdentifierRead(pch::IdentID ID, IdentifierInfo *II); void TypeRead(pch::TypeID ID, QualType T); @@ -489,7 +489,7 @@ public: const char *isysroot, llvm::raw_ostream *Out); virtual void InitializeSema(Sema &S) { SemaPtr = &S; } virtual void HandleTranslationUnit(ASTContext &Ctx); - virtual PCHDeserializationListener *GetPCHDeserializationListener(); + virtual ASTDeserializationListener *GetASTDeserializationListener(); }; } // end namespace clang diff --git a/include/clang/Serialization/PCHDeserializationListener.h b/include/clang/Serialization/PCHDeserializationListener.h index 37e82d3ef5..ec02bf457f 100644 --- a/include/clang/Serialization/PCHDeserializationListener.h +++ b/include/clang/Serialization/PCHDeserializationListener.h @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// This file defines the PCHDeserializationListener class, which is notified +// This file defines the ASTDeserializationListener class, which is notified // by the ASTReader whenever a type or declaration is deserialized. // //===----------------------------------------------------------------------===// @@ -23,9 +23,9 @@ class Decl; class ASTReader; class QualType; -class PCHDeserializationListener { +class ASTDeserializationListener { protected: - virtual ~PCHDeserializationListener() {} + virtual ~ASTDeserializationListener() {} public: /// \brief Tell the listener about the reader. diff --git a/include/clang/Serialization/PCHReader.h b/include/clang/Serialization/PCHReader.h index 08e43ce98d..5ce45b7db5 100644 --- a/include/clang/Serialization/PCHReader.h +++ b/include/clang/Serialization/PCHReader.h @@ -59,7 +59,7 @@ class GotoStmt; class LabelStmt; class MacroDefinition; class NamedDecl; -class PCHDeserializationListener; +class ASTDeserializationListener; class Preprocessor; class Sema; class SwitchCase; @@ -81,10 +81,10 @@ typedef llvm::SmallVector PCHPredefinesBlocks; /// While reading an AST file, the ASTReader will call the methods of the /// listener to pass on specific information. Some of the listener methods can /// return true to indicate to the ASTReader that the information (and -/// consequently the PCH file) is invalid. -class PCHReaderListener { +/// consequently the AST file) is invalid. +class ASTReaderListener { public: - virtual ~PCHReaderListener(); + virtual ~ASTReaderListener(); /// \brief Receives the language options. /// @@ -124,9 +124,9 @@ public: virtual void ReadCounter(unsigned Value) {} }; -/// \brief PCHReaderListener implementation to validate the information of +/// \brief ASTReaderListener implementation to validate the information of /// the PCH file against an initialized Preprocessor. -class PCHValidator : public PCHReaderListener { +class PCHValidator : public ASTReaderListener { Preprocessor &PP; ASTReader &Reader; @@ -173,10 +173,10 @@ public: friend class ASTDeclReader; private: /// \brief The receiver of some callbacks invoked by ASTReader. - llvm::OwningPtr Listener; + llvm::OwningPtr Listener; /// \brief The receiver of deserialization events. - PCHDeserializationListener *DeserializationListener; + ASTDeserializationListener *DeserializationListener; SourceManager &SourceMgr; FileManager &FileMgr; @@ -566,8 +566,8 @@ private: void MaybeAddSystemRootToFilename(std::string &Filename); - ASTReadResult ReadPCHCore(llvm::StringRef FileName); - ASTReadResult ReadPCHBlock(PerFileData &F); + ASTReadResult ReadASTCore(llvm::StringRef FileName); + ASTReadResult ReadASTBlock(PerFileData &F); bool CheckPredefinesBuffers(); bool ParseLineTable(llvm::SmallVectorImpl &Record); ASTReadResult ReadSourceManagerBlock(PerFileData &F); @@ -618,7 +618,7 @@ public: /// \brief Load the PCH file without using any pre-initialized Preprocessor. /// /// The necessary information to initialize a Preprocessor later can be - /// obtained by setting a PCHReaderListener. + /// obtained by setting a ASTReaderListener. /// /// \param SourceMgr the source manager into which the precompiled header /// will be loaded. @@ -643,15 +643,15 @@ public: /// \brief Load the precompiled header designated by the given file /// name. - ASTReadResult ReadPCH(const std::string &FileName); + ASTReadResult ReadAST(const std::string &FileName); /// \brief Set the PCH callbacks listener. - void setListener(PCHReaderListener *listener) { + void setListener(ASTReaderListener *listener) { Listener.reset(listener); } /// \brief Set the PCH deserialization listener. - void setDeserializationListener(PCHDeserializationListener *Listener); + void setDeserializationListener(ASTDeserializationListener *Listener); /// \brief Set the Preprocessor to use. void setPreprocessor(Preprocessor &pp); diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 7a2a5afe9a..e0aa1b47e7 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -304,7 +304,7 @@ namespace { /// \brief Gathers information from ASTReader that will be used to initialize /// a Preprocessor. -class PCHInfoCollector : public PCHReaderListener { +class PCHInfoCollector : public ASTReaderListener { LangOptions &LangOpt; HeaderSearch &HSI; std::string &TargetTriple; @@ -463,7 +463,7 @@ ASTUnit *ASTUnit::LoadFromPCHFile(const std::string &Filename, Reader->setListener(new PCHInfoCollector(LangInfo, HeaderInfo, TargetTriple, Predefines, Counter)); - switch (Reader->ReadPCH(Filename)) { + switch (Reader->ReadAST(Filename)) { case ASTReader::Success: break; diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index b930702ef4..1cac78e971 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/lib/Frontend/CompilerInstance.cpp @@ -270,8 +270,8 @@ CompilerInstance::createPCHExternalASTSource(llvm::StringRef Path, DisablePCHValidation)); Reader->setDeserializationListener( - static_cast(DeserializationListener)); - switch (Reader->ReadPCH(Path)) { + static_cast(DeserializationListener)); + switch (Reader->ReadAST(Path)) { case ASTReader::Success: // Set the predefines buffer as suggested by the PCH reader. Typically, the // predefines buffer will be empty. diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp index 40b4e7fa24..906fd9a76c 100644 --- a/lib/Frontend/FrontendAction.cpp +++ b/lib/Frontend/FrontendAction.cpp @@ -122,7 +122,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, CI.getPreprocessorOpts().ImplicitPCHInclude, CI.getPreprocessorOpts().DisablePCHValidation, CI.getInvocation().getFrontendOpts().ChainedPCH? - Consumer->GetPCHDeserializationListener() : 0); + Consumer->GetASTDeserializationListener() : 0); if (!CI.getASTContext().getExternalSource()) goto failure; } diff --git a/lib/Serialization/GeneratePCH.cpp b/lib/Serialization/GeneratePCH.cpp index ebc3c02b41..f8dabaabc7 100644 --- a/lib/Serialization/GeneratePCH.cpp +++ b/lib/Serialization/GeneratePCH.cpp @@ -59,6 +59,6 @@ void PCHGenerator::HandleTranslationUnit(ASTContext &Ctx) { Buffer.clear(); } -PCHDeserializationListener *PCHGenerator::GetPCHDeserializationListener() { +ASTDeserializationListener *PCHGenerator::GetASTDeserializationListener() { return &Writer; } diff --git a/lib/Serialization/PCHReader.cpp b/lib/Serialization/PCHReader.cpp index 5b6ed8a1d7..72f4974fb8 100644 --- a/lib/Serialization/PCHReader.cpp +++ b/lib/Serialization/PCHReader.cpp @@ -46,7 +46,7 @@ using namespace clang; // PCH reader validator implementation //===----------------------------------------------------------------------===// -PCHReaderListener::~PCHReaderListener() {} +ASTReaderListener::~ASTReaderListener() {} bool PCHValidator::ReadLanguageOptions(const LangOptions &LangOpts) { @@ -460,7 +460,7 @@ ASTReader::PerFileData::PerFileData() {} void -ASTReader::setDeserializationListener(PCHDeserializationListener *Listener) { +ASTReader::setDeserializationListener(ASTDeserializationListener *Listener) { DeserializationListener = Listener; if (DeserializationListener) DeserializationListener->SetReader(this); @@ -1419,7 +1419,7 @@ void ASTReader::MaybeAddSystemRootToFilename(std::string &Filename) { } ASTReader::ASTReadResult -ASTReader::ReadPCHBlock(PerFileData &F) { +ASTReader::ReadASTBlock(PerFileData &F) { llvm::BitstreamCursor &Stream = F.Stream; if (Stream.EnterSubBlock(pch::PCH_BLOCK_ID)) { @@ -1528,7 +1528,7 @@ ASTReader::ReadPCHBlock(PerFileData &F) { } // Load the chained file. - switch(ReadPCHCore(llvm::StringRef(BlobStart, BlobLen))) { + switch(ReadASTCore(llvm::StringRef(BlobStart, BlobLen))) { case Failure: return Failure; // If we have to ignore the dependency, we'll have to ignore this too. case IgnorePCH: return IgnorePCH; @@ -1792,8 +1792,8 @@ ASTReader::ReadPCHBlock(PerFileData &F) { return Failure; } -ASTReader::ASTReadResult ASTReader::ReadPCH(const std::string &FileName) { - switch(ReadPCHCore(FileName)) { +ASTReader::ASTReadResult ASTReader::ReadAST(const std::string &FileName) { + switch(ReadASTCore(FileName)) { case Failure: return Failure; case IgnorePCH: return IgnorePCH; case Success: break; @@ -1882,7 +1882,7 @@ ASTReader::ASTReadResult ASTReader::ReadPCH(const std::string &FileName) { return Success; } -ASTReader::ASTReadResult ASTReader::ReadPCHCore(llvm::StringRef FileName) { +ASTReader::ASTReadResult ASTReader::ReadASTCore(llvm::StringRef FileName) { Chain.push_back(new PerFileData()); PerFileData &F = *Chain.back(); @@ -1934,7 +1934,7 @@ ASTReader::ASTReadResult ASTReader::ReadPCHCore(llvm::StringRef FileName) { } break; case pch::PCH_BLOCK_ID: - switch (ReadPCHBlock(F)) { + switch (ReadASTBlock(F)) { case Success: break;