forked from OSchip/llvm-project
parent
3e31c72497
commit
d44cd6adba
|
@ -50,7 +50,7 @@ public:
|
|||
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);
|
||||
|
||||
|
|
|
@ -226,8 +226,8 @@ protected:
|
|||
/// 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 @@ protected:
|
|||
: 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 @@ protected:
|
|||
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 @@ public:
|
|||
/// 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 @@ public:
|
|||
///
|
||||
/// 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;
|
||||
|
|
|
@ -787,12 +787,12 @@ private:
|
|||
/// \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 @@ protected:
|
|||
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 @@ class FunctionType : public Type {
|
|||
// * 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) {}
|
||||
|
||||
|
|
|
@ -59,8 +59,8 @@ class IdentifierInfo {
|
|||
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 @@ public:
|
|||
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 @@ public:
|
|||
///
|
||||
/// 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 @@ public:
|
|||
NeedsHandleIdentifier = 1;
|
||||
else
|
||||
RecomputeNeedsHandleIdentifier();
|
||||
IsFromPCH = false;
|
||||
IsFromAST = false;
|
||||
}
|
||||
|
||||
/// isPoisoned - Return true if this token has been poisoned.
|
||||
|
@ -233,11 +233,11 @@ public:
|
|||
/// 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
|
||||
|
|
|
@ -42,7 +42,7 @@ enum Linkage {
|
|||
};
|
||||
|
||||
/// \brief A more specific kind of linkage. This is relevant to CodeGen and
|
||||
/// PCH reading.
|
||||
/// AST file reading.
|
||||
enum GVALinkage {
|
||||
GVA_Internal,
|
||||
GVA_C99Inline,
|
||||
|
|
|
@ -795,7 +795,7 @@ public:
|
|||
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(); }
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class TargetInfo;
|
|||
|
||||
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 @@ private:
|
|||
/// \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 @@ public:
|
|||
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 @@ public:
|
|||
/// 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,
|
||||
|
|
|
@ -145,8 +145,8 @@ public:
|
|||
/// @{
|
||||
|
||||
/// 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
|
||||
|
|
|
@ -60,10 +60,10 @@ public:
|
|||
/// 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
|
||||
|
|
|
@ -62,8 +62,8 @@ class MacroInfo {
|
|||
/// 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 @@ public:
|
|||
/// __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.
|
||||
|
|
|
@ -169,7 +169,7 @@ public:
|
|||
/// \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);
|
||||
|
|
|
@ -31,14 +31,15 @@ public:
|
|||
/// \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;
|
||||
};
|
||||
|
||||
|
|
|
@ -104,8 +104,8 @@ public:
|
|||
///
|
||||
/// \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 @@ private:
|
|||
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 @@ private:
|
|||
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 @@ private:
|
|||
/// 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 @@ private:
|
|||
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 @@ private:
|
|||
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 @@ private:
|
|||
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 @@ private:
|
|||
|
||||
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 @@ private:
|
|||
/// \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 @@ private:
|
|||
/// 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 @@ private:
|
|||
/// 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 @@ private:
|
|||
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 @@ private:
|
|||
~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 @@ private:
|
|||
/// \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 @@ private:
|
|||
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 @@ public:
|
|||
/// 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 @@ public:
|
|||
/// 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 @@ public:
|
|||
/// \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 @@ public:
|
|||
/// 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 @@ public:
|
|||
/// \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
|
||||
|
|
|
@ -34,7 +34,7 @@ IdentifierInfo::IdentifierInfo() {
|
|||
IsPoisoned = false;
|
||||
IsCPPOperatorKeyword = false;
|
||||
NeedsHandleIdentifier = false;
|
||||
IsFromPCH = false;
|
||||
IsFromAST = false;
|
||||
RevertedTokenID = false;
|
||||
FETokenInfo = 0;
|
||||
Entry = 0;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
|
|
@ -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();
|
||||
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 @@ ASTReader::ReadASTBlock(PerFileData &F) {
|
|||
|
||||
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 @@ ASTReader::ReadASTBlock(PerFileData &F) {
|
|||
}
|
||||
First = false;
|
||||
}
|
||||
Error("premature end of bitstream in PCH file");
|
||||
Error("premature end of bitstream in AST file");
|
||||
return Failure;
|
||||
}
|
||||
|
||||
|
@ -1836,7 +1826,7 @@ ASTReader::ASTReadResult ASTReader::ReadAST(const std::string &FileName) {
|
|||
|
||||
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 @@ ASTReader::ASTReadResult ASTReader::ReadAST(const std::string &FileName) {
|
|||
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 @@ ASTReader::ASTReadResult ASTReader::ReadASTCore(llvm::StringRef FileName) {
|
|||
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 @@ ASTReader::ASTReadResult ASTReader::ReadASTCore(llvm::StringRef FileName) {
|
|||
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 @@ ASTReader::ASTReadResult ASTReader::ReadASTCore(llvm::StringRef FileName) {
|
|||
|
||||
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 @@ ASTReader::ASTReadResult ASTReader::ReadASTCore(llvm::StringRef FileName) {
|
|||
|
||||
// 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 @@ void ASTReader::InitializeContext(ASTContext &Ctx) {
|
|||
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 @@ void ASTReader::InitializeContext(ASTContext &Ctx) {
|
|||
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 @@ void ASTReader::InitializeContext(ASTContext &Ctx) {
|
|||
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 @@ void ASTReader::InitializeContext(ASTContext &Ctx) {
|
|||
}
|
||||
|
||||
/// \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 @@ std::string ASTReader::getOriginalSourceFile(const std::string &PCHFileName,
|
|||
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 @@ std::string ASTReader::getOriginalSourceFile(const std::string &PCHFileName,
|
|||
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 @@ std::string ASTReader::getOriginalSourceFile(const std::string &PCHFileName,
|
|||
|
||||
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 @@ std::string ASTReader::getOriginalSourceFile(const std::string &PCHFileName,
|
|||
/// \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 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
|||
|
||||
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 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
|||
|
||||
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 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
|||
|
||||
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 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
|||
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 @@ QualType ASTReader::GetType(pch::TypeID ID) {
|
|||
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 @@ Decl *ASTReader::GetDecl(pch::DeclID ID) {
|
|||
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::StartTranslationUnit(ASTConsumer *Consumer) {
|
|||
}
|
||||
|
||||
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 @@ IdentifierInfo* ASTReader::get(const char *NameStart, const char *NameEnd) {
|
|||
// 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 @@ ASTReader::ReadMethodPool(Selector Sel) {
|
|||
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 @@ void ASTReader::SetIdentifierInfo(unsigned ID, IdentifierInfo *II) {
|
|||
/// \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 @@ IdentifierInfo *ASTReader::DecodeIdentifierInfo(unsigned ID) {
|
|||
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 @@ IdentifierInfo *ASTReader::DecodeIdentifierInfo(unsigned ID) {
|
|||
}
|
||||
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 @@ Selector ASTReader::DecodeSelector(unsigned ID) {
|
|||
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 @@ Selector ASTReader::DecodeSelector(unsigned ID) {
|
|||
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)
|
||||
|
|
|
@ -870,8 +870,8 @@ void ASTDeclReader::VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D) {
|
|||
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 @@ void ASTDeclReader::VisitRedeclarable(Redeclarable<T> *D) {
|
|||
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 ?");
|
||||
|
|
|
@ -1287,7 +1287,7 @@ Stmt *ASTReader::ReadStmtFromStream(llvm::BitstreamCursor &Cursor) {
|
|||
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 @@ Stmt *ASTReader::ReadStmtFromStream(llvm::BitstreamCursor &Cursor) {
|
|||
// 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;
|
||||
|
|
|
@ -1189,7 +1189,7 @@ CXTranslationUnit clang_createTranslationUnit(CXIndex CIdx,
|
|||
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 @@ void clang_parseTranslationUnit_Impl(void *UserData) {
|
|||
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 @@ void clang_parseTranslationUnit_Impl(void *UserData) {
|
|||
// 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.
|
||||
|
|
Loading…
Reference in New Issue