aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2010-08-18 23:57:06 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2010-08-18 23:57:06 +0000
commit3c7f4134603d04b44f997b43c0a9def270f25386 (patch)
tree6fbfa6b8a2599041e354512a7aa9ad1f0db283a9 /lib
parent571db7f0cb31789737be92fce1c1b738e6dbe795 (diff)
More PCH -> AST renaming.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111472 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Basic/IdentifierTable.cpp2
-rw-r--r--lib/Basic/SourceManager.cpp2
-rw-r--r--lib/Checker/GRCoreEngine.cpp2
-rw-r--r--lib/Frontend/ASTMerge.cpp4
-rw-r--r--lib/Frontend/ASTUnit.cpp18
-rw-r--r--lib/Frontend/FrontendAction.cpp2
-rw-r--r--lib/Lex/MacroInfo.cpp4
-rw-r--r--lib/Sema/IdentifierResolver.cpp8
-rw-r--r--lib/Sema/SemaCodeComplete.cpp6
-rw-r--r--lib/Sema/SemaDeclObjC.cpp4
-rw-r--r--lib/Serialization/ASTWriter.cpp6
-rw-r--r--lib/Serialization/GeneratePCH.cpp2
-rw-r--r--lib/Serialization/PCHReader.cpp252
-rw-r--r--lib/Serialization/PCHReaderDecl.cpp8
-rw-r--r--lib/Serialization/PCHReaderStmt.cpp4
15 files changed, 153 insertions, 171 deletions
diff --git a/lib/Basic/IdentifierTable.cpp b/lib/Basic/IdentifierTable.cpp
index c7b16c99c9..e0d8571676 100644
--- a/lib/Basic/IdentifierTable.cpp
+++ b/lib/Basic/IdentifierTable.cpp
@@ -34,7 +34,7 @@ IdentifierInfo::IdentifierInfo() {
IsPoisoned = false;
IsCPPOperatorKeyword = false;
NeedsHandleIdentifier = false;
- IsFromPCH = false;
+ IsFromAST = false;
RevertedTokenID = false;
FETokenInfo = 0;
Entry = 0;
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp
index 0a6ce4c03e..a01b002977 100644
--- a/lib/Basic/SourceManager.cpp
+++ b/lib/Basic/SourceManager.cpp
@@ -1247,7 +1247,7 @@ bool SourceManager::isBeforeInTranslationUnit(SourceLocation LHS,
}
// There is no common ancestor, most probably because one location is in the
- // predefines buffer or a PCH file.
+ // predefines buffer or an AST file.
// FIXME: We should rearrange the external interface so this simply never
// happens; it can't conceptually happen. Also see PR5662.
IsBeforeInTUCache.setQueryFIDs(FileID(), FileID()); // Don't try caching.
diff --git a/lib/Checker/GRCoreEngine.cpp b/lib/Checker/GRCoreEngine.cpp
index e0524d9ef4..5125f366de 100644
--- a/lib/Checker/GRCoreEngine.cpp
+++ b/lib/Checker/GRCoreEngine.cpp
@@ -696,7 +696,7 @@ void GRCallEnterNodeBuilder::GenerateNode(const GRState *state,
// Create a new AnalysisManager with components of the callee's
// TranslationUnit.
- // The Diagnostic is actually shared when we create ASTUnits from PCH files.
+ // The Diagnostic is actually shared when we create ASTUnits from AST files.
AnalysisManager AMgr(TU->getASTContext(), TU->getDiagnostic(),
OldMgr.getLangOptions(),
OldMgr.getPathDiagnosticClient(),
diff --git a/lib/Frontend/ASTMerge.cpp b/lib/Frontend/ASTMerge.cpp
index cbaa6a3034..b46212feda 100644
--- a/lib/Frontend/ASTMerge.cpp
+++ b/lib/Frontend/ASTMerge.cpp
@@ -40,13 +40,13 @@ void ASTMergeAction::ExecuteAction() {
&CI.getASTContext());
llvm::IntrusiveRefCntPtr<Diagnostic> Diags(&CI.getDiagnostics());
for (unsigned I = 0, N = ASTFiles.size(); I != N; ++I) {
- ASTUnit *Unit = ASTUnit::LoadFromPCHFile(ASTFiles[I], Diags, false);
+ ASTUnit *Unit = ASTUnit::LoadFromASTFile(ASTFiles[I], Diags, false);
if (!Unit)
continue;
// Reset the argument -> string function so that it has the AST
// context we want, since the Sema object created by
- // LoadFromPCHFile will override it.
+ // LoadFromASTFile will override it.
CI.getDiagnostics().SetArgToStringFn(&FormatASTNodeDiagnosticArgument,
&CI.getASTContext());
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp
index e0aa1b47e7..1749836536 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 ASTReaderListener {
+class ASTInfoCollector : public ASTReaderListener {
LangOptions &LangOpt;
HeaderSearch &HSI;
std::string &TargetTriple;
@@ -314,7 +314,7 @@ class PCHInfoCollector : public ASTReaderListener {
unsigned NumHeaderInfos;
public:
- PCHInfoCollector(LangOptions &LangOpt, HeaderSearch &HSI,
+ ASTInfoCollector(LangOptions &LangOpt, HeaderSearch &HSI,
std::string &TargetTriple, std::string &Predefines,
unsigned &Counter)
: LangOpt(LangOpt), HSI(HSI), TargetTriple(TargetTriple),
@@ -398,12 +398,12 @@ const std::string &ASTUnit::getOriginalSourceFileName() {
return OriginalSourceFile;
}
-const std::string &ASTUnit::getPCHFileName() {
- assert(isMainFileAST() && "Not an ASTUnit from a PCH file!");
+const std::string &ASTUnit::getASTFileName() {
+ assert(isMainFileAST() && "Not an ASTUnit from an AST file!");
return static_cast<ASTReader *>(Ctx->getExternalSource())->getFileName();
}
-ASTUnit *ASTUnit::LoadFromPCHFile(const std::string &Filename,
+ASTUnit *ASTUnit::LoadFromASTFile(const std::string &Filename,
llvm::IntrusiveRefCntPtr<Diagnostic> Diags,
bool OnlyLocalDecls,
RemappedFile *RemappedFiles,
@@ -460,7 +460,7 @@ ASTUnit *ASTUnit::LoadFromPCHFile(const std::string &Filename,
Reader.reset(new ASTReader(AST->getSourceManager(), AST->getFileManager(),
AST->getDiagnostics()));
- Reader->setListener(new PCHInfoCollector(LangInfo, HeaderInfo, TargetTriple,
+ Reader->setListener(new ASTInfoCollector(LangInfo, HeaderInfo, TargetTriple,
Predefines, Counter));
switch (Reader->ReadAST(Filename)) {
@@ -475,11 +475,11 @@ ASTUnit *ASTUnit::LoadFromPCHFile(const std::string &Filename,
AST->OriginalSourceFile = Reader->getOriginalSourceFile();
- // PCH loaded successfully. Now create the preprocessor.
+ // AST file loaded successfully. Now create the preprocessor.
// Get information about the target being compiled for.
//
- // FIXME: This is broken, we should store the TargetOptions in the PCH.
+ // FIXME: This is broken, we should store the TargetOptions in the AST file.
TargetOptions TargetOpts;
TargetOpts.ABI = "";
TargetOpts.CXXABI = "itanium";
@@ -512,7 +512,7 @@ ASTUnit *ASTUnit::LoadFromPCHFile(const std::string &Filename,
// 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.
+ // AST file as needed.
ASTReader *ReaderPtr = Reader.get();
llvm::OwningPtr<ExternalASTSource> Source(Reader.take());
Context.setExternalSource(Source);
diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp
index 906fd9a76c..531213bf1b 100644
--- a/lib/Frontend/FrontendAction.cpp
+++ b/lib/Frontend/FrontendAction.cpp
@@ -51,7 +51,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
llvm::IntrusiveRefCntPtr<Diagnostic> Diags(&CI.getDiagnostics());
std::string Error;
- ASTUnit *AST = ASTUnit::LoadFromPCHFile(Filename, Diags);
+ ASTUnit *AST = ASTUnit::LoadFromASTFile(Filename, Diags);
if (!AST)
goto failure;
diff --git a/lib/Lex/MacroInfo.cpp b/lib/Lex/MacroInfo.cpp
index 6eac0364f6..c6d09349b5 100644
--- a/lib/Lex/MacroInfo.cpp
+++ b/lib/Lex/MacroInfo.cpp
@@ -20,7 +20,7 @@ MacroInfo::MacroInfo(SourceLocation DefLoc) : Location(DefLoc) {
IsC99Varargs = false;
IsGNUVarargs = false;
IsBuiltinMacro = false;
- IsFromPCH = false;
+ IsFromAST = false;
IsDisabled = false;
IsUsed = true;
IsAllowRedefinitionsWithoutWarning = false;
@@ -37,7 +37,7 @@ MacroInfo::MacroInfo(const MacroInfo &MI, llvm::BumpPtrAllocator &PPAllocator) {
IsC99Varargs = MI.IsC99Varargs;
IsGNUVarargs = MI.IsGNUVarargs;
IsBuiltinMacro = MI.IsBuiltinMacro;
- IsFromPCH = MI.IsFromPCH;
+ IsFromAST = MI.IsFromAST;
IsDisabled = MI.IsDisabled;
IsUsed = MI.IsUsed;
IsAllowRedefinitionsWithoutWarning = MI.IsAllowRedefinitionsWithoutWarning;
diff --git a/lib/Sema/IdentifierResolver.cpp b/lib/Sema/IdentifierResolver.cpp
index 2e33c1e6a4..d38f403d39 100644
--- a/lib/Sema/IdentifierResolver.cpp
+++ b/lib/Sema/IdentifierResolver.cpp
@@ -140,7 +140,7 @@ bool IdentifierResolver::isDeclInScope(Decl *D, DeclContext *Ctx,
void IdentifierResolver::AddDecl(NamedDecl *D) {
DeclarationName Name = D->getDeclName();
if (IdentifierInfo *II = Name.getAsIdentifierInfo())
- II->setIsFromPCH(false);
+ II->setIsFromAST(false);
void *Ptr = Name.getFETokenInfo<void>();
@@ -168,7 +168,7 @@ void IdentifierResolver::RemoveDecl(NamedDecl *D) {
assert(D && "null param passed");
DeclarationName Name = D->getDeclName();
if (IdentifierInfo *II = Name.getAsIdentifierInfo())
- II->setIsFromPCH(false);
+ II->setIsFromAST(false);
void *Ptr = Name.getFETokenInfo<void>();
@@ -189,7 +189,7 @@ bool IdentifierResolver::ReplaceDecl(NamedDecl *Old, NamedDecl *New) {
DeclarationName Name = Old->getDeclName();
if (IdentifierInfo *II = Name.getAsIdentifierInfo())
- II->setIsFromPCH(false);
+ II->setIsFromAST(false);
void *Ptr = Name.getFETokenInfo<void>();
@@ -227,7 +227,7 @@ IdentifierResolver::begin(DeclarationName Name) {
void IdentifierResolver::AddDeclToIdentifierChain(IdentifierInfo *II,
NamedDecl *D) {
- II->setIsFromPCH(false);
+ II->setIsFromAST(false);
void *Ptr = II->getFETokenInfo<void>();
if (!Ptr) {
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp
index 4810dab7aa..635236ec4c 100644
--- a/lib/Sema/SemaCodeComplete.cpp
+++ b/lib/Sema/SemaCodeComplete.cpp
@@ -3581,7 +3581,7 @@ void Sema::CodeCompleteObjCClassMessage(Scope *S, TypeTy *Receiver,
// We're messaging "id" as a type; provide all class/factory methods.
// If we have an external source, load the entire class method
- // pool from the PCH file.
+ // pool from the AST file.
if (ExternalSource) {
for (uint32_t I = 0, N = ExternalSource->GetNumExternalSelectors();
I != N; ++I) {
@@ -3682,7 +3682,7 @@ void Sema::CodeCompleteObjCInstanceMessage(Scope *S, ExprTy *Receiver,
// about as code-completion results.
// If we have an external source, load the entire class method
- // pool from the PCH file.
+ // pool from the AST file.
if (ExternalSource) {
for (uint32_t I = 0, N = ExternalSource->GetNumExternalSelectors();
I != N; ++I) {
@@ -4239,7 +4239,7 @@ void Sema::CodeCompleteObjCMethodDeclSelector(Scope *S,
IdentifierInfo **SelIdents,
unsigned NumSelIdents) {
// If we have an external source, load the entire class method
- // pool from the PCH file.
+ // pool from the AST file.
if (ExternalSource) {
for (uint32_t I = 0, N = ExternalSource->GetNumExternalSelectors();
I != N; ++I) {
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 0fd3d6e9cc..0abc4a9152 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -90,7 +90,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
IDecl->setForwardDecl(false);
IDecl->setClassLoc(ClassLoc);
// If the forward decl was in a PCH, we need to write it again in a
- // chained PCH.
+ // dependent AST file.
IDecl->setChangedSinceDeserialization(true);
// Since this ObjCInterfaceDecl was created by a forward declaration,
@@ -288,7 +288,7 @@ Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc,
PDecl->setLocation(AtProtoInterfaceLoc);
PDecl->setForwardDecl(false);
CurContext->addDecl(PDecl);
- // Repeat in dependent PCHs.
+ // Repeat in dependent AST files.
PDecl->setChangedSinceDeserialization(true);
} else {
PDecl = ObjCProtocolDecl::Create(Context, CurContext,
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp
index 6f0c8ce0d6..6f456e5f4e 100644
--- a/lib/Serialization/ASTWriter.cpp
+++ b/lib/Serialization/ASTWriter.cpp
@@ -1271,7 +1271,7 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP) {
// Don't emit builtin macros like __LINE__ to the AST file unless they have
// been redefined by the header (in which case they are not isBuiltinMacro).
// Also skip macros from a AST file if we're chaining.
- if (MI->isBuiltinMacro() || (Chain && MI->isFromPCH()))
+ if (MI->isBuiltinMacro() || (Chain && MI->isFromAST()))
continue;
AddIdentifierRef(I->first, Record);
@@ -1900,7 +1900,7 @@ void ASTWriter::WriteIdentifierTable(Preprocessor &PP) {
ID = IdentifierIDs.begin(), IDEnd = IdentifierIDs.end();
ID != IDEnd; ++ID) {
assert(ID->first && "NULL identifier in identifier table");
- if (!Chain || !ID->first->isFromPCH())
+ if (!Chain || !ID->first->isFromAST())
Generator.insert(ID->first, ID->second);
}
@@ -2249,7 +2249,7 @@ void ASTWriter::WriteASTChain(Sema &SemaRef, MemorizeStatCalls *StatCalls,
// The special types are in the chained PCH.
// We don't start with the translation unit, but with its decls that
- // don't come from the other PCH.
+ // don't come from the chained PCH.
const TranslationUnitDecl *TU = Context.getTranslationUnitDecl();
llvm::SmallVector<pch::DeclID, 64> NewGlobalDecls;
for (DeclContext::decl_iterator I = TU->noload_decls_begin(),
diff --git a/lib/Serialization/GeneratePCH.cpp b/lib/Serialization/GeneratePCH.cpp
index f8dabaabc7..5329b6cbd4 100644
--- a/lib/Serialization/GeneratePCH.cpp
+++ b/lib/Serialization/GeneratePCH.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
// This file defines the CreatePCHGenerate function, which creates an
-// ASTConsumeR that generates a PCH file.
+// ASTConsumer that generates a PCH file.
//
//===----------------------------------------------------------------------===//
diff --git a/lib/Serialization/PCHReader.cpp b/lib/Serialization/PCHReader.cpp
index 72f4974fb8..5cf677a7cf 100644
--- a/lib/Serialization/PCHReader.cpp
+++ b/lib/Serialization/PCHReader.cpp
@@ -43,7 +43,7 @@
using namespace clang;
//===----------------------------------------------------------------------===//
-// PCH reader validator implementation
+// PCH validator implementation
//===----------------------------------------------------------------------===//
ASTReaderListener::~ASTReaderListener() {}
@@ -242,9 +242,6 @@ bool PCHValidator::ReadPredefinesBuffer(const PCHPredefinesBlocks &Buffers,
// If the concatenation of all the PCH buffers is equal to the adjusted
// command line, we're done.
- // We build a SmallVector of the command line here, because we'll eventually
- // need to support an arbitrary amount of pieces anyway (when we have chained
- // PCH reading).
llvm::SmallVector<llvm::StringRef, 2> CommandLine;
CommandLine.push_back(Left);
CommandLine.push_back(Right);
@@ -468,7 +465,7 @@ ASTReader::setDeserializationListener(ASTDeserializationListener *Listener) {
namespace {
-class PCHSelectorLookupTrait {
+class ASTSelectorLookupTrait {
ASTReader &Reader;
public:
@@ -480,7 +477,7 @@ public:
typedef Selector external_key_type;
typedef external_key_type internal_key_type;
- explicit PCHSelectorLookupTrait(ASTReader &Reader) : Reader(Reader) { }
+ explicit ASTSelectorLookupTrait(ASTReader &Reader) : Reader(Reader) { }
static bool EqualKey(const internal_key_type& a,
const internal_key_type& b) {
@@ -581,17 +578,17 @@ public:
} // end anonymous namespace
/// \brief The on-disk hash table used for the global method pool.
-typedef OnDiskChainedHashTable<PCHSelectorLookupTrait>
- PCHSelectorLookupTable;
+typedef OnDiskChainedHashTable<ASTSelectorLookupTrait>
+ ASTSelectorLookupTable;
namespace {
-class PCHIdentifierLookupTrait {
+class ASTIdentifierLookupTrait {
ASTReader &Reader;
llvm::BitstreamCursor &Stream;
// If we know the IdentifierInfo in advance, it is here and we will
// not build a new one. Used when deserializing information about an
- // identifier that was constructed before the PCH file was read.
+ // identifier that was constructed before the AST file was read.
IdentifierInfo *KnownII;
public:
@@ -601,7 +598,7 @@ public:
typedef external_key_type internal_key_type;
- PCHIdentifierLookupTrait(ASTReader &Reader, llvm::BitstreamCursor &Stream,
+ ASTIdentifierLookupTrait(ASTReader &Reader, llvm::BitstreamCursor &Stream,
IdentifierInfo *II = 0)
: Reader(Reader), Stream(Stream), KnownII(II) { }
@@ -650,7 +647,7 @@ public:
if (!II)
II = &Reader.getIdentifierTable().getOwn(k.first, k.first + k.second);
Reader.SetIdentifierInfo(ID, II);
- II->setIsFromPCH();
+ II->setIsFromAST();
return II;
}
@@ -709,7 +706,7 @@ public:
Reader.SetGloballyVisibleDecls(II, DeclIDs);
}
- II->setIsFromPCH();
+ II->setIsFromAST();
return II;
}
};
@@ -718,22 +715,14 @@ public:
/// \brief The on-disk hash table used to contain information about
/// all of the identifiers in the program.
-typedef OnDiskChainedHashTable<PCHIdentifierLookupTrait>
- PCHIdentifierLookupTable;
+typedef OnDiskChainedHashTable<ASTIdentifierLookupTrait>
+ ASTIdentifierLookupTable;
void ASTReader::Error(const char *Msg) {
Diag(diag::err_fe_pch_malformed) << Msg;
}
-/// \brief Check the contents of the concatenation of all predefines buffers in
-/// the PCH chain against the contents of the predefines buffer of the current
-/// compiler invocation.
-///
-/// The contents should be the same. If not, then some command-line option
-/// changed the preprocessor state and we must probably reject the PCH file.
-///
-/// \returns true if there was a mismatch (in which case the PCH file
-/// should be ignored), or false otherwise.
+/// \brief Tell the AST listener about the predefines buffers in the chain.
bool ASTReader::CheckPredefinesBuffers() {
if (Listener)
return Listener->ReadPredefinesBuffer(PCHPredefinesBuffers,
@@ -792,7 +781,7 @@ bool ASTReader::ParseLineTable(llvm::SmallVectorImpl<uint64_t> &Record) {
namespace {
-class PCHStatData {
+class ASTStatData {
public:
const bool hasStat;
const ino_t ino;
@@ -801,19 +790,19 @@ public:
const time_t mtime;
const off_t size;
- PCHStatData(ino_t i, dev_t d, mode_t mo, time_t m, off_t s)
+ ASTStatData(ino_t i, dev_t d, mode_t mo, time_t m, off_t s)
: hasStat(true), ino(i), dev(d), mode(mo), mtime(m), size(s) {}
- PCHStatData()
+ ASTStatData()
: hasStat(false), ino(0), dev(0), mode(0), mtime(0), size(0) {}
};
-class PCHStatLookupTrait {
+class ASTStatLookupTrait {
public:
typedef const char *external_key_type;
typedef const char *internal_key_type;
- typedef PCHStatData data_type;
+ typedef ASTStatData data_type;
static unsigned ComputeHash(const char *path) {
return llvm::HashString(path);
@@ -856,13 +845,13 @@ class PCHStatLookupTrait {
///
/// This cache is very similar to the stat cache used by pretokenized
/// headers.
-class PCHStatCache : public StatSysCallCache {
- typedef OnDiskChainedHashTable<PCHStatLookupTrait> CacheTy;
+class ASTStatCache : public StatSysCallCache {
+ typedef OnDiskChainedHashTable<ASTStatLookupTrait> CacheTy;
CacheTy *Cache;
unsigned &NumStatHits, &NumStatMisses;
public:
- PCHStatCache(const unsigned char *Buckets,
+ ASTStatCache(const unsigned char *Buckets,
const unsigned char *Base,
unsigned &NumStatHits,
unsigned &NumStatMisses)
@@ -870,20 +859,20 @@ public:
Cache = CacheTy::Create(Buckets, Base);
}
- ~PCHStatCache() { delete Cache; }
+ ~ASTStatCache() { delete Cache; }
int stat(const char *path, struct stat *buf) {
- // Do the lookup for the file's data in the PCH file.
+ // Do the lookup for the file's data in the AST file.
CacheTy::iterator I = Cache->find(path);
- // If we don't get a hit in the PCH file just forward to 'stat'.
+ // If we don't get a hit in the AST file just forward to 'stat'.
if (I == Cache->end()) {
++NumStatMisses;
return StatSysCallCache::stat(path, buf);
}
++NumStatHits;
- PCHStatData Data = *I;
+ ASTStatData Data = *I;
if (!Data.hasStat)
return 1;
@@ -913,13 +902,13 @@ ASTReader::ASTReadResult ASTReader::ReadSourceManagerBlock(PerFileData &F) {
// The stream itself is going to skip over the source manager block.
if (F.Stream.SkipBlock()) {
- Error("malformed block record in PCH file");
+ Error("malformed block record in AST file");
return Failure;
}
// Enter the source manager block.
if (SLocEntryCursor.EnterSubBlock(pch::SOURCE_MANAGER_BLOCK_ID)) {
- Error("malformed source manager block record in PCH file");
+ Error("malformed source manager block record in AST file");
return Failure;
}
@@ -928,7 +917,7 @@ ASTReader::ASTReadResult ASTReader::ReadSourceManagerBlock(PerFileData &F) {
unsigned Code = SLocEntryCursor.ReadCode();
if (Code == llvm::bitc::END_BLOCK) {
if (SLocEntryCursor.ReadBlockEnd()) {
- Error("error at end of Source Manager block in PCH file");
+ Error("error at end of Source Manager block in AST file");
return Failure;
}
return Success;
@@ -938,7 +927,7 @@ ASTReader::ASTReadResult ASTReader::ReadSourceManagerBlock(PerFileData &F) {
// No known subblocks, always skip them.
SLocEntryCursor.ReadSubBlockID();
if (SLocEntryCursor.SkipBlock()) {
- Error("malformed block record in PCH file");
+ Error("malformed block record in AST file");
return Failure;
}
continue;
@@ -997,7 +986,7 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(unsigned ID) {
return Success;
if (ID > TotalNumSLocEntries) {
- Error("source location entry ID out-of-range for PCH file");
+ Error("source location entry ID out-of-range for AST file");
return Failure;
}
@@ -1008,7 +997,7 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(unsigned ID) {
if (Code == llvm::bitc::END_BLOCK ||
Code == llvm::bitc::ENTER_SUBBLOCK ||
Code == llvm::bitc::DEFINE_ABBREV) {
- Error("incorrectly-formatted source location entry in PCH file");
+ Error("incorrectly-formatted source location entry in AST file");
return Failure;
}
@@ -1017,7 +1006,7 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(unsigned ID) {
unsigned BlobLen;
switch (SLocEntryCursor.ReadRecord(Code, Record, &BlobStart, &BlobLen)) {
default:
- Error("incorrectly-formatted source location entry in PCH file");
+ Error("incorrectly-formatted source location entry in AST file");
return Failure;
case pch::SM_SLOC_FILE_ENTRY: {
@@ -1027,7 +1016,7 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(unsigned ID) {
if (File == 0) {
std::string ErrorStr = "could not find file '";
ErrorStr += Filename;
- ErrorStr += "' referenced by PCH file";
+ ErrorStr += "' referenced by AST file";
Error(ErrorStr.c_str());
return Failure;
}
@@ -1079,7 +1068,7 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(unsigned ID) {
= SLocEntryCursor.ReadRecord(Code, Record, &BlobStart, &BlobLen);
if (RecCode != pch::SM_SLOC_BUFFER_BLOB) {
- Error("PCH record has invalid code");
+ Error("AST record has invalid code");
return Failure;
}
@@ -1121,7 +1110,7 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(unsigned ID) {
bool ASTReader::ReadBlockAbbrevs(llvm::BitstreamCursor &Cursor,
unsigned BlockID) {
if (Cursor.EnterSubBlock(BlockID)) {
- Error("malformed block record in PCH file");
+ Error("malformed block record in AST file");
return Failure;
}
@@ -1157,7 +1146,7 @@ void ASTReader::ReadMacroRecord(llvm::BitstreamCursor &Stream, uint64_t Offset){
// No known subblocks, always skip them.
Stream.ReadSubBlockID();
if (Stream.SkipBlock()) {
- Error("malformed block record in PCH file");
+ Error("malformed block record in AST file");
return;
}
continue;
@@ -1183,7 +1172,7 @@ void ASTReader::ReadMacroRecord(llvm::BitstreamCursor &Stream, uint64_t Offset){
IdentifierInfo *II = DecodeIdentifierInfo(Record[0]);
if (II == 0) {
- Error("macro must have a name in PCH file");
+ Error("macro must have a name in AST file");
return;
}
SourceLocation Loc = SourceLocation::getFromRawEncoding(Record[1]);
@@ -1191,7 +1180,7 @@ void ASTReader::ReadMacroRecord(llvm::BitstreamCursor &Stream, uint64_t Offset){
MacroInfo *MI = PP->AllocateMacroInfo(Loc);
MI->setIsUsed(isUsed);
- MI->setIsFromPCH();
+ MI->setIsFromAST();
unsigned NextIndex = 3;
if (RecType == pch::PP_MACRO_FUNCTION_LIKE) {
@@ -1254,7 +1243,7 @@ void ASTReader::ReadMacroRecord(llvm::BitstreamCursor &Stream, uint64_t Offset){
return;
if (!PP->getPreprocessingRecord()) {
- Error("missing preprocessing record in PCH file");
+ Error("missing preprocessing record in AST file");
return;
}
@@ -1280,7 +1269,7 @@ void ASTReader::ReadMacroRecord(llvm::BitstreamCursor &Stream, uint64_t Offset){
return;
if (!PP->getPreprocessingRecord()) {
- Error("missing preprocessing record in PCH file");
+ Error("missing preprocessing record in AST file");
return;
}
@@ -1317,7 +1306,7 @@ void ASTReader::ReadDefinedMacros() {
llvm::BitstreamCursor Cursor = MacroCursor;
if (Cursor.EnterSubBlock(pch::PREPROCESSOR_BLOCK_ID)) {
- Error("malformed preprocessor block record in PCH file");
+ Error("malformed preprocessor block record in AST file");
return;
}
@@ -1326,7 +1315,7 @@ void ASTReader::ReadDefinedMacros() {
unsigned Code = Cursor.ReadCode();
if (Code == llvm::bitc::END_BLOCK) {
if (Cursor.ReadBlockEnd()) {
- Error("error at end of preprocessor block in PCH file");
+ Error("error at end of preprocessor block in AST file");
return;
}
break;
@@ -1336,7 +1325,7 @@ void ASTReader::ReadDefinedMacros() {
// No known subblocks, always skip them.
Cursor.ReadSubBlockID();
if (Cursor.SkipBlock()) {
- Error("malformed block record in PCH file");
+ Error("malformed block record in AST file");
return;
}
continue;
@@ -1423,18 +1412,18 @@ ASTReader::ReadASTBlock(PerFileData &F) {
llvm::BitstreamCursor &Stream = F.Stream;
if (Stream.EnterSubBlock(pch::PCH_BLOCK_ID)) {
- Error("malformed block record in PCH file");
+ Error("malformed block record in AST file");
return Failure;
}
- // Read all of the records and blocks for the PCH file.
+ // Read all of the records and blocks for the ASt file.
RecordData Record;
bool First = true;
while (!Stream.AtEndOfStream()) {
unsigned Code = Stream.ReadCode();
if (Code == llvm::bitc::END_BLOCK) {
if (Stream.ReadBlockEnd()) {
- Error("error at end of module block in PCH file");
+ Error("error at end of module block in AST file");
return Failure;
}
@@ -1452,7 +1441,7 @@ ASTReader::ReadASTBlock(PerFileData &F) {
if (Stream.SkipBlock() || // Skip with the main cursor.
// Read the abbrevs.
ReadBlockAbbrevs(F.DeclsCursor, pch::DECLTYPES_BLOCK_ID)) {
- Error("malformed block record in PCH file");
+ Error("malformed block record in AST file");
return Failure;
}
break;
@@ -1463,7 +1452,7 @@ ASTReader::ReadASTBlock(PerFileData &F) {
PP->setExternalSource(this);
if (Stream.SkipBlock()) {
- Error("malformed block record in PCH file");
+ Error("malformed block record in AST file");
return Failure;
}
break;
@@ -1474,7 +1463,7 @@ ASTReader::ReadASTBlock(PerFileData &F) {
break;
case Failure:
- Error("malformed source manager block in PCH file");
+ Error("malformed source manager block in AST file");
return Failure;
case IgnorePCH:
@@ -1539,7 +1528,7 @@ ASTReader::ReadASTBlock(PerFileData &F) {
case pch::TYPE_OFFSET:
if (F.LocalNumTypes != 0) {
- Error("duplicate TYPE_OFFSET record in PCH file");
+ Error("duplicate TYPE_OFFSET record in AST file");
return Failure;
}
F.TypeOffsets = (const uint32_t *)BlobStart;
@@ -1548,7 +1537,7 @@ ASTReader::ReadASTBlock(PerFileData &F) {
case pch::DECL_OFFSET:
if (F.LocalNumDecls != 0) {
- Error("duplicate DECL_OFFSET record in PCH file");
+ Error("duplicate DECL_OFFSET record in AST file");
return Failure;
}
F.DeclOffsets = (const uint32_t *)BlobStart;
@@ -1586,10 +1575,10 @@ ASTReader::ReadASTBlock(PerFileData &F) {
F.IdentifierTableData = BlobStart;
if (Record[0]) {
F.IdentifierLookupTable
- = PCHIdentifierLookupTable::Create(
+ = ASTIdentifierLookupTable::Create(
(const unsigned char *)F.IdentifierTableData + Record[0],
(const unsigned char *)F.IdentifierTableData,
- PCHIdentifierLookupTrait(*this, F.Stream));
+ ASTIdentifierLookupTrait(*this, F.Stream));
if (PP)
PP->getIdentifierTable().setExternalIdentifierLookup(this);
}
@@ -1597,7 +1586,7 @@ ASTReader::ReadASTBlock(PerFileData &F) {
case pch::IDENTIFIER_OFFSET:
if (F.LocalNumIdentifiers != 0) {
- Error("duplicate IDENTIFIER_OFFSET record in PCH file");
+ Error("duplicate IDENTIFIER_OFFSET record in AST file");
return Failure;
}
F.IdentifierOffsets = (const uint32_t *)BlobStart;
@@ -1669,10 +1658,10 @@ ASTReader::ReadASTBlock(PerFileData &F) {
F.SelectorLookupTableData = (const unsigned char *)BlobStart;
if (Record[0])
F.SelectorLookupTable
- = PCHSelectorLookupTable::Create(
+ = ASTSelectorLookupTable::Create(
F.SelectorLookupTableData + Record[0],
F.SelectorLookupTableData,
- PCHSelectorLookupTrait(*this));
+ ASTSelectorLookupTrait(*this));
TotalNumMethodPoolEntries += Record[1];
break;
@@ -1690,8 +1679,9 @@ ASTReader::ReadASTBlock(PerFileData &F) {
case pch::SOURCE_LOCATION_OFFSETS:
F.SLocOffsets = (const uint32_t *)BlobStart;
F.LocalNumSLocEntries = Record[0];
- // We cannot delay this until all PCHs are loaded, because then source
- // location preloads would also have to be delayed.
+ // We cannot delay this until the entire chain is loaded, because then
+ // source location preloads would also have to be delayed.
+ // FIXME: Is there a reason not to do that?
TotalNumSLocEntries += F.LocalNumSLocEntries;
SourceMgr.PreallocateSLocEntries(this, TotalNumSLocEntries, Record[1]);
break;
@@ -1705,8 +1695,8 @@ ASTReader::ReadASTBlock(PerFileData &F) {
break;
case pch::STAT_CACHE: {
- PCHStatCache *MyStatCache =
- new PCHStatCache((const unsigned char *)BlobStart + Record[0],
+ ASTStatCache *MyStatCache =
+ new ASTStatCache((const unsigned char *)BlobStart + Record[0],
(const unsigned char *)BlobStart,
NumStatHits, NumStatMisses);
FileMgr.addStatCache(MyStatCache);
@@ -1752,7 +1742,7 @@ ASTReader::ReadASTBlock(PerFileData &F) {
break;
case pch::ORIGINAL_FILE_NAME:
- // The primary PCH will be the last to get here, so it will be the one
+ // The primary AST will be the last to get here, so it will be the one
// that's used.
ActualOriginalFileName.assign(BlobStart, BlobLen);
OriginalFileName = ActualOriginalFileName;
@@ -1761,9 +1751,9 @@ ASTReader::ReadASTBlock(PerFileData &F) {
case pch::VERSION_CONTROL_BRANCH_REVISION: {
const std::string &CurBranch = getClangFullRepositoryVersion();<