More PCH -> AST renaming.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111472 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/AST/ASTConsumer.h b/include/clang/AST/ASTConsumer.h
index 19cfae5..84833c0 100644
--- a/include/clang/AST/ASTConsumer.h
+++ b/include/clang/AST/ASTConsumer.h
@@ -50,7 +50,7 @@
virtual void HandleTopLevelDecl(DeclGroupRef D);
/// HandleInterestingDecl - Handle the specified interesting declaration. This
- /// is called by the PCH reader when deserializing things that might interest
+ /// is called by the AST reader when deserializing things that might interest
/// the consumer. The default implementation forwards to HandleTopLevelDecl.
virtual void HandleInterestingDecl(DeclGroupRef D);
diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h
index 83270ab..34092c7 100644
--- a/include/clang/AST/DeclBase.h
+++ b/include/clang/AST/DeclBase.h
@@ -226,8 +226,8 @@
/// PCHLevel - the "level" of AST file from which this declaration was built.
unsigned PCHLevel : 2;
- /// PCHChanged - if this declaration has changed since being deserialized
- bool PCHChanged : 1;
+ /// ChangedAfterLoad - if this declaration has changed since being loaded
+ bool ChangedAfterLoad : 1;
/// IdentifierNamespace - This specifies what IDNS_* namespace this lives in.
unsigned IdentifierNamespace : 15;
@@ -245,7 +245,7 @@
: NextDeclInContext(0), DeclCtx(DC),
Loc(L), DeclKind(DK), InvalidDecl(0),
HasAttrs(false), Implicit(false), Used(false),
- Access(AS_none), PCHLevel(0), PCHChanged(false),
+ Access(AS_none), PCHLevel(0), ChangedAfterLoad(false),
IdentifierNamespace(getIdentifierNamespaceForKind(DK)) {
if (Decl::CollectingStats()) add(DK);
}
@@ -253,7 +253,7 @@
Decl(Kind DK, EmptyShell Empty)
: NextDeclInContext(0), DeclKind(DK), InvalidDecl(0),
HasAttrs(false), Implicit(false), Used(false),
- Access(AS_none), PCHLevel(0), PCHChanged(false),
+ Access(AS_none), PCHLevel(0), ChangedAfterLoad(false),
IdentifierNamespace(getIdentifierNamespaceForKind(DK)) {
if (Decl::CollectingStats()) add(DK);
}
@@ -380,11 +380,10 @@
/// declaration was generated.
///
/// The PCH level of a declaration describes where the declaration originated
- /// from. A PCH level of 0 indicates that the declaration was not from a
- /// precompiled header. A PCH level of 1 indicates that the declaration was
- /// from a top-level precompiled header; 2 indicates that the declaration
- /// comes from a precompiled header on which the top-level precompiled header
- /// depends, and so on.
+ /// from. A PCH level of 0 indicates that the declaration was parsed from
+ /// source. A PCH level of 1 indicates that the declaration was loaded from
+ /// a top-level AST file. A PCH level 2 indicates that the declaration was
+ /// loaded from a PCH file the AST file depends on, and so on.
unsigned getPCHLevel() const { return PCHLevel; }
/// \brief The maximum PCH level that any declaration may have.
@@ -401,11 +400,13 @@
///
/// In an epic violation of layering, what is "significant" is entirely
/// up to the serialization system, but implemented in AST and Sema.
- bool isChangedSinceDeserialization() const { return PCHChanged; }
+ bool isChangedSinceDeserialization() const { return ChangedAfterLoad; }
/// \brief Mark this declaration as having changed since deserialization, or
/// reset the flag.
- void setChangedSinceDeserialization(bool Changed) { PCHChanged = Changed; }
+ void setChangedSinceDeserialization(bool Changed) {
+ ChangedAfterLoad = Changed;
+ }
unsigned getIdentifierNamespace() const {
return IdentifierNamespace;
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index 1cc0e39..a2f08b7 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -787,12 +787,12 @@
/// \brief Linkage of this type.
mutable unsigned CachedLinkage : 2;
- /// \brief FromPCH - Whether this type comes from a PCH file.
- mutable bool FromPCH : 1;
+ /// \brief FromAST - Whether this type comes from an AST file.
+ mutable bool FromAST : 1;
- /// \brief Set whether this type comes from a PCH file.
- void setFromPCH(bool V = true) const {
- FromPCH = V;
+ /// \brief Set whether this type comes from an AST file.
+ void setFromAST(bool V = true) const {
+ FromAST = V;
}
protected:
@@ -806,15 +806,15 @@
Type(TypeClass tc, QualType Canonical, bool dependent)
: CanonicalType(Canonical.isNull() ? QualType(this_(), 0) : Canonical),
TC(tc), Dependent(dependent), LinkageKnown(false),
- CachedLinkage(NoLinkage), FromPCH(false) {}
+ CachedLinkage(NoLinkage), FromAST(false) {}
virtual ~Type();
friend class ASTContext;
public:
TypeClass getTypeClass() const { return static_cast<TypeClass>(TC); }
- /// \brief Whether this type comes from a PCH file.
- bool isFromPCH() const { return FromPCH; }
+ /// \brief Whether this type comes from an AST file.
+ bool isFromAST() const { return FromAST; }
bool isCanonicalUnqualified() const {
return CanonicalType.getTypePtr() == this;
@@ -1856,13 +1856,13 @@
// * FunctionNoProtoType::Profile
// * FunctionProtoType::Profile
// * TypePrinter::PrintFunctionProto
- // * PCH read and write
+ // * AST read and write
// * Codegen
class ExtInfo {
public:
// Constructor with no defaults. Use this when you know that you
- // have all the elements (when reading a PCH file for example).
+ // have all the elements (when reading an AST file for example).
ExtInfo(bool noReturn, unsigned regParm, CallingConv cc) :
NoReturn(noReturn), RegParm(regParm), CC(cc) {}
diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h
index fa1b149..24fe086 100644
--- a/include/clang/Basic/IdentifierTable.h
+++ b/include/clang/Basic/IdentifierTable.h
@@ -59,8 +59,8 @@
bool IsPoisoned : 1; // True if identifier is poisoned.
bool IsCPPOperatorKeyword : 1; // True if ident is a C++ operator keyword.
bool NeedsHandleIdentifier : 1; // See "RecomputeNeedsHandleIdentifier".
- bool IsFromPCH : 1; // True if identfier first appeared in a PCH
- // and wasn't modified since.
+ bool IsFromAST : 1; // True if identfier first appeared in an AST
+ // file and wasn't modified since.
bool RevertedTokenID : 1; // True if RevertTokenIDToIdentifier was
// called.
// 7 bits left in 32-bit word.
@@ -129,7 +129,7 @@
NeedsHandleIdentifier = 1;
else
RecomputeNeedsHandleIdentifier();
- IsFromPCH = false;
+ IsFromAST = false;
}
/// getTokenID - If this is a source-language token (e.g. 'for'), this API
@@ -145,7 +145,7 @@
///
/// TokenID is normally read-only but there are 2 instances where we revert it
/// to tok::identifier for libstdc++ 4.2. Keep track of when this happens
- /// using this method so we can inform PCH about it.
+ /// using this method so we can inform serialization about it.
void RevertTokenIDToIdentifier() {
assert(TokenID != tok::identifier && "Already at tok::identifier");
TokenID = tok::identifier;
@@ -205,7 +205,7 @@
NeedsHandleIdentifier = 1;
else
RecomputeNeedsHandleIdentifier();
- IsFromPCH = false;
+ IsFromAST = false;
}
/// isPoisoned - Return true if this token has been poisoned.
@@ -233,11 +233,11 @@
/// know that HandleIdentifier will not affect the token.
bool isHandleIdentifierCase() const { return NeedsHandleIdentifier; }
- /// isFromPCH - Return true if the identifier in its current state was loaded
- /// from a PCH file.
- bool isFromPCH() const { return IsFromPCH; }
+ /// isFromAST - Return true if the identifier in its current state was loaded
+ /// from an AST file.
+ bool isFromAST() const { return IsFromAST; }
- void setIsFromPCH(bool FromPCH = true) { IsFromPCH = FromPCH; }
+ void setIsFromAST(bool FromAST = true) { IsFromAST = FromAST; }
private:
/// RecomputeNeedsHandleIdentifier - The Preprocessor::HandleIdentifier does
diff --git a/include/clang/Basic/Linkage.h b/include/clang/Basic/Linkage.h
index 035b4fc..01b6c79 100644
--- a/include/clang/Basic/Linkage.h
+++ b/include/clang/Basic/Linkage.h
@@ -42,7 +42,7 @@
};
/// \brief A more specific kind of linkage. This is relevant to CodeGen and
-/// PCH reading.
+/// AST file reading.
enum GVALinkage {
GVA_Internal,
GVA_C99Inline,
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h
index dc314f1..91ade22 100644
--- a/include/clang/Basic/SourceManager.h
+++ b/include/clang/Basic/SourceManager.h
@@ -795,7 +795,7 @@
unsigned sloc_entry_size() const { return SLocEntryTable.size(); }
// FIXME: Exposing this is a little gross; what we want is a good way
- // to iterate the entries that were not defined in a PCH file (or
+ // to iterate the entries that were not defined in an AST file (or
// any other external source).
unsigned sloc_loaded_entry_size() const { return SLocEntryLoaded.size(); }
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h
index 6e67aaf..60e06bb 100644
--- a/include/clang/Frontend/ASTUnit.h
+++ b/include/clang/Frontend/ASTUnit.h
@@ -53,7 +53,7 @@
using namespace idx;
-/// \brief Utility class for loading a ASTContext from a PCH file.
+/// \brief Utility class for loading a ASTContext from an AST file.
///
class ASTUnit {
public:
@@ -196,7 +196,7 @@
/// \brief The group of timers associated with this translation unit.
llvm::OwningPtr<llvm::TimerGroup> TimerGroup;
- /// \brief A list of the PCH ID numbers for each of the top-level
+ /// \brief A list of the serialization ID numbers for each of the top-level
/// declarations parsed within the precompiled preamble.
std::vector<pch::DeclID> TopLevelDeclsInPreamble;
@@ -358,7 +358,7 @@
FileManager &getFileManager() { return *FileMgr; }
const std::string &getOriginalSourceFileName();
- const std::string &getPCHFileName();
+ const std::string &getASTFileName();
/// \brief Add a temporary file that the ASTUnit depends on.
///
@@ -458,15 +458,15 @@
/// remapped contents of that file.
typedef std::pair<std::string, const llvm::MemoryBuffer *> RemappedFile;
- /// \brief Create a ASTUnit from a PCH file.
+ /// \brief Create a ASTUnit from an AST file.
///
- /// \param Filename - The PCH file to load.
+ /// \param Filename - The AST file to load.
///
/// \param Diags - The diagnostics engine to use for reporting errors; its
/// lifetime is expected to extend past that of the returned ASTUnit.
///
- /// \returns - The initialized ASTUnit or null if the PCH failed to load.
- static ASTUnit *LoadFromPCHFile(const std::string &Filename,
+ /// \returns - The initialized ASTUnit or null if the AST failed to load.
+ static ASTUnit *LoadFromASTFile(const std::string &Filename,
llvm::IntrusiveRefCntPtr<Diagnostic> Diags,
bool OnlyLocalDecls = false,
RemappedFile *RemappedFiles = 0,
diff --git a/include/clang/Frontend/FrontendAction.h b/include/clang/Frontend/FrontendAction.h
index 637458d..773543a 100644
--- a/include/clang/Frontend/FrontendAction.h
+++ b/include/clang/Frontend/FrontendAction.h
@@ -145,8 +145,8 @@
/// @{
/// usesPreprocessorOnly - Does this action only use the preprocessor? If so
- /// no AST context will be created and this action will be invalid with PCH
- /// inputs.
+ /// no AST context will be created and this action will be invalid with AST
+ /// file inputs.
virtual bool usesPreprocessorOnly() const = 0;
/// usesCompleteTranslationUnit - For AST based actions, should the
diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h
index d526a94..4c16d08 100644
--- a/include/clang/Frontend/FrontendOptions.h
+++ b/include/clang/Frontend/FrontendOptions.h
@@ -60,10 +60,10 @@
/// completion results.
unsigned DisableFree : 1; ///< Disable memory freeing on exit.
unsigned RelocatablePCH : 1; ///< When generating PCH files,
- /// instruct the PCH writer to create
+ /// instruct the AST writer to create
/// relocatable PCH files.
unsigned ChainedPCH : 1; ///< When generating PCH files,
- /// instruct the PCH writer to create
+ /// instruct the AST writer to create
/// chained PCH files.
unsigned ShowHelp : 1; ///< Show the -help text.
unsigned ShowMacrosInCodeCompletion : 1; ///< Show macros in code completion
diff --git a/include/clang/Lex/MacroInfo.h b/include/clang/Lex/MacroInfo.h
index 009ec20..90f95b7 100644
--- a/include/clang/Lex/MacroInfo.h
+++ b/include/clang/Lex/MacroInfo.h
@@ -62,8 +62,8 @@
/// it has not yet been redefined or undefined.
bool IsBuiltinMacro : 1;
- /// IsFromPCH - True if this macro was loaded from a PCH file.
- bool IsFromPCH : 1;
+ /// IsFromAST - True if this macro was loaded from an AST file.
+ bool IsFromAST : 1;
private:
//===--------------------------------------------------------------------===//
@@ -185,11 +185,11 @@
/// __LINE__, which requires processing before expansion.
bool isBuiltinMacro() const { return IsBuiltinMacro; }
- /// isFromPCH - Return true if this macro was loaded from a PCH file.
- bool isFromPCH() const { return IsFromPCH; }
+ /// isFromAST - Return true if this macro was loaded from an AST file.
+ bool isFromAST() const { return IsFromAST; }
- /// setIsFromPCH - Set whether this macro was loaded from a PCH file.
- void setIsFromPCH(bool FromPCH = true) { IsFromPCH = FromPCH; }
+ /// setIsFromAST - Set whether this macro was loaded from an AST file.
+ void setIsFromAST(bool FromAST = true) { IsFromAST = FromAST; }
/// isUsed - Return false if this macro is defined in the main file and has
/// not yet been used.
diff --git a/include/clang/Sema/IdentifierResolver.h b/include/clang/Sema/IdentifierResolver.h
index 59bd834..e494792 100644
--- a/include/clang/Sema/IdentifierResolver.h
+++ b/include/clang/Sema/IdentifierResolver.h
@@ -169,7 +169,7 @@
/// \brief Link the declaration into the chain of declarations for
/// the given identifier.
///
- /// This is a lower-level routine used by the PCH reader to link a
+ /// This is a lower-level routine used by the AST reader to link a
/// declaration into a specific IdentifierInfo before the
/// declaration actually has a name.
void AddDeclToIdentifierChain(IdentifierInfo *II, NamedDecl *D);
diff --git a/include/clang/Serialization/PCHDeserializationListener.h b/include/clang/Serialization/PCHDeserializationListener.h
index ec02bf4..024fc5a 100644
--- a/include/clang/Serialization/PCHDeserializationListener.h
+++ b/include/clang/Serialization/PCHDeserializationListener.h
@@ -31,14 +31,15 @@
/// \brief Tell the listener about the reader.
virtual void SetReader(ASTReader *Reader) = 0;
- /// \brief An identifier was deserialized from the PCH.
+ /// \brief An identifier was deserialized from the AST file.
virtual void IdentifierRead(pch::IdentID ID, IdentifierInfo *II) = 0;
- /// \brief A type was deserialized from the PCH. The ID here has the qualifier
- /// bits already removed, and T is guaranteed to be locally unqualified
+ /// \brief A type was deserialized from the AST file. The ID here has the
+ /// qualifier bits already removed, and T is guaranteed to be locally
+ /// unqualified.
virtual void TypeRead(pch::TypeID ID, QualType T) = 0;
- /// \brief A decl was deserialized from the PCH.
+ /// \brief A decl was deserialized from the AST file.
virtual void DeclRead(pch::DeclID ID, const Decl *D) = 0;
- /// \brief A selector was read from the PCH.
+ /// \brief A selector was read from the AST file.
virtual void SelectorRead(pch::SelectorID iD, Selector Sel) = 0;
};
diff --git a/include/clang/Serialization/PCHReader.h b/include/clang/Serialization/PCHReader.h
index 5ce45b7..5d24b29 100644
--- a/include/clang/Serialization/PCHReader.h
+++ b/include/clang/Serialization/PCHReader.h
@@ -104,8 +104,8 @@
///
/// \param Buffers Information about the predefines buffers.
///
- /// \param OriginalFileName The original file name for the PCH, which will
- /// appear as an entry in the predefines buffer.
+ /// \param OriginalFileName The original file name for the AST file, which
+ /// will appear as an entry in the predefines buffer.
///
/// \param SuggestedPredefines If necessary, additional definitions are added
/// here.
@@ -183,13 +183,13 @@
Diagnostic &Diags;
/// \brief The semantic analysis object that will be processing the
- /// PCH files and the translation unit that uses it.
+ /// AST files and the translation unit that uses it.
Sema *SemaObj;
/// \brief The preprocessor that will be loading the source file.
Preprocessor *PP;
- /// \brief The AST context into which we'll read the PCH files.
+ /// \brief The AST context into which we'll read the AST files.
ASTContext *Context;
/// \brief The AST consumer.
@@ -199,12 +199,12 @@
struct PerFileData {
PerFileData();
- /// \brief The PCH stat cache installed for this file, if any.
+ /// \brief The AST stat cache installed for this file, if any.
///
- /// The dynamic type of this stat cache is always PCHStatCache
+ /// The dynamic type of this stat cache is always ASTStatCache
void *StatCache;
- /// \brief The bitstream reader from which we'll read the PCH file.
+ /// \brief The bitstream reader from which we'll read the AST file.
llvm::BitstreamReader StreamFile;
llvm::BitstreamCursor Stream;
@@ -220,38 +220,38 @@
/// jump around with these in context.
llvm::BitstreamCursor DeclsCursor;
- /// \brief The file name of the PCH file.
+ /// \brief The file name of the AST file.
std::string FileName;
/// \brief The memory buffer that stores the data associated with
- /// this PCH file.
+ /// this AST file.
llvm::OwningPtr<llvm::MemoryBuffer> Buffer;
/// \brief Cursor used to read source location entries.
llvm::BitstreamCursor SLocEntryCursor;
- /// \brief The number of source location entries in this PCH file.
+ /// \brief The number of source location entries in this AST file.
unsigned LocalNumSLocEntries;
/// \brief Offsets for all of the source location entries in the
- /// PCH file.
+ /// AST file.
const uint32_t *SLocOffsets;
- /// \brief The number of types in this PCH file.
+ /// \brief The number of types in this AST file.
unsigned LocalNumTypes;
/// \brief Offset of each type within the bitstream, indexed by the
/// type ID, or the representation of a Type*.
const uint32_t *TypeOffsets;
- /// \brief The number of declarations in this PCH file.
+ /// \brief The number of declarations in this AST file.
unsigned LocalNumDecls;
/// \brief Offset of each declaration within the bitstream, indexed
/// by the declaration ID (-1).
const uint32_t *DeclOffsets;
- /// \brief The number of identifiers in this PCH file.
+ /// \brief The number of identifiers in this AST file.
unsigned LocalNumIdentifiers;
/// \brief Offsets into the identifier table data.
@@ -275,7 +275,7 @@
unsigned LocalNumMacroDefinitions;
/// \brief Offsets of all of the macro definitions in the preprocessing
- /// record in the PCH file.
+ /// record in the AST file.
const uint32_t *MacroDefinitionOffsets;
/// \brief The number of preallocated preprocessing entities in the
@@ -283,7 +283,7 @@
unsigned NumPreallocatedPreprocessingEntities;
/// \brief A pointer to an on-disk hash table of opaque type
- /// PCHSelectorLookupTable.
+ /// ASTSelectorLookupTable.
///
/// This hash table provides the IDs of all selectors, and the associated
/// instance and factory methods.
@@ -304,18 +304,18 @@
unsigned LocalNumSelectors;
};
- /// \brief The chain of PCH files. The first entry is the one named by the
+ /// \brief The chain of AST files. The first entry is the one named by the
/// user, the last one is the one that doesn't depend on anything further.
/// That is, the entry I was created with -include-pch I+1.
llvm::SmallVector<PerFileData*, 2> Chain;
- /// \brief Types that have already been loaded from the PCH file.
+ /// \brief Types that have already been loaded from the chain.
///
/// When the pointer at index I is non-NULL, the type with
- /// ID = (I + 1) << FastQual::Width has already been loaded from the PCH chain
+ /// ID = (I + 1) << FastQual::Width has already been loaded
std::vector<QualType> TypesLoaded;
- /// \brief Declarations that have already been loaded from the PCH file.
+ /// \brief Declarations that have already been loaded from the chain.
///
/// When the pointer at index I is non-NULL, the declaration with ID
/// = I + 1 has already been loaded.
@@ -343,7 +343,7 @@
typedef llvm::DenseMap<pch::DeclID, pch::DeclID> FirstLatestDeclIDMap;
/// \brief Map of first declarations from a chained PCH that point to the
- /// most recent declarations in another PCH.
+ /// most recent declarations in another AST file.
FirstLatestDeclIDMap FirstLatestDeclIDs;
/// \brief Read the records that describe the contents of declcontexts.
@@ -373,49 +373,45 @@
/// \brief The macro definitions we have already loaded.
llvm::SmallVector<MacroDefinition *, 16> MacroDefinitionsLoaded;
- /// \brief The set of external definitions stored in the the PCH
- /// file.
+ /// \brief The set of external definitions stored in the the chain.
llvm::SmallVector<uint64_t, 16> ExternalDefinitions;
- /// \brief The set of tentative definitions stored in the the PCH
- /// file.
+ /// \brief The set of tentative definitions stored in the the chain.
llvm::SmallVector<uint64_t, 16> TentativeDefinitions;
- /// \brief The set of unused file scoped decls stored in the the PCH file.
+ /// \brief The set of unused file scoped decls stored in the the chain.
llvm::SmallVector<uint64_t, 16> UnusedFileScopedDecls;
- /// \brief The set of weak undeclared identifiers stored in the the PCH file.
+ /// \brief The set of weak undeclared identifiers stored in the chain.
llvm::SmallVector<uint64_t, 64> WeakUndeclaredIdentifiers;
- /// \brief The set of locally-scoped external declarations stored in
- /// the the PCH file.
+ /// \brief The set of locally-scoped external declarations stored in the chain
llvm::SmallVector<uint64_t, 16> LocallyScopedExternalDecls;
- /// \brief The set of ext_vector type declarations stored in the the
- /// PCH file.
+ /// \brief The set of ext_vector type declarations stored in the the chain.
llvm::SmallVector<uint64_t, 4> ExtVectorDecls;
- /// \brief The set of VTable uses of CXXRecordDecls stored in the PCH file.
+ /// \brief The set of VTable uses of CXXRecordDecls stored in the chain.
llvm::SmallVector<uint64_t, 64> VTableUses;
- /// \brief The set of dynamic CXXRecord declarations stored in the PCH file.
+ /// \brief The set of dynamic CXXRecord declarations stored in the chain.
llvm::SmallVector<uint64_t, 16> DynamicClasses;
- /// \brief The set of pending implicit instantiations stored in the PCH file.
+ /// \brief The set of pending implicit instantiations stored in the chain.
llvm::SmallVector<uint64_t, 64> PendingImplicitInstantiations;
- /// \brief The set of Sema declaration references, stored in PCH.
+ /// \brief The set of Sema declaration references stored in the chain.
llvm::SmallVector<uint64_t, 4> SemaDeclRefs;
- /// \brief The set of Objective-C category definitions stored in the
- /// the PCH file.
+ /// \brief The set of Objective-C category definitions stored in the the chain
llvm::SmallVector<uint64_t, 4> ObjCCategoryImpls;
- /// \brief The original file name that was used to build the PCH file, which
- /// may have been modified for relocatable-pch support.
+ /// \brief The original file name that was used to build the primary AST file,
+ /// which may have been modified for relocatable-pch support.
std::string OriginalFileName;
- /// \brief The actual original file name that was used to build the PCH file.
+ /// \brief The actual original file name that was used to build the primary
+ /// AST file.
std::string ActualOriginalFileName;
/// \brief Whether this precompiled header is a relocatable PCH file.
@@ -429,12 +425,10 @@
/// headers when they are loaded.
bool DisableValidation;
- /// \brief Mapping from switch-case IDs in the PCH file to
- /// switch-case statements.
+ /// \brief Mapping from switch-case IDs in the chain to switch-case statements
std::map<unsigned, SwitchCase *> SwitchCaseStmts;
- /// \brief Mapping from label statement IDs in the PCH file to label
- /// statements.
+ /// \brief Mapping from label statement IDs in the chain to label statements.
std::map<unsigned, LabelStmt *> LabelStmts;
/// \brief Mapping from label IDs to the set of "goto" statements
@@ -455,21 +449,21 @@
/// the PCH file.
unsigned NumSLocEntriesRead;
- /// \brief The number of source location entries in all PCH files.
+ /// \brief The number of source location entries in the chain.
unsigned TotalNumSLocEntries;
/// \brief The number of statements (and expressions) de-serialized
- /// from the PCH file.
+ /// from the chain.
unsigned NumStatementsRead;
/// \brief The total number of statements (and expressions) stored
- /// in the PCH file.
+ /// in the chain.
unsigned TotalNumStatements;
- /// \brief The number of macros de-serialized from the PCH file.
+ /// \brief The number of macros de-serialized from the chain.
unsigned NumMacrosRead;
- /// \brief The total number of macros stored in the PCH file.
+ /// \brief The total number of macros stored in the chain.
unsigned TotalNumMacros;
/// \brief The number of selectors that have been read.
@@ -501,7 +495,7 @@
llvm::SmallVector<uint32_t, 4> DeclIDs;
};
- /// \brief The set of identifiers that were read while the PCH reader was
+ /// \brief The set of identifiers that were read while the AST reader was
/// (recursively) loading declarations.
///
/// The declarations on the identifier chain for these identifiers will be
@@ -547,7 +541,7 @@
~ReadingKindTracker() { Reader.ReadingKind = PrevKind; }
};
- /// \brief All predefines buffers in all PCH files, to be treated as if
+ /// \brief All predefines buffers in the chain, to be treated as if
/// concatenated.
PCHPredefinesBlocks PCHPredefinesBuffers;
@@ -588,7 +582,7 @@
/// \brief Produce an error diagnostic and return true.
///
/// This routine should only be used for fatal errors that have to
- /// do with non-routine failures (e.g., corrupted PCH file).
+ /// do with non-routine failures (e.g., corrupted AST file).
void Error(const char *Msg);
ASTReader(const ASTReader&); // do not implement
@@ -596,7 +590,7 @@
public:
typedef llvm::SmallVector<uint64_t, 64> RecordData;
- /// \brief Load the PCH file and validate its contents against the given
+ /// \brief Load the AST file and validate its contents against the given
/// Preprocessor.
///
/// \param PP the preprocessor associated with the context in which this
@@ -609,31 +603,29 @@
/// user. This is only used with relocatable PCH files. If non-NULL,
/// a relocatable PCH file will use the default path "/".
///
- /// \param DisableValidation If true, the PCH reader will suppress most
+ /// \param DisableValidation If true, the AST reader will suppress most
/// of its regular consistency checking, allowing the use of precompiled
/// headers that cannot be determined to be compatible.
ASTReader(Preprocessor &PP, ASTContext *Context, const char *isysroot = 0,
bool DisableValidation = false);
- /// \brief Load the PCH file without using any pre-initialized Preprocessor.
+ /// \brief Load the AST file without using any pre-initialized Preprocessor.
///
/// The necessary information to initialize a Preprocessor later can be
/// obtained by setting a ASTReaderListener.
///
- /// \param SourceMgr the source manager into which the precompiled header
- /// will be loaded.
+ /// \param SourceMgr the source manager into which the AST file will be loaded
///
- /// \param FileMgr the file manager into which the precompiled header will
- /// be loaded.
+ /// \param FileMgr the file manager into which the AST file will be loaded.
///
/// \param Diags the diagnostics system to use for reporting errors and
- /// warnings relevant to loading the precompiled header.
+ /// warnings relevant to loading the AST file.
///
/// \param isysroot If non-NULL, the system include path specified by the
/// user. This is only used with relocatable PCH files. If non-NULL,
/// a relocatable PCH file will use the default path "/".
///
- /// \param DisableValidation If true, the PCH reader will suppress most
+ /// \param DisableValidation If true, the AST reader will suppress most
/// of its regular consistency checking, allowing the use of precompiled
/// headers that cannot be determined to be compatible.
ASTReader(SourceManager &SourceMgr, FileManager &FileMgr,
@@ -645,12 +637,12 @@
/// name.
ASTReadResult ReadAST(const std::string &FileName);
- /// \brief Set the PCH callbacks listener.
+ /// \brief Set the AST callbacks listener.
void setListener(ASTReaderListener *listener) {
Listener.reset(listener);
}
- /// \brief Set the PCH deserialization listener.
+ /// \brief Set the AST deserialization listener.
void setDeserializationListener(ASTDeserializationListener *Listener);
/// \brief Set the Preprocessor to use.
@@ -659,16 +651,15 @@
/// \brief Sets and initializes the given Context.
void InitializeContext(ASTContext &Context);
- /// \brief Retrieve the name of the named (primary) PCH file
+ /// \brief Retrieve the name of the named (primary) AST file
const std::string &getFileName() const { return Chain[0]->FileName; }
/// \brief Retrieve the name of the original source file name
const std::string &getOriginalSourceFile() { return OriginalFileName; }
- /// \brief Retrieve the name of the original source file name
- /// directly from the PCH file, without actually loading the PCH
- /// file.
- static std::string getOriginalSourceFile(const std::string &PCHFileName,
+ /// \brief Retrieve the name of the original source file name directly from
+ /// the AST file, without actually loading the AST file.
+ static std::string getOriginalSourceFile(const std::string &ASTFileName,
Diagnostic &Diags);
/// \brief Returns the suggested contents of the predefines buffer,
@@ -783,7 +774,7 @@
/// the ASTConsumer.
virtual void StartTranslationUnit(ASTConsumer *Consumer);
- /// \brief Print some statistics about PCH usage.
+ /// \brief Print some statistics about AST usage.
virtual void PrintStats();
/// \brief Initialize the semantic source with the Sema instance
@@ -938,8 +929,7 @@
/// \brief Retrieve the macro definition with the given ID.
MacroDefinition *getMacroDefinition(pch::IdentID ID);
- /// \brief Retrieve the AST context that this PCH reader
- /// supplements.
+ /// \brief Retrieve the AST context that this AST reader supplements.
ASTContext *getContext() { return Context; }
// \brief Contains declarations that were loaded before we have
diff --git a/lib/Basic/IdentifierTable.cpp b/lib/Basic/IdentifierTable.cpp
index c7b16c9..e0d8571 100644
--- a/lib/Basic/IdentifierTable.cpp
+++ b/lib/Basic/IdentifierTable.cpp
@@ -34,7 +34,7 @@
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 0a6ce4c..a01b002 100644
--- a/lib/Basic/SourceManager.cpp
+++ b/lib/Basic/SourceManager.cpp
@@ -1247,7 +1247,7 @@
}
// 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 e0524d9..5125f36 100644
--- a/lib/Checker/GRCoreEngine.cpp
+++ b/lib/Checker/GRCoreEngine.cpp
@@ -696,7 +696,7 @@
// 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 cbaa6a3..b46212f 100644
--- a/lib/Frontend/ASTMerge.cpp
+++ b/lib/Frontend/ASTMerge.cpp
@@ -40,13 +40,13 @@
&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 e0aa1b4..1749836 100644
--- a/lib/Frontend/ASTUnit.cpp
+++ b/lib/Frontend/ASTUnit.cpp
@@ -304,7 +304,7 @@
/// \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 @@
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 @@
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 @@
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 @@
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 @@
// 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 906fd9a..531213b 100644
--- a/lib/Frontend/FrontendAction.cpp
+++ b/lib/Frontend/FrontendAction.cpp
@@ -51,7 +51,7 @@
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 6eac036..c6d0934 100644
--- a/lib/Lex/MacroInfo.cpp
+++ b/lib/Lex/MacroInfo.cpp
@@ -20,7 +20,7 @@
IsC99Varargs = false;
IsGNUVarargs = false;
IsBuiltinMacro = false;
- IsFromPCH = false;
+ IsFromAST = false;
IsDisabled = false;
IsUsed = true;
IsAllowRedefinitionsWithoutWarning = false;
@@ -37,7 +37,7 @@
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 2e33c1e..d38f403 100644
--- a/lib/Sema/IdentifierResolver.cpp
+++ b/lib/Sema/IdentifierResolver.cpp
@@ -140,7 +140,7 @@
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 @@
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 @@
DeclarationName Name = Old->getDeclName();
if (IdentifierInfo *II = Name.getAsIdentifierInfo())
- II->setIsFromPCH(false);
+ II->setIsFromAST(false);
void *Ptr = Name.getFETokenInfo<void>();
@@ -227,7 +227,7 @@
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 4810dab..635236e 100644
--- a/lib/Sema/SemaCodeComplete.cpp
+++ b/lib/Sema/SemaCodeComplete.cpp
@@ -3581,7 +3581,7 @@
// 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 @@
// 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 @@
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 0fd3d6e..0abc4a9 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -90,7 +90,7 @@
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 @@
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 6f0c8ce..6f456e5 100644
--- a/lib/Serialization/ASTWriter.cpp
+++ b/lib/Serialization/ASTWriter.cpp
@@ -1271,7 +1271,7 @@
// 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 @@
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 @@
// 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 f8dabaa..5329b6c 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 72f4974..5cf677a 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 @@
// 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 @@
namespace {
-class PCHSelectorLookupTrait {
+class ASTSelectorLookupTrait {
ASTReader &Reader;
public:
@@ -480,7 +477,7 @@
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 @@
} // 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 @@
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 @@
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 @@
Reader.SetGloballyVisibleDecls(II, DeclIDs);
}
- II->setIsFromPCH();
+ II->setIsFromAST();
return II;
}
};
@@ -718,22 +715,14 @@
/// \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 @@
namespace {
-class PCHStatData {
+class ASTStatData {
public:
const bool hasStat;
const ino_t ino;
@@ -801,19 +790,19 @@
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 @@
///
/// 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 @@
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 @@
// 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 @@
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 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
= 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 @@
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 @@
// 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 @@
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 @@
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 @@
return;
if (!PP->getPreprocessingRecord()) {
- Error("missing preprocessing record in PCH file");
+ Error("missing preprocessing record in AST file");
return;
}
@@ -1280,7 +1269,7 @@
return;
if (!PP->getPreprocessingRecord()) {
- Error("missing preprocessing record in PCH file");
+ Error("missing preprocessing record in AST file");
return;
}
@@ -1317,7 +1306,7 @@
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 @@
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 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
case pch::VERSION_CONTROL_BRANCH_REVISION: {
const std::string &CurBranch = getClangFullRepositoryVersion();
- llvm::StringRef PCHBranch(BlobStart, BlobLen);
- if (llvm::StringRef(CurBranch) != PCHBranch && !DisableValidation) {
- Diag(diag::warn_pch_different_branch) << PCHBranch << CurBranch;
+ llvm::StringRef ASTBranch(BlobStart, BlobLen);
+ if (llvm::StringRef(CurBranch) != ASTBranch && !DisableValidation) {
+ Diag(diag::warn_pch_different_branch) << ASTBranch << CurBranch;
return IgnorePCH;
}
break;
@@ -1777,7 +1767,7 @@
case pch::DECL_REPLACEMENTS: {
if (Record.size() % 2 != 0) {
- Error("invalid DECL_REPLACEMENTS block in PCH file");
+ Error("invalid DECL_REPLACEMENTS block in AST file");
return Failure;
}
for (unsigned I = 0, N = Record.size(); I != N; I += 2)
@@ -1788,7 +1778,7 @@
}
First = false;
}
- Error("premature end of bitstream in PCH file");
+ Error("premature end of bitstream in AST file");
return Failure;
}
@@ -1836,7 +1826,7 @@
if (PP) {
// Initialization of keywords and pragmas occurs before the
- // PCH file is read, so there may be some identifiers that were
+ // AST file is read, so there may be some identifiers that were
// loaded into the IdentifierTable before we intercepted the
// creation of identifiers. Iterate through the list of known
// identifiers and determine whether we have to establish
@@ -1854,18 +1844,18 @@
Identifiers.push_back(Id->second);
// We need to search the tables in all files.
for (unsigned J = 0, M = Chain.size(); J != M; ++J) {
- PCHIdentifierLookupTable *IdTable
- = (PCHIdentifierLookupTable *)Chain[J]->IdentifierLookupTable;
- // Not all PCH files necessarily have identifier tables, only the useful
+ ASTIdentifierLookupTable *IdTable
+ = (ASTIdentifierLookupTable *)Chain[J]->IdentifierLookupTable;
+ // Not all AST files necessarily have identifier tables, only the useful
// ones.
if (!IdTable)
continue;
for (unsigned I = 0, N = Identifiers.size(); I != N; ++I) {
IdentifierInfo *II = Identifiers[I];
// Look in the on-disk hash tables for an entry for this identifier
- PCHIdentifierLookupTrait Info(*this, Chain[J]->Stream, II);
+ ASTIdentifierLookupTrait Info(*this, Chain[J]->Stream, II);
std::pair<const char*,unsigned> Key(II->getNameStart(),II->getLength());
- PCHIdentifierLookupTable::iterator Pos = IdTable->find(Key, &Info);
+ ASTIdentifierLookupTable::iterator Pos = IdTable->find(Key, &Info);
if (Pos == IdTable->end())
continue;
@@ -1886,10 +1876,10 @@
Chain.push_back(new PerFileData());
PerFileData &F = *Chain.back();
- // Set the PCH file name.
+ // Set the AST file name.
F.FileName = FileName;
- // Open the PCH file.
+ // Open the AST file.
//
// FIXME: This shouldn't be here, we should just take a raw_ostream.
std::string ErrStr;
@@ -1919,17 +1909,17 @@
unsigned Code = Stream.ReadCode();
if (Code != llvm::bitc::ENTER_SUBBLOCK) {
- Error("invalid record at top-level of PCH file");
+ Error("invalid record at top-level of AST file");
return Failure;
}
unsigned BlockID = Stream.ReadSubBlockID();
- // We only know the PCH subblock ID.
+ // We only know the AST subblock ID.
switch (BlockID) {
case llvm::bitc::BLOCKINFO_BLOCK_ID:
if (Stream.ReadBlockInfoBlock()) {
- Error("malformed BlockInfoBlock in PCH file");
+ Error("malformed BlockInfoBlock in AST file");
return Failure;
}
break;
@@ -1943,8 +1933,8 @@
case IgnorePCH:
// FIXME: We could consider reading through to the end of this
- // PCH block, skipping subblocks, to see if there are other
- // PCH blocks elsewhere.
+ // AST block, skipping subblocks, to see if there are other
+ // AST blocks elsewhere.
// Clear out any preallocated source location entries, so that
// the source manager does not try to resolve them later.
@@ -1952,14 +1942,14 @@
// Remove the stat cache.
if (F.StatCache)
- FileMgr.removeStatCache((PCHStatCache*)F.StatCache);
+ FileMgr.removeStatCache((ASTStatCache*)F.StatCache);
return IgnorePCH;
}
break;
default:
if (Stream.SkipBlock()) {
- Error("malformed block record in PCH file");
+ Error("malformed block record in AST file");
return Failure;
}
break;
@@ -2022,7 +2012,7 @@
else {
const TagType *Tag = FileType->getAs<TagType>();
if (!Tag) {
- Error("Invalid FILE type in PCH file");
+ Error("Invalid FILE type in AST file");
return;
}
Context->setFILEDecl(Tag->getDecl());
@@ -2039,7 +2029,7 @@
else {
const TagType *Tag = Jmp_bufType->getAs<TagType>();
if (!Tag) {
- Error("Invalid jmp_bug type in PCH file");
+ Error("Invalid jmp_buf type in AST file");
return;
}
Context->setjmp_bufDecl(Tag->getDecl());
@@ -2055,7 +2045,7 @@
Context->setsigjmp_bufDecl(Typedef->getDecl());
else {
const TagType *Tag = Sigjmp_bufType->getAs<TagType>();
- assert(Tag && "Invalid sigjmp_buf type in PCH file");
+ assert(Tag && "Invalid sigjmp_buf type in AST file");
Context->setsigjmp_bufDecl(Tag->getDecl());
}
}
@@ -2081,14 +2071,14 @@
}
/// \brief Retrieve the name of the original source file name
-/// directly from the PCH file, without actually loading the PCH
+/// directly from the AST file, without actually loading the AST
/// file.
-std::string ASTReader::getOriginalSourceFile(const std::string &PCHFileName,
+std::string ASTReader::getOriginalSourceFile(const std::string &ASTFileName,
Diagnostic &Diags) {
- // Open the PCH file.
+ // Open the AST file.
std::string ErrStr;
llvm::OwningPtr<llvm::MemoryBuffer> Buffer;
- Buffer.reset(llvm::MemoryBuffer::getFile(PCHFileName.c_str(), &ErrStr));
+ Buffer.reset(llvm::MemoryBuffer::getFile(ASTFileName.c_str(), &ErrStr));
if (!Buffer) {
Diags.Report(diag::err_fe_unable_to_read_pch_file) << ErrStr;
return std::string();
@@ -2106,7 +2096,7 @@
Stream.Read(8) != 'P' ||
Stream.Read(8) != 'C' ||
Stream.Read(8) != 'H') {
- Diags.Report(diag::err_fe_not_a_pch_file) << PCHFileName;
+ Diags.Report(diag::err_fe_not_a_pch_file) << ASTFileName;
return std::string();
}
@@ -2117,18 +2107,18 @@
if (Code == llvm::bitc::ENTER_SUBBLOCK) {
unsigned BlockID = Stream.ReadSubBlockID();
- // We only know the PCH subblock ID.
+ // We only know the AST subblock ID.
switch (BlockID) {
case pch::PCH_BLOCK_ID:
if (Stream.EnterSubBlock(pch::PCH_BLOCK_ID)) {
- Diags.Report(diag::err_fe_pch_malformed_block) << PCHFileName;
+ Diags.Report(diag::err_fe_pch_malformed_block) << ASTFileName;
return std::string();
}
break;
default:
if (Stream.SkipBlock()) {
- Diags.Report(diag::err_fe_pch_malformed_block) << PCHFileName;
+ Diags.Report(diag::err_fe_pch_malformed_block) << ASTFileName;
return std::string();
}
break;
@@ -2138,7 +2128,7 @@
if (Code == llvm::bitc::END_BLOCK) {
if (Stream.ReadBlockEnd()) {
- Diags.Report(diag::err_fe_pch_error_at_end_block) << PCHFileName;
+ Diags.Report(diag::err_fe_pch_error_at_end_block) << ASTFileName;
return std::string();
}
continue;
@@ -2163,17 +2153,10 @@
/// \brief Parse the record that corresponds to a LangOptions data
/// structure.
///
-/// This routine compares the language options used to generate the
-/// PCH file against the language options set for the current
-/// compilation. For each option, we classify differences between the
-/// two compiler states as either "benign" or "important". Benign
-/// differences don't matter, and we accept them without complaint
-/// (and without modifying the language options). Differences between
-/// the states for important options cause the PCH file to be
-/// unusable, so we emit a warning and return true to indicate that
-/// there was an error.
+/// This routine parses the language options from the AST file and then gives
+/// them to the AST listener if one is set.
///
-/// \returns true if the PCH file is unacceptable, false otherwise.
+/// \returns true if the listener deems the file unacceptable, false otherwise.
bool ASTReader::ParseLanguageOptions(
const llvm::SmallVectorImpl<uint64_t> &Record) {
if (Listener) {
@@ -2380,7 +2363,7 @@
case pch::TYPE_VECTOR: {
if (Record.size() != 3) {
- Error("incorrect encoding of vector type in PCH file");
+ Error("incorrect encoding of vector type in AST file");
return QualType();
}
@@ -2393,7 +2376,7 @@
case pch::TYPE_EXT_VECTOR: {
if (Record.size() != 3) {
- Error("incorrect encoding of extended vector type in PCH file");
+ Error("incorrect encoding of extended vector type in AST file");
return QualType();
}
@@ -2457,7 +2440,7 @@
case pch::TYPE_TYPEOF: {
if (Record.size() != 1) {
- Error("incorrect encoding of typeof(type) in PCH file");
+ Error("incorrect encoding of typeof(type) in AST file");
return QualType();
}
QualType UnderlyingType = GetType(Record[0]);
@@ -2532,7 +2515,7 @@
CXXRecordDecl *D = cast<CXXRecordDecl>(GetDecl(Record[0]));
QualType TST = GetType(Record[1]); // probably derivable
// FIXME: ASTContext::getInjectedClassNameType is not currently suitable
- // for PCH reading, too much interdependencies.
+ // for AST reading, too much interdependencies.
return
QualType(new (*Context, TypeAlignment) InjectedClassNameType(D, TST), 0);
}
@@ -2855,7 +2838,7 @@
assert(Index < TypesLoaded.size() && "Type index out-of-range");
if (TypesLoaded[Index].isNull()) {
TypesLoaded[Index] = ReadTypeRecord(Index);
- TypesLoaded[Index]->setFromPCH();
+ TypesLoaded[Index]->setFromAST();
if (DeserializationListener)
DeserializationListener->TypeRead(ID >> Qualifiers::FastWidth,
TypesLoaded[Index]);
@@ -2922,7 +2905,7 @@
return 0;
if (ID > DeclsLoaded.size()) {
- Error("declaration ID out-of-range for PCH file");
+ Error("declaration ID out-of-range for AST file");
return 0;
}
@@ -3062,7 +3045,7 @@
}
void ASTReader::PrintStats() {
- std::fprintf(stderr, "*** PCH Statistics:\n");
+ std::fprintf(stderr, "*** AST File Statistics:\n");
unsigned NumTypesLoaded
= TypesLoaded.size() - std::count(TypesLoaded.begin(), TypesLoaded.end(),
@@ -3244,12 +3227,12 @@
// Try to find this name within our on-disk hash tables. We start with the
// most recent one, since that one contains the most up-to-date info.
for (unsigned I = 0, N = Chain.size(); I != N; ++I) {
- PCHIdentifierLookupTable *IdTable
- = (PCHIdentifierLookupTable *)Chain[I]->IdentifierLookupTable;
+ ASTIdentifierLookupTable *IdTable
+ = (ASTIdentifierLookupTable *)Chain[I]->IdentifierLookupTable;
if (!IdTable)
continue;
std::pair<const char*, unsigned> Key(NameStart, NameEnd - NameStart);
- PCHIdentifierLookupTable::iterator Pos = IdTable->find(Key);
+ ASTIdentifierLookupTable::iterator Pos = IdTable->find(Key);
if (Pos == IdTable->end())
continue;
@@ -3269,16 +3252,16 @@
if (!F.SelectorLookupTable)
continue;
- PCHSelectorLookupTable *PoolTable
- = (PCHSelectorLookupTable*)F.SelectorLookupTable;
- PCHSelectorLookupTable::iterator Pos = PoolTable->find(Sel);
+ ASTSelectorLookupTable *PoolTable
+ = (ASTSelectorLookupTable*)F.SelectorLookupTable;
+ ASTSelectorLookupTable::iterator Pos = PoolTable->find(Sel);
if (Pos != PoolTable->end()) {
++NumSelectorsRead;
// FIXME: Not quite happy with the statistics here. We probably should
// disable this tracking when called via LoadSelector.
// Also, should entries without methods count as misses?
++NumMethodPoolEntriesRead;
- PCHSelectorLookupTrait::data_type Data = *Pos;
+ ASTSelectorLookupTrait::data_type Data = *Pos;
if (DeserializationListener)
DeserializationListener->SelectorRead(Data.ID, Sel);
return std::make_pair(Data.Instance, Data.Factory);
@@ -3305,7 +3288,7 @@
/// \brief Set the globally-visible declarations associated with the given
/// identifier.
///
-/// If the PCH reader is currently in a state where the given declaration IDs
+/// If the AST reader is currently in a state where the given declaration IDs
/// cannot safely be resolved, they are queued until it is safe to resolve
/// them.
///
@@ -3355,7 +3338,7 @@
return 0;
if (IdentifiersLoaded.empty()) {
- Error("no identifier table in PCH file");
+ Error("no identifier table in AST file");
return 0;
}
@@ -3375,9 +3358,8 @@
}
assert(Str && "Broken Chain");
- // All of the strings in the PCH file are preceded by a 16-bit
- // length. Extract that 16-bit length to avoid having to execute
- // strlen().
+ // All of the strings in the AST file are preceded by a 16-bit length.
+ // Extract that 16-bit length to avoid having to execute strlen().
// NOTE: 'StrLenPtr' is an 'unsigned char*' so that we load bytes as
// unsigned integers. This is important to avoid integer overflow when
// we cast them to 'unsigned'.
@@ -3402,7 +3384,7 @@
return Selector();
if (ID > SelectorsLoaded.size()) {
- Error("selector ID out of range in PCH file");
+ Error("selector ID out of range in AST file");
return Selector();
}
@@ -3412,7 +3394,7 @@
for (unsigned I = 0, N = Chain.size(); I != N; ++I) {
PerFileData &F = *Chain[N - I - 1];
if (Idx < F.LocalNumSelectors) {
- PCHSelectorLookupTrait Trait(*this);
+ ASTSelectorLookupTrait Trait(*this);
SelectorsLoaded[ID - 1] =
Trait.ReadKey(F.SelectorLookupTableData + F.SelectorOffsets[Idx], 0);
if (DeserializationListener)
diff --git a/lib/Serialization/PCHReaderDecl.cpp b/lib/Serialization/PCHReaderDecl.cpp
index 4e2156a..677d64e 100644
--- a/lib/Serialization/PCHReaderDecl.cpp
+++ b/lib/Serialization/PCHReaderDecl.cpp
@@ -870,8 +870,8 @@
cast_or_null<RedeclarableTemplateDecl>(Reader.GetDecl(Record[Idx++]));
// This decl is a first one and the latest declaration that it points to is
- // in the same PCH. However, if this actually needs to point to a
- // redeclaration in another chained PCH, we need to update it by checking
+ // in the same AST file. However, if this actually needs to point to a
+ // redeclaration in another AST file, we need to update it by checking
// the FirstLatestDeclIDs map which tracks this kind of decls.
assert(Reader.GetDecl(ThisDeclID) == D && "Invalid ThisDeclID ?");
ASTReader::FirstLatestDeclIDMap::iterator I
@@ -1069,8 +1069,8 @@
return;
// This decl is a first one and the latest declaration that it points to is in
- // the same PCH. However, if this actually needs to point to a redeclaration
- // in another chained PCH, we need to update it by checking the
+ // the same AST file. However, if this actually needs to point to a
+ // redeclaration in another AST file, we need to update it by checking the
// FirstLatestDeclIDs map which tracks this kind of decls.
assert(Reader.GetDecl(ThisDeclID) == static_cast<T*>(D) &&
"Invalid ThisDeclID ?");
diff --git a/lib/Serialization/PCHReaderStmt.cpp b/lib/Serialization/PCHReaderStmt.cpp
index 6f9314e..2813954 100644
--- a/lib/Serialization/PCHReaderStmt.cpp
+++ b/lib/Serialization/PCHReaderStmt.cpp
@@ -1287,7 +1287,7 @@
unsigned Code = Cursor.ReadCode();
if (Code == llvm::bitc::END_BLOCK) {
if (Cursor.ReadBlockEnd()) {
- Error("error at end of block in PCH file");
+ Error("error at end of block in AST file");
return 0;
}
break;
@@ -1297,7 +1297,7 @@
// 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 0;
}
continue;
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index a5d0f13..8134971 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -1189,7 +1189,7 @@
CIndexer *CXXIdx = static_cast<CIndexer *>(CIdx);
llvm::IntrusiveRefCntPtr<Diagnostic> Diags;
- return ASTUnit::LoadFromPCHFile(ast_filename, Diags,
+ return ASTUnit::LoadFromASTFile(ast_filename, Diags,
CXXIdx->getOnlyLocalDecls(),
0, 0, true);
}
@@ -1422,7 +1422,7 @@
Diags->Report(diag::err_fe_invoking) << AllArgs << ErrMsg;
}
- ASTUnit *ATU = ASTUnit::LoadFromPCHFile(astTmpFile, Diags,
+ ASTUnit *ATU = ASTUnit::LoadFromASTFile(astTmpFile, Diags,
CXXIdx->getOnlyLocalDecls(),
RemappedFiles.data(),
RemappedFiles.size(),
@@ -1467,7 +1467,7 @@
// Make the translation unit responsible for destroying all temporary files.
for (unsigned i = 0, e = TemporaryFiles.size(); i != e; ++i)
ATU->addTemporaryFile(TemporaryFiles[i]);
- ATU->addTemporaryFile(llvm::sys::Path(ATU->getPCHFileName()));
+ ATU->addTemporaryFile(llvm::sys::Path(ATU->getASTFileName()));
} else {
// Destroy all of the temporary files now; they can't be referenced any
// longer.