aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2010-08-18 23:56:43 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2010-08-18 23:56:43 +0000
commitc43b54cbc10654ed59de797898042e1a05265246 (patch)
tree6b0e8346474082ae35d7bd850a0ae4e68d94ebd3
parent7faa2ec03a7ef120ac165bb45b6c70a8b20c9f1c (diff)
Rename PCHReader to ASTReader.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111467 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/Type.h6
-rw-r--r--include/clang/Frontend/CompilerInstance.h2
-rw-r--r--include/clang/Lex/ExternalPreprocessorSource.h2
-rw-r--r--include/clang/Lex/HeaderSearch.h2
-rw-r--r--include/clang/Serialization/ASTWriter.h14
-rw-r--r--include/clang/Serialization/PCHDeserializationListener.h6
-rw-r--r--include/clang/Serialization/PCHReader.h64
-rw-r--r--lib/Frontend/ASTUnit.cpp20
-rw-r--r--lib/Frontend/CompilerInstance.cpp10
-rw-r--r--lib/Frontend/CompilerInvocation.cpp2
-rw-r--r--lib/Sema/Sema.cpp4
-rw-r--r--lib/Serialization/ASTWriter.cpp2
-rw-r--r--lib/Serialization/GeneratePCH.cpp2
-rw-r--r--lib/Serialization/PCHReader.cpp174
-rw-r--r--lib/Serialization/PCHReaderDecl.cpp30
-rw-r--r--lib/Serialization/PCHReaderStmt.cpp18
16 files changed, 179 insertions, 179 deletions
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index 8313e773f5..1cc0e3926e 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -1039,7 +1039,7 @@ public:
void dump() const;
static bool classof(const Type *) { return true; }
- friend class PCHReader;
+ friend class ASTReader;
friend class ASTWriter;
};
@@ -2578,8 +2578,8 @@ class InjectedClassNameType : public Type {
QualType InjectedType;
friend class ASTContext; // ASTContext creates these.
- friend class PCHReader; // FIXME: ASTContext::getInjectedClassNameType is not
- // currently suitable for PCH reading, too much
+ friend class ASTReader; // FIXME: ASTContext::getInjectedClassNameType is not
+ // currently suitable for AST reading, too much
// interdependencies.
InjectedClassNameType(CXXRecordDecl *D, QualType TST)
: Type(InjectedClassName, QualType(), true),
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h
index e09061dbbd..1b3c336fc0 100644
--- a/include/clang/Frontend/CompilerInstance.h
+++ b/include/clang/Frontend/CompilerInstance.h
@@ -34,7 +34,7 @@ class DiagnosticClient;
class ExternalASTSource;
class FileManager;
class FrontendAction;
-class PCHReader;
+class ASTReader;
class Preprocessor;
class Sema;
class SourceManager;
diff --git a/include/clang/Lex/ExternalPreprocessorSource.h b/include/clang/Lex/ExternalPreprocessorSource.h
index af5c389816..791d3fe304 100644
--- a/include/clang/Lex/ExternalPreprocessorSource.h
+++ b/include/clang/Lex/ExternalPreprocessorSource.h
@@ -19,7 +19,7 @@ namespace clang {
/// \brief Abstract interface for external sources of preprocessor
/// information.
///
-/// This abstract class allows an external sources (such as the \c PCHReader)
+/// This abstract class allows an external sources (such as the \c ASTReader)
/// to provide additional macro definitions.
class ExternalPreprocessorSource {
public:
diff --git a/include/clang/Lex/HeaderSearch.h b/include/clang/Lex/HeaderSearch.h
index 978585caf0..80b38dee06 100644
--- a/include/clang/Lex/HeaderSearch.h
+++ b/include/clang/Lex/HeaderSearch.h
@@ -219,7 +219,7 @@ public:
header_file_iterator header_file_end() const { return FileInfo.end(); }
unsigned header_file_size() const { return FileInfo.size(); }
- // Used by PCHReader.
+ // Used by ASTReader.
void setHeaderFileInfoForUID(HeaderFileInfo HFI, unsigned UID);
void PrintStats();
diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h
index adf716ede3..25f0aaaad0 100644
--- a/include/clang/Serialization/ASTWriter.h
+++ b/include/clang/Serialization/ASTWriter.h
@@ -11,8 +11,8 @@
// containing a serialized representation of a translation unit.
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_FRONTEND_PCH_WRITER_H
-#define LLVM_CLANG_FRONTEND_PCH_WRITER_H
+#ifndef LLVM_CLANG_FRONTEND_AST_WRITER_H
+#define LLVM_CLANG_FRONTEND_AST_WRITER_H
#include "clang/AST/Decl.h"
#include "clang/AST/DeclarationName.h"
@@ -43,7 +43,7 @@ class CXXBaseOrMemberInitializer;
class LabelStmt;
class MacroDefinition;
class MemorizeStatCalls;
-class PCHReader;
+class ASTReader;
class Preprocessor;
class Sema;
class SourceManager;
@@ -73,7 +73,7 @@ struct UnsafeQualTypeDenseMapInfo {
/// The ASTWriter class produces a bitstream containing the serialized
/// representation of a given abstract syntax tree and its supporting
/// data structures. This bitstream can be de-serialized via an
-/// instance of the PCHReader class.
+/// instance of the ASTReader class.
class ASTWriter : public PCHDeserializationListener {
public:
typedef llvm::SmallVector<uint64_t, 64> RecordData;
@@ -83,8 +83,8 @@ private:
/// \brief The bitstream writer used to emit this precompiled header.
llvm::BitstreamWriter &Stream;
- /// \brief The reader of existing PCH files, if we're chaining.
- PCHReader *Chain;
+ /// \brief The reader of existing AST files, if we're chaining.
+ ASTReader *Chain;
/// \brief Stores a declaration or a type to be written to the AST file.
class DeclOrType {
@@ -461,7 +461,7 @@ public:
bool hasChain() const { return Chain; }
// PCHDeserializationListener implementation
- void SetReader(PCHReader *Reader);
+ void SetReader(ASTReader *Reader);
void IdentifierRead(pch::IdentID ID, IdentifierInfo *II);
void TypeRead(pch::TypeID ID, QualType T);
void DeclRead(pch::DeclID ID, const Decl *D);
diff --git a/include/clang/Serialization/PCHDeserializationListener.h b/include/clang/Serialization/PCHDeserializationListener.h
index 4ba0cec550..37e82d3ef5 100644
--- a/include/clang/Serialization/PCHDeserializationListener.h
+++ b/include/clang/Serialization/PCHDeserializationListener.h
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
// This file defines the PCHDeserializationListener class, which is notified
-// by the PCHReader whenever a type or declaration is deserialized.
+// by the ASTReader whenever a type or declaration is deserialized.
//
//===----------------------------------------------------------------------===//
@@ -20,7 +20,7 @@
namespace clang {
class Decl;
-class PCHReader;
+class ASTReader;
class QualType;
class PCHDeserializationListener {
@@ -29,7 +29,7 @@ protected:
public:
/// \brief Tell the listener about the reader.
- virtual void SetReader(PCHReader *Reader) = 0;
+ virtual void SetReader(ASTReader *Reader) = 0;
/// \brief An identifier was deserialized from the PCH.
virtual void IdentifierRead(pch::IdentID ID, IdentifierInfo *II) = 0;
diff --git a/include/clang/Serialization/PCHReader.h b/include/clang/Serialization/PCHReader.h
index a079e3e26e..8de77cdfdb 100644
--- a/include/clang/Serialization/PCHReader.h
+++ b/include/clang/Serialization/PCHReader.h
@@ -1,4 +1,4 @@
-//===--- PCHReader.h - Precompiled Headers Reader ---------------*- C++ -*-===//
+//===--- PCHReader.h - AST File Reader --------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// This file defines the PCHReader class, which reads a precompiled header.
+// This file defines the ASTReader class, which reads AST files.
//
//===----------------------------------------------------------------------===//
@@ -15,8 +15,8 @@
#define LLVM_CLANG_FRONTEND_PCH_READER_H
#include "clang/Serialization/PCHBitCodes.h"
-#include "clang/AST/DeclarationName.h"
#include "clang/Sema/ExternalSemaSource.h"
+#include "clang/AST/DeclarationName.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/Type.h"
#include "clang/AST/TemplateBase.h"
@@ -63,7 +63,7 @@ class PCHDeserializationListener;
class Preprocessor;
class Sema;
class SwitchCase;
-class PCHReader;
+class ASTReader;
class PCHDeclReader;
struct HeaderFileInfo;
@@ -76,11 +76,11 @@ struct PCHPredefinesBlock {
};
typedef llvm::SmallVector<PCHPredefinesBlock, 2> PCHPredefinesBlocks;
-/// \brief Abstract interface for callback invocations by the PCHReader.
+/// \brief Abstract interface for callback invocations by the ASTReader.
///
-/// While reading a PCH file, the PCHReader will call the methods of the
+/// 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 PCHReader that the information (and
+/// return true to indicate to the ASTReader that the information (and
/// consequently the PCH file) is invalid.
class PCHReaderListener {
public:
@@ -128,12 +128,12 @@ public:
/// the PCH file against an initialized Preprocessor.
class PCHValidator : public PCHReaderListener {
Preprocessor &PP;
- PCHReader &Reader;
+ ASTReader &Reader;
unsigned NumHeaderInfos;
public:
- PCHValidator(Preprocessor &PP, PCHReader &Reader)
+ PCHValidator(Preprocessor &PP, ASTReader &Reader)
: PP(PP), Reader(Reader), NumHeaderInfos(0) {}
virtual bool ReadLanguageOptions(const LangOptions &LangOpts);
@@ -148,19 +148,19 @@ private:
void Error(const char *Msg);
};
-/// \brief Reads a precompiled header chain containing the contents of a
-/// translation unit.
+/// \brief Reads an AST files chain containing the contents of a translation
+/// unit.
///
-/// The PCHReader class reads bitstreams (produced by the ASTWriter
+/// The ASTReader class reads bitstreams (produced by the ASTWriter
/// class) containing the serialized representation of a given
/// abstract syntax tree and its supporting data structures. An
-/// instance of the PCHReader can be attached to an ASTContext object,
-/// which will provide access to the contents of the PCH files.
+/// instance of the ASTReader can be attached to an ASTContext object,
+/// which will provide access to the contents of the AST files.
///
-/// The PCH reader provides lazy de-serialization of declarations, as
+/// The AST reader provides lazy de-serialization of declarations, as
/// required when traversing the AST. Only those AST nodes that are
/// actually required will be de-serialized.
-class PCHReader
+class ASTReader
: public ExternalPreprocessorSource,
public ExternalPreprocessingRecordSource,
public ExternalSemaSource,
@@ -168,11 +168,11 @@ class PCHReader
public ExternalIdentifierLookup,
public ExternalSLocEntrySource {
public:
- enum PCHReadResult { Success, Failure, IgnorePCH };
+ enum ASTReadResult { Success, Failure, IgnorePCH };
friend class PCHValidator;
friend class PCHDeclReader;
private:
- /// \brief The receiver of some callbacks invoked by PCHReader.
+ /// \brief The receiver of some callbacks invoked by ASTReader.
llvm::OwningPtr<PCHReaderListener> Listener;
/// \brief The receiver of deserialization events.
@@ -532,14 +532,14 @@ private:
/// \brief RAII object to change the reading kind.
class ReadingKindTracker {
- PCHReader &Reader;
+ ASTReader &Reader;
enum ReadingKind PrevKind;
ReadingKindTracker(const ReadingKindTracker&); // do not implement
ReadingKindTracker &operator=(const ReadingKindTracker&);// do not implement
public:
- ReadingKindTracker(enum ReadingKind newKind, PCHReader &reader)
+ ReadingKindTracker(enum ReadingKind newKind, ASTReader &reader)
: Reader(reader), PrevKind(Reader.ReadingKind) {
Reader.ReadingKind = newKind;
}
@@ -566,12 +566,12 @@ private:
void MaybeAddSystemRootToFilename(std::string &Filename);
- PCHReadResult ReadPCHCore(llvm::StringRef FileName);
- PCHReadResult ReadPCHBlock(PerFileData &F);
+ ASTReadResult ReadPCHCore(llvm::StringRef FileName);
+ ASTReadResult ReadPCHBlock(PerFileData &F);
bool CheckPredefinesBuffers();
bool ParseLineTable(llvm::SmallVectorImpl<uint64_t> &Record);
- PCHReadResult ReadSourceManagerBlock(PerFileData &F);
- PCHReadResult ReadSLocEntryRecord(unsigned ID);
+ ASTReadResult ReadSourceManagerBlock(PerFileData &F);
+ ASTReadResult ReadSLocEntryRecord(unsigned ID);
llvm::BitstreamCursor &SLocCursorForID(unsigned ID);
bool ParseLanguageOptions(const llvm::SmallVectorImpl<uint64_t> &Record);
@@ -591,8 +591,8 @@ private:
/// do with non-routine failures (e.g., corrupted PCH file).
void Error(const char *Msg);
- PCHReader(const PCHReader&); // do not implement
- PCHReader &operator=(const PCHReader &); // do not implement
+ ASTReader(const ASTReader&); // do not implement
+ ASTReader &operator=(const ASTReader &); // do not implement
public:
typedef llvm::SmallVector<uint64_t, 64> RecordData;
@@ -612,7 +612,7 @@ public:
/// \param DisableValidation If true, the PCH reader will suppress most
/// of its regular consistency checking, allowing the use of precompiled
/// headers that cannot be determined to be compatible.
- PCHReader(Preprocessor &PP, ASTContext *Context, const char *isysroot = 0,
+ ASTReader(Preprocessor &PP, ASTContext *Context, const char *isysroot = 0,
bool DisableValidation = false);
/// \brief Load the PCH file without using any pre-initialized Preprocessor.
@@ -636,14 +636,14 @@ public:
/// \param DisableValidation If true, the PCH reader will suppress most
/// of its regular consistency checking, allowing the use of precompiled
/// headers that cannot be determined to be compatible.
- PCHReader(SourceManager &SourceMgr, FileManager &FileMgr,
+ ASTReader(SourceManager &SourceMgr, FileManager &FileMgr,
Diagnostic &Diags, const char *isysroot = 0,
bool DisableValidation = false);
- ~PCHReader();
+ ~ASTReader();
/// \brief Load the precompiled header designated by the given file
/// name.
- PCHReadResult ReadPCH(const std::string &FileName);
+ ASTReadResult ReadPCH(const std::string &FileName);
/// \brief Set the PCH callbacks listener.
void setListener(PCHReaderListener *listener) {
@@ -767,12 +767,12 @@ public:
virtual bool FindExternalLexicalDecls(const DeclContext *DC,
llvm::SmallVectorImpl<Decl*> &Decls);
- /// \brief Notify PCHReader that we started deserialization of
+ /// \brief Notify ASTReader that we started deserialization of
/// a decl or type so until FinishedDeserializing is called there may be
/// decls that are initializing. Must be paired with FinishedDeserializing.
virtual void StartedDeserializing() { ++NumCurrentElementsDeserializing; }
- /// \brief Notify PCHReader that we finished the deserialization of
+ /// \brief Notify ASTReader that we finished the deserialization of
/// a decl or type. Must be paired with StartedDeserializing.
virtual void FinishedDeserializing();
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp
index 53a1035a76..7a2a5afe9a 100644
--- a/lib/Frontend/ASTUnit.cpp
+++ b/lib/Frontend/ASTUnit.cpp
@@ -302,7 +302,7 @@ void ASTUnit::ClearCachedCompletionResults() {
namespace {
-/// \brief Gathers information from PCHReader that will be used to initialize
+/// \brief Gathers information from ASTReader that will be used to initialize
/// a Preprocessor.
class PCHInfoCollector : public PCHReaderListener {
LangOptions &LangOpt;
@@ -400,7 +400,7 @@ const std::string &ASTUnit::getOriginalSourceFileName() {
const std::string &ASTUnit::getPCHFileName() {
assert(isMainFileAST() && "Not an ASTUnit from a PCH file!");
- return static_cast<PCHReader *>(Ctx->getExternalSource())->getFileName();
+ return static_cast<ASTReader *>(Ctx->getExternalSource())->getFileName();
}
ASTUnit *ASTUnit::LoadFromPCHFile(const std::string &Filename,
@@ -456,19 +456,19 @@ ASTUnit *ASTUnit::LoadFromPCHFile(const std::string &Filename,
std::string Predefines;
unsigned Counter;
- llvm::OwningPtr<PCHReader> Reader;
+ llvm::OwningPtr<ASTReader> Reader;
- Reader.reset(new PCHReader(AST->getSourceManager(), AST->getFileManager(),
+ Reader.reset(new ASTReader(AST->getSourceManager(), AST->getFileManager(),
AST->getDiagnostics()));
Reader->setListener(new PCHInfoCollector(LangInfo, HeaderInfo, TargetTriple,
Predefines, Counter));
switch (Reader->ReadPCH(Filename)) {
- case PCHReader::Success:
+ case ASTReader::Success:
break;
- case PCHReader::Failure:
- case PCHReader::IgnorePCH:
+ case ASTReader::Failure:
+ case ASTReader::IgnorePCH:
AST->getDiagnostics().Report(diag::err_fe_unable_to_load_pch);
return NULL;
}
@@ -510,17 +510,17 @@ ASTUnit *ASTUnit::LoadFromPCHFile(const std::string &Filename,
Reader->InitializeContext(Context);
- // Attach the PCH reader to the AST context as an external AST
+ // Attach the AST reader to the AST context as an external AST
// source, so that declarations will be deserialized from the
// PCH file as needed.
- PCHReader *ReaderPtr = Reader.get();
+ ASTReader *ReaderPtr = Reader.get();
llvm::OwningPtr<ExternalASTSource> Source(Reader.take());
Context.setExternalSource(Source);
// Create an AST consumer, even though it isn't used.
AST->Consumer.reset(new ASTConsumer);
- // Create a semantic analysis object and tell the PCH reader about it.
+ // Create a semantic analysis object and tell the AST reader about it.
AST->TheSema.reset(new Sema(PP, Context, *AST->Consumer));
AST->TheSema->Initialize();
ReaderPtr->InitializeSema(*AST->TheSema);
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index 5db612542f..b930702ef4 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -264,25 +264,25 @@ CompilerInstance::createPCHExternalASTSource(llvm::StringRef Path,
Preprocessor &PP,
ASTContext &Context,
void *DeserializationListener) {
- llvm::OwningPtr<PCHReader> Reader;
- Reader.reset(new PCHReader(PP, &Context,
+ llvm::OwningPtr<ASTReader> Reader;
+ Reader.reset(new ASTReader(PP, &Context,
Sysroot.empty() ? 0 : Sysroot.c_str(),
DisablePCHValidation));
Reader->setDeserializationListener(
static_cast<PCHDeserializationListener *>(DeserializationListener));
switch (Reader->ReadPCH(Path)) {
- case PCHReader::Success:
+ case ASTReader::Success:
// Set the predefines buffer as suggested by the PCH reader. Typically, the
// predefines buffer will be empty.
PP.setPredefines(Reader->getSuggestedPredefines());
return Reader.take();
- case PCHReader::Failure:
+ case ASTReader::Failure:
// Unrecoverable failure: don't even try to process the input file.
break;
- case PCHReader::IgnorePCH:
+ case ASTReader::IgnorePCH:
// No suitable PCH file could be found. Return an error.
break;
}
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 68b384f48c..f40fb644e3 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -1418,7 +1418,7 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
// PCH is handled specially, we need to extra the original include path.
if (A->getOption().matches(OPT_include_pch)) {
std::string OriginalFile =
- PCHReader::getOriginalSourceFile(A->getValue(Args), Diags);
+ ASTReader::getOriginalSourceFile(A->getValue(Args), Diags);
if (OriginalFile.empty())
continue;
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index 03feed0e54..ec118e9916 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -49,7 +49,7 @@ void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
VAListTagName = PP.getIdentifierInfo("__va_list_tag");
- if (!Context.isInt128Installed() && // May be set by PCHReader.
+ if (!Context.isInt128Installed() && // May be set by ASTReader.
PP.getTargetInfo().getPointerWidth(0) >= 64) {
TypeSourceInfo *TInfo;
@@ -71,7 +71,7 @@ void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
if (!PP.getLangOptions().ObjC1) return;
- // Built-in ObjC types may already be set by PCHReader (hence isNull checks).
+ // Built-in ObjC types may already be set by ASTReader (hence isNull checks).
if (Context.getObjCSelType().isNull()) {
// Create the built-in typedef for 'SEL'.
QualType SelT = Context.getPointerType(Context.ObjCBuiltinSelTy);
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp
index fa958796a8..6f0c8ce0d6 100644
--- a/lib/Serialization/ASTWriter.cpp
+++ b/lib/Serialization/ASTWriter.cpp
@@ -2911,7 +2911,7 @@ void ASTWriter::AddCXXBaseOrMemberInitializers(
}
}
-void ASTWriter::SetReader(PCHReader *Reader) {
+void ASTWriter::SetReader(ASTReader *Reader) {
assert(Reader && "Cannot remove chain");
assert(FirstDeclID == NextDeclID &&
FirstTypeID == NextTypeID &&
diff --git a/lib/Serialization/GeneratePCH.cpp b/lib/Serialization/GeneratePCH.cpp
index 6782bf8c03..ebc3c02b41 100644
--- a/lib/Serialization/GeneratePCH.cpp
+++ b/lib/Serialization/GeneratePCH.cpp
@@ -36,7 +36,7 @@ PCHGenerator::PCHGenerator(const Preprocessor &PP,
// calls.
StatCalls = new MemorizeStatCalls;
// If we have a chain, we want new stat calls only, so install the memorizer
- // *after* the already installed PCHReader's stat cache.
+ // *after* the already installed ASTReader's stat cache.
PP.getFileManager().addStatCache(StatCalls,
/*AtBeginning=*/!Chaining);
}
diff --git a/lib/Serialization/PCHReader.cpp b/lib/Serialization/PCHReader.cpp
index 852bbaf21a..5b6ed8a1d7 100644
--- a/lib/Serialization/PCHReader.cpp
+++ b/lib/Serialization/PCHReader.cpp
@@ -1,4 +1,4 @@
-//===--- PCHReader.cpp - Precompiled Headers Reader -------------*- C++ -*-===//
+//===--- PCHReader.cpp - AST File Reader ------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// This file defines the PCHReader class, which reads a precompiled header.
+// This file defines the ASTReader class, which reads AST files.
//
//===----------------------------------------------------------------------===//
@@ -410,10 +410,10 @@ void PCHValidator::ReadCounter(unsigned Value) {
}
//===----------------------------------------------------------------------===//
-// PCH reader implementation
+// AST reader implementation
//===----------------------------------------------------------------------===//
-PCHReader::PCHReader(Preprocessor &PP, ASTContext *Context,
+ASTReader::ASTReader(Preprocessor &PP, ASTContext *Context,
const char *isysroot, bool DisableValidation)
: Listener(new PCHValidator(PP, *this)), DeserializationListener(0),
SourceMgr(PP.getSourceManager()), FileMgr(PP.getFileManager()),
@@ -429,7 +429,7 @@ PCHReader::PCHReader(Preprocessor &PP, ASTContext *Context,
RelocatablePCH = false;
}
-PCHReader::PCHReader(SourceManager &SourceMgr, FileManager &FileMgr,
+ASTReader::ASTReader(SourceManager &SourceMgr, FileManager &FileMgr,
Diagnostic &Diags, const char *isysroot,
bool DisableValidation)
: DeserializationListener(0), SourceMgr(SourceMgr), FileMgr(FileMgr),
@@ -445,12 +445,12 @@ PCHReader::PCHReader(SourceManager &SourceMgr, FileManager &FileMgr,
RelocatablePCH = false;
}
-PCHReader::~PCHReader() {
+ASTReader::~ASTReader() {
for (unsigned i = 0, e = Chain.size(); i != e; ++i)
delete Chain[e - i - 1];
}
-PCHReader::PerFileData::PerFileData()
+ASTReader::PerFileData::PerFileData()
: StatCache(0), LocalNumSLocEntries(0), LocalNumTypes(0), TypeOffsets(0),
LocalNumDecls(0), DeclOffsets(0), LocalNumIdentifiers(0),
IdentifierOffsets(0), IdentifierTableData(0), IdentifierLookupTable(0),
@@ -460,7 +460,7 @@ PCHReader::PerFileData::PerFileData()
{}
void
-PCHReader::setDeserializationListener(PCHDeserializationListener *Listener) {
+ASTReader::setDeserializationListener(PCHDeserializationListener *Listener) {
DeserializationListener = Listener;
if (DeserializationListener)
DeserializationListener->SetReader(this);
@@ -469,7 +469,7 @@ PCHReader::setDeserializationListener(PCHDeserializationListener *Listener) {
namespace {
class PCHSelectorLookupTrait {
- PCHReader &Reader;
+ ASTReader &Reader;
public:
struct data_type {
@@ -480,7 +480,7 @@ public:
typedef Selector external_key_type;
typedef external_key_type internal_key_type;
- explicit PCHSelectorLookupTrait(PCHReader &Reader) : Reader(Reader) { }
+ explicit PCHSelectorLookupTrait(ASTReader &Reader) : Reader(Reader) { }
static bool EqualKey(const internal_key_type& a,
const internal_key_type& b) {
@@ -586,7 +586,7 @@ typedef OnDiskChainedHashTable<PCHSelectorLookupTrait>
namespace {
class PCHIdentifierLookupTrait {
- PCHReader &Reader;
+ ASTReader &Reader;
llvm::BitstreamCursor &Stream;
// If we know the IdentifierInfo in advance, it is here and we will
@@ -601,7 +601,7 @@ public:
typedef external_key_type internal_key_type;
- PCHIdentifierLookupTrait(PCHReader &Reader, llvm::BitstreamCursor &Stream,
+ PCHIdentifierLookupTrait(ASTReader &Reader, llvm::BitstreamCursor &Stream,
IdentifierInfo *II = 0)
: Reader(Reader), Stream(Stream), KnownII(II) { }
@@ -721,7 +721,7 @@ public:
typedef OnDiskChainedHashTable<PCHIdentifierLookupTrait>
PCHIdentifierLookupTable;
-void PCHReader::Error(const char *Msg) {
+void ASTReader::Error(const char *Msg) {
Diag(diag::err_fe_pch_malformed) << Msg;
}
@@ -734,7 +734,7 @@ void PCHReader::Error(const char *Msg) {
///
/// \returns true if there was a mismatch (in which case the PCH file
/// should be ignored), or false otherwise.
-bool PCHReader::CheckPredefinesBuffers() {
+bool ASTReader::CheckPredefinesBuffers() {
if (Listener)
return Listener->ReadPredefinesBuffer(PCHPredefinesBuffers,
ActualOriginalFileName,
@@ -748,7 +748,7 @@ bool PCHReader::CheckPredefinesBuffers() {
/// \brief Read the line table in the source manager block.
/// \returns true if ther was an error.
-bool PCHReader::ParseLineTable(llvm::SmallVectorImpl<uint64_t> &Record) {
+bool ASTReader::ParseLineTable(llvm::SmallVectorImpl<uint64_t> &Record) {
unsigned Idx = 0;
LineTableInfo &LineTable = SourceMgr.getLineTable();
@@ -900,7 +900,7 @@ public:
/// \brief Read a source manager block
-PCHReader::PCHReadResult PCHReader::ReadSourceManagerBlock(PerFileData &F) {
+ASTReader::ASTReadResult ASTReader::ReadSourceManagerBlock(PerFileData &F) {
using namespace SrcMgr;
llvm::BitstreamCursor &SLocEntryCursor = F.SLocEntryCursor;
@@ -973,7 +973,7 @@ PCHReader::PCHReadResult PCHReader::ReadSourceManagerBlock(PerFileData &F) {
/// \brief Get a cursor that's correctly positioned for reading the source
/// location entry with the given ID.
-llvm::BitstreamCursor &PCHReader::SLocCursorForID(unsigned ID) {
+llvm::BitstreamCursor &ASTReader::SLocCursorForID(unsigned ID) {
assert(ID != 0 && ID <= TotalNumSLocEntries &&
"SLocCursorForID should only be called for real IDs.");
@@ -992,7 +992,7 @@ llvm::BitstreamCursor &PCHReader::SLocCursorForID(unsigned ID) {
}
/// \brief Read in the source location entry with the given ID.
-PCHReader::PCHReadResult PCHReader::ReadSLocEntryRecord(unsigned ID) {
+ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(unsigned ID) {
if (ID == 0)
return Success;
@@ -1118,7 +1118,7 @@ PCHReader::PCHReadResult PCHReader::ReadSLocEntryRecord(unsigned ID) {
/// ReadBlockAbbrevs - Enter a subblock of the specified BlockID with the
/// specified cursor. Read the abbreviations that are at the top of the block
/// and then leave the cursor pointing into the block.
-bool PCHReader::ReadBlockAbbrevs(llvm::BitstreamCursor &Cursor,
+bool ASTReader::ReadBlockAbbrevs(llvm::BitstreamCursor &Cursor,
unsigned BlockID) {
if (Cursor.EnterSubBlock(BlockID)) {
Error("malformed block record in PCH file");
@@ -1135,7 +1135,7 @@ bool PCHReader::ReadBlockAbbrevs(llvm::BitstreamCursor &Cursor,
}
}
-void PCHReader::ReadMacroRecord(llvm::BitstreamCursor &Stream, uint64_t Offset){
+void ASTReader::ReadMacroRecord(llvm::BitstreamCursor &Stream, uint64_t Offset){
assert(PP && "Forgot to set Preprocessor ?");
// Keep track of where we are in the stream, then jump back there
@@ -1307,7 +1307,7 @@ void PCHReader::ReadMacroRecord(llvm::BitstreamCursor &Stream, uint64_t Offset){
}
}
-void PCHReader::ReadDefinedMacros() {
+void ASTReader::ReadDefinedMacros() {
for (unsigned I = 0, N = Chain.size(); I != N; ++I) {
llvm::BitstreamCursor &MacroCursor = Chain[N - I - 1]->MacroCursor;
@@ -1374,7 +1374,7 @@ void PCHReader::ReadDefinedMacros() {
}
}
-MacroDefinition *PCHReader::getMacroDefinition(pch::IdentID ID) {
+MacroDefinition *ASTReader::getMacroDefinition(pch::IdentID ID) {
if (ID == 0 || ID >= MacroDefinitionsLoaded.size())
return 0;
@@ -1397,7 +1397,7 @@ MacroDefinition *PCHReader::getMacroDefinition(pch::IdentID ID) {
/// \brief If we are loading a relocatable PCH file, and the filename is
/// not an absolute path, add the system root to the beginning of the file
/// name.
-void PCHReader::MaybeAddSystemRootToFilename(std::string &Filename) {
+void ASTReader::MaybeAddSystemRootToFilename(std::string &Filename) {
// If this is not a relocatable PCH file, there's nothing to do.
if (!RelocatablePCH)
return;
@@ -1418,8 +1418,8 @@ void PCHReader::MaybeAddSystemRootToFilename(std::string &Filename) {
Filename.insert(Filename.begin(), isysroot, isysroot + Length);
}
-PCHReader::PCHReadResult
-PCHReader::ReadPCHBlock(PerFileData &F) {
+ASTReader::ASTReadResult
+ASTReader::ReadPCHBlock(PerFileData &F) {
llvm::BitstreamCursor &Stream = F.Stream;
if (Stream.EnterSubBlock(pch::PCH_BLOCK_ID)) {
@@ -1698,7 +1698,7 @@ PCHReader::ReadPCHBlock(PerFileData &F) {
case pch::SOURCE_LOCATION_PRELOADS:
for (unsigned I = 0, N = Record.size(); I != N; ++I) {
- PCHReadResult Result = ReadSLocEntryRecord(Record[I]);
+ ASTReadResult Result = ReadSLocEntryRecord(Record[I]);
if (Result != Success)
return Result;
}
@@ -1792,7 +1792,7 @@ PCHReader::ReadPCHBlock(PerFileData &F) {
return Failure;
}
-PCHReader::PCHReadResult PCHReader::ReadPCH(const std::string &FileName) {
+ASTReader::ASTReadResult ASTReader::ReadPCH(const std::string &FileName) {
switch(ReadPCHCore(FileName)) {
case Failure: return Failure;
case IgnorePCH: return IgnorePCH;
@@ -1882,7 +1882,7 @@ PCHReader::PCHReadResult PCHReader::ReadPCH(const std::string &FileName) {
return Success;
}
-PCHReader::PCHReadResult PCHReader::ReadPCHCore(llvm::StringRef FileName) {
+ASTReader::ASTReadResult ASTReader::ReadPCHCore(llvm::StringRef FileName) {
Chain.push_back(new PerFileData());
PerFileData &F = *Chain.back();
@@ -1969,7 +1969,7 @@ PCHReader::PCHReadResult PCHReader::ReadPCHCore(llvm::StringRef FileName) {
return Success;
}
-void PCHReader::setPreprocessor(Preprocessor &pp) {
+void ASTReader::setPreprocessor(Preprocessor &pp) {
PP = &pp;
unsigned TotalNum = 0;
@@ -1982,7 +1982,7 @@ void PCHReader::setPreprocessor(Preprocessor &pp) {
}
}
-void PCHReader::InitializeContext(ASTContext &Ctx) {
+void ASTReader::InitializeContext(ASTContext &Ctx) {
Context = &Ctx;
assert(Context && "Passed null context!");
@@ -2083,7 +2083,7 @@ void PCHReader::InitializeContext(ASTContext &Ctx) {
/// \brief Retrieve the name of the original source file name
/// directly from the PCH file, without actually loading the PCH
/// file.
-std::string PCHReader::getOriginalSourceFile(const std::string &PCHFileName,
+std::string ASTReader::getOriginalSourceFile(const std::string &PCHFileName,
Diagnostic &Diags) {
// Open the PCH file.
std::string ErrStr;<