clang 22.0.0git
ASTReader.cpp File Reference
#include "ASTCommon.h"
#include "ASTReaderInternals.h"
#include "TemplateArgumentHasher.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTMutationListener.h"
#include "clang/AST/ASTStructuralEquivalence.h"
#include "clang/AST/ASTUnresolvedSet.h"
#include "clang/AST/AbstractTypeReader.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclFriend.h"
#include "clang/AST/DeclGroup.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExternalASTSource.h"
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/AST/ODRDiagsEmitter.h"
#include "clang/AST/OpenACCClause.h"
#include "clang/AST/OpenMPClause.h"
#include "clang/AST/RawCommentList.h"
#include "clang/AST/TemplateBase.h"
#include "clang/AST/TemplateName.h"
#include "clang/AST/Type.h"
#include "clang/AST/TypeLoc.h"
#include "clang/AST/TypeLocVisitor.h"
#include "clang/AST/UnresolvedSet.h"
#include "clang/Basic/ASTSourceDescriptor.h"
#include "clang/Basic/CommentOptions.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticIDs.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Basic/DiagnosticSema.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/FileSystemOptions.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/Module.h"
#include "clang/Basic/ObjCRuntime.h"
#include "clang/Basic/OpenACCKinds.h"
#include "clang/Basic/OpenMPKinds.h"
#include "clang/Basic/OperatorKinds.h"
#include "clang/Basic/PragmaKinds.h"
#include "clang/Basic/Sanitizers.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/SourceManagerInternals.h"
#include "clang/Basic/Specifiers.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/TargetOptions.h"
#include "clang/Basic/TokenKinds.h"
#include "clang/Basic/Version.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/HeaderSearchOptions.h"
#include "clang/Lex/MacroInfo.h"
#include "clang/Lex/ModuleMap.h"
#include "clang/Lex/PreprocessingRecord.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/PreprocessorOptions.h"
#include "clang/Lex/Token.h"
#include "clang/Sema/ObjCMethodList.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/Sema.h"
#include "clang/Sema/SemaCUDA.h"
#include "clang/Sema/SemaObjC.h"
#include "clang/Sema/Weak.h"
#include "clang/Serialization/ASTBitCodes.h"
#include "clang/Serialization/ASTDeserializationListener.h"
#include "clang/Serialization/ASTRecordReader.h"
#include "clang/Serialization/ContinuousRangeMap.h"
#include "clang/Serialization/GlobalModuleIndex.h"
#include "clang/Serialization/InMemoryModuleCache.h"
#include "clang/Serialization/ModuleCache.h"
#include "clang/Serialization/ModuleFile.h"
#include "clang/Serialization/ModuleFileExtension.h"
#include "clang/Serialization/ModuleManager.h"
#include "clang/Serialization/PCHContainerOperations.h"
#include "clang/Serialization/SerializationDiagnostic.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Bitstream/BitstreamReader.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Compression.h"
#include "llvm/Support/DJB.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/SaveAndRestore.h"
#include "llvm/Support/TimeProfiler.h"
#include "llvm/Support/Timer.h"
#include "llvm/Support/VersionTuple.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Triple.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <ctime>
#include <iterator>
#include <limits>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <system_error>
#include <tuple>
#include <utility>
#include <vector>
#include "clang/Basic/LangOptions.def"
#include "clang/Basic/Sanitizers.def"
#include "clang/Basic/CodeGenOptions.def"
#include "clang/Basic/DiagnosticOptions.def"
#include "clang/Serialization/TypeBitCodes.def"
#include "clang/AST/TypeLocNodes.def"
#include "clang/Basic/OpenCLImageTypes.def"
#include "clang/Basic/OpenCLExtensionTypes.def"
#include "clang/Basic/AArch64ACLETypes.def"
#include "clang/Basic/PPCTypes.def"
#include "clang/Basic/RISCVVTypes.def"
#include "clang/Basic/WebAssemblyReferenceTypes.def"
#include "clang/Basic/AMDGPUTypes.def"
#include "clang/Basic/HLSLIntangibleTypes.def"
#include "clang/Basic/BuiltinTemplates.inc"
#include "llvm/Frontend/OpenMP/OMP.inc"
#include "llvm/Frontend/OpenMP/OMPKinds.def"

Go to the source code of this file.

Classes

class  clang::TypeLocReader
class  clang::ASTIdentifierIterator
 An identifier-lookup iterator that enumerates all of the identifiers stored within a set of AST files. More...
class  clang::serialization::ReadMethodPoolVisitor
class  clang::OMPClauseReader

Namespaces

namespace  clang
 The JSON file list parser is used to communicate input to InstallAPI.
namespace  clang::serialization

Macros

#define LANGOPT(Name, Bits, Default, Compatibility, Description)
#define VALUE_LANGOPT(Name, Bits, Default, Compatibility, Description)
#define ENUM_LANGOPT(Name, Type, Bits, Default, Compatibility, Description)
#define SANITIZER(NAME, ID)
#define CODEGENOPT(Name, Bits, Default, Compatibility)
#define VALUE_CODEGENOPT(Name, Bits, Default, Compatibility)
#define ENUM_CODEGENOPT(Name, Type, Bits, Default, Compatibility)
#define DEBUGOPT(Name, Bits, Default, Compatibility)
#define VALUE_DEBUGOPT(Name, Bits, Default, Compatibility)
#define ENUM_DEBUGOPT(Name, Type, Bits, Default, Compatibility)
#define CHECK_TARGET_OPT(Field, Name)
#define LANGOPT(Name, Bits, Default, Compatibility, Description)
#define ENUM_LANGOPT(Name, Type, Bits, Default, Compatibility, Description)
#define SANITIZER(NAME, ID)
#define CODEGENOPT(Name, Bits, Default, Compatibility)
#define ENUM_CODEGENOPT(Name, Type, Bits, Default, Compatibility)
#define DEBUGOPT(Name, Bits, Default, Compatibility)
#define VALUE_DEBUGOPT(Name, Bits, Default, Compatibility)
#define ENUM_DEBUGOPT(Name, Type, Bits, Default, Compatibility)
#define DIAGOPT(Name, Bits, Default)
#define ENUM_DIAGOPT(Name, Type, Bits, Default)
#define TYPE_BIT_CODE(CLASS_ID, CODE_ID, CODE_VALUE)
#define ABSTRACT_TYPELOC(CLASS, PARENT)
#define TYPELOC(CLASS, PARENT)
#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix)
#define EXT_OPAQUE_TYPE(ExtType, Id, Ext)
#define SVE_TYPE(Name, Id, SingletonId)
#define PPC_VECTOR_TYPE(Name, Id, Size)
#define RVV_TYPE(Name, Id, SingletonId)
#define WASM_TYPE(Name, Id, SingletonId)
#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align)
#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId)
#define BuiltinTemplate(BTName)
#define GEN_CLANG_CLAUSE_CLASS
#define CLAUSE_CLASS(Enum, Str, Class)
#define OMP_CLAUSE_NO_CLASS(Enum, Str)

Enumerations

enum  OptionValidation { OptionValidateNone , OptionValidateContradictions , OptionValidateStrictMatches }

Functions

static bool checkLanguageOptions (const LangOptions &LangOpts, const LangOptions &ExistingLangOpts, StringRef ModuleFilename, DiagnosticsEngine *Diags, bool AllowCompatibleDifferences=true)
 Compare the given set of language options against an existing set of language options.
static bool checkCodegenOptions (const CodeGenOptions &CGOpts, const CodeGenOptions &ExistingCGOpts, StringRef ModuleFilename, DiagnosticsEngine *Diags, bool AllowCompatibleDifferences=true)
static bool checkTargetOptions (const TargetOptions &TargetOpts, const TargetOptions &ExistingTargetOpts, StringRef ModuleFilename, DiagnosticsEngine *Diags, bool AllowCompatibleDifferences=true)
 Compare the given set of target options against an existing set of target options.
static bool checkDiagnosticGroupMappings (DiagnosticsEngine &StoredDiags, DiagnosticsEngine &Diags, StringRef ModuleFilename, bool Complain)
static bool isExtHandlingFromDiagsError (DiagnosticsEngine &Diags)
static bool checkDiagnosticMappings (DiagnosticsEngine &StoredDiags, DiagnosticsEngine &Diags, StringRef ModuleFilename, bool IsSystem, bool SystemHeaderWarningsInModule, bool Complain)
static ModulegetTopImportImplicitModule (ModuleManager &ModuleMgr, Preprocessor &PP)
 Return the top import module if it is implicit, nullptr otherwise.
static void collectMacroDefinitions (const PreprocessorOptions &PPOpts, MacroDefinitionsMap &Macros, SmallVectorImpl< StringRef > *MacroNames=nullptr)
 Collect the macro definitions provided by the given preprocessor options.
static bool checkPreprocessorOptions (const PreprocessorOptions &PPOpts, const PreprocessorOptions &ExistingPPOpts, StringRef ModuleFilename, bool ReadMacros, DiagnosticsEngine *Diags, FileManager &FileMgr, std::string &SuggestedPredefines, const LangOptions &LangOpts, OptionValidation Validation=OptionValidateContradictions)
 Check the preprocessor options deserialized from the control block against the preprocessor options in an existing preprocessor.
static bool checkModuleCachePath (llvm::vfs::FileSystem &VFS, StringRef SpecificModuleCachePath, StringRef ExistingModuleCachePath, StringRef ModuleFilename, DiagnosticsEngine *Diags, const LangOptions &LangOpts, const PreprocessorOptions &PPOpts)
 Check that the specified and the existing module cache paths are equivalent.
static uint64_t readULEB (const unsigned char *&P)
static std::pair< unsigned, unsignedreadULEBKeyDataLength (const unsigned char *&P)
 Read ULEB-encoded key length and data length.
static bool isInterestingIdentifier (ASTReader &Reader, const IdentifierInfo &II, bool IsModule)
 Whether the given identifier is "interesting".
static bool readBit (unsigned &Bits)
static void markIdentifierFromAST (ASTReader &Reader, IdentifierInfo &II, bool IsModule)
static std::pair< StringRef, StringRef > getUnresolvedInputFilenames (const ASTReader::RecordData &Record, const StringRef InputBlob)
static unsigned moduleKindForDiagnostic (ModuleKind Kind)
static bool isDiagnosedResult (ASTReader::ASTReadResult ARR, unsigned Caps)
static void moveMethodToBackOfGlobalList (Sema &S, ObjCMethodDecl *Method)
 Move the given method to the back of the global list of methods.
static bool SkipCursorToBlock (BitstreamCursor &Cursor, unsigned BlockID)
 Given a cursor at the start of an AST file, scan ahead and drop the cursor into the start of the given block ID, returning false on success and true on failure.
static ASTFileSignature readASTFileSignature (StringRef PCH)
 Reads and return the signature record from PCH's control block, or else returns 0.
static llvm::Error doesntStartWithASTFileMagic (BitstreamCursor &Stream)
 Whether Stream doesn't start with the AST file magic number 'CPCH'.
static bool parseModuleFileExtensionMetadata (const SmallVectorImpl< uint64_t > &Record, StringRef Blob, ModuleFileExtensionMetadata &Metadata)
 Parse a record and blob containing module file extension metadata.
static std::optional< Type::TypeClass > getTypeClassForCode (TypeCode code)
static unsigned getIndexForTypeID (serialization::TypeID ID)
static unsigned getModuleFileIndexForTypeID (serialization::TypeID ID)
static bool isPredefinedType (serialization::TypeID ID)
static void PassObjCImplDeclToConsumer (ObjCImplDecl *ImplD, ASTConsumer *Consumer)
 Under non-PCH compilation the consumer receives the objc methods before receiving the implementation, and codegen depends on this.
template<typename Key, typename ModuleFile, unsigned InitialCapacity>
static LLVM_DUMP_METHOD void dumpModuleIDMap (StringRef Name, const ContinuousRangeMap< Key, ModuleFile *, InitialCapacity > &Map)
static void addMethodsToPool (Sema &S, ArrayRef< ObjCMethodDecl * > Methods, ObjCMethodList &List)
 Add the given set of methods to the method list.
static unsigned getStableHashForModuleName (StringRef PrimaryModuleName)

Macro Definition Documentation

◆ ABSTRACT_TYPELOC

#define ABSTRACT_TYPELOC ( CLASS,
PARENT )

Definition at line 7222 of file ASTReader.cpp.

◆ AMDGPU_TYPE

#define AMDGPU_TYPE ( Name,
Id,
SingletonId,
Width,
Align )
Value:
case PREDEF_TYPE_##Id##_ID: \
T = Context.SingletonId; \
break;
const FunctionProtoType * T

◆ BuiltinTemplate

#define BuiltinTemplate ( BTName)
Value:
case PREDEF_DECL##BTName##_ID: \
if (Context.Decl##BTName) \
return Context.Decl##BTName; \
NewLoaded = Context.get##BTName##Decl(); \
break;
Decl - This represents one declaration (or definition), e.g.
Definition DeclBase.h:86

◆ CHECK_TARGET_OPT

#define CHECK_TARGET_OPT ( Field,
Name )
Value:
if (TargetOpts.Field != ExistingTargetOpts.Field) { \
if (Diags) \
Diags->Report(diag::err_ast_file_targetopt_mismatch) \
<< ModuleFilename << Name << TargetOpts.Field \
<< ExistingTargetOpts.Field; \
return true; \
}

Referenced by checkTargetOptions().

◆ CLAUSE_CLASS

#define CLAUSE_CLASS ( Enum,
Str,
Class )
Value:
void Visit##Class(Class *C);
@ Class
The "class" keyword introduces the elaborated-type-specifier.
Definition TypeBase.h:5874

Definition at line 11171 of file ASTReader.cpp.

◆ CODEGENOPT [1/2]

#define CODEGENOPT ( Name,
Bits,
Default,
Compatibility )
Value:
if constexpr (CK::Compatibility != CK::Benign) { \
if ((CK::Compatibility == CK::NotCompatible) || \
(CK::Compatibility == CK::Compatible && \
!AllowCompatibleDifferences)) { \
if (ExistingCGOpts.Name != CGOpts.Name) { \
if (Diags) { \
if (Bits == 1) \
Diags->Report(diag::err_ast_file_codegenopt_mismatch) \
<< #Name << CGOpts.Name << ExistingCGOpts.Name \
<< ModuleFilename; \
else \
Diags->Report(diag::err_ast_file_codegenopt_value_mismatch) \
<< #Name << ModuleFilename; \
} \
return true; \
} \
} \
}

◆ CODEGENOPT [2/2]

#define CODEGENOPT ( Name,
Bits,
Default,
Compatibility )
Value:
if constexpr (CK::Compatibility != CK::Benign) \
CGOpts.Name = static_cast<unsigned>(Record[Idx++]);
llvm::MachO::Record Record
Definition MachO.h:31

◆ DEBUGOPT [1/2]

#define DEBUGOPT ( Name,
Bits,
Default,
Compatibility )

◆ DEBUGOPT [2/2]

#define DEBUGOPT ( Name,
Bits,
Default,
Compatibility )

◆ DIAGOPT

#define DIAGOPT ( Name,
Bits,
Default )
Value:
DiagOpts.Name = Record[Idx++];

◆ ENUM_CODEGENOPT [1/2]

#define ENUM_CODEGENOPT ( Name,
Type,
Bits,
Default,
Compatibility )
Value:
if constexpr (CK::Compatibility != CK::Benign) { \
if ((CK::Compatibility == CK::NotCompatible) || \
(CK::Compatibility == CK::Compatible && \
!AllowCompatibleDifferences)) { \
if (ExistingCGOpts.get##Name() != CGOpts.get##Name()) { \
if (Diags) \
Diags->Report(diag::err_ast_file_codegenopt_value_mismatch) \
<< #Name << ModuleFilename; \
return true; \
} \
} \
}

◆ ENUM_CODEGENOPT [2/2]

#define ENUM_CODEGENOPT ( Name,
Type,
Bits,
Default,
Compatibility )
Value:
if constexpr (CK::Compatibility != CK::Benign) \
CGOpts.set##Name(static_cast<clang::CodeGenOptions::Type>(Record[Idx++]));

◆ ENUM_DEBUGOPT [1/2]

#define ENUM_DEBUGOPT ( Name,
Type,
Bits,
Default,
Compatibility )

◆ ENUM_DEBUGOPT [2/2]

#define ENUM_DEBUGOPT ( Name,
Type,
Bits,
Default,
Compatibility )

◆ ENUM_DIAGOPT

#define ENUM_DIAGOPT ( Name,
Type,
Bits,
Default )
Value:
DiagOpts.set##Name(static_cast<Type>(Record[Idx++]));
The base class of the type hierarchy.
Definition TypeBase.h:1833

◆ ENUM_LANGOPT [1/2]

#define ENUM_LANGOPT ( Name,
Type,
Bits,
Default,
Compatibility,
Description )
Value:
if constexpr (CK::Compatibility != CK::Benign) { \
if ((CK::Compatibility == CK::NotCompatible) || \
(CK::Compatibility == CK::Compatible && \
!AllowCompatibleDifferences)) { \
if (ExistingLangOpts.get##Name() != LangOpts.get##Name()) { \
if (Diags) \
Diags->Report(diag::err_ast_file_langopt_value_mismatch) \
<< Description << ModuleFilename; \
return true; \
} \
} \
}

◆ ENUM_LANGOPT [2/2]

#define ENUM_LANGOPT ( Name,
Type,
Bits,
Default,
Compatibility,
Description )
Value:
LangOpts.set##Name(static_cast<LangOptions::Type>(Record[Idx++]));

◆ EXT_OPAQUE_TYPE

#define EXT_OPAQUE_TYPE ( ExtType,
Id,
Ext )
Value:
case PREDEF_TYPE_##Id##_ID: \
T = Context.Id##Ty; \
break;

◆ GEN_CLANG_CLAUSE_CLASS

#define GEN_CLANG_CLAUSE_CLASS

Definition at line 11170 of file ASTReader.cpp.

◆ HLSL_INTANGIBLE_TYPE

#define HLSL_INTANGIBLE_TYPE ( Name,
Id,
SingletonId )
Value:
case PREDEF_TYPE_##Id##_ID: \
T = Context.SingletonId; \
break;

◆ IMAGE_TYPE

#define IMAGE_TYPE ( ImgType,
Id,
SingletonId,
Access,
Suffix )
Value:
case PREDEF_TYPE_##Id##_ID: \
T = Context.SingletonId; \
break;

◆ LANGOPT [1/2]

#define LANGOPT ( Name,
Bits,
Default,
Compatibility,
Description )
Value:
if constexpr (CK::Compatibility != CK::Benign) { \
if ((CK::Compatibility == CK::NotCompatible) || \
(CK::Compatibility == CK::Compatible && \
!AllowCompatibleDifferences)) { \
if (ExistingLangOpts.Name != LangOpts.Name) { \
if (Diags) { \
if (Bits == 1) \
Diags->Report(diag::err_ast_file_langopt_mismatch) \
<< Description << LangOpts.Name << ExistingLangOpts.Name \
<< ModuleFilename; \
else \
Diags->Report(diag::err_ast_file_langopt_value_mismatch) \
<< Description << ModuleFilename; \
} \
return true; \
} \
} \
}

◆ LANGOPT [2/2]

#define LANGOPT ( Name,
Bits,
Default,
Compatibility,
Description )
Value:
LangOpts.Name = Record[Idx++];

◆ OMP_CLAUSE_NO_CLASS

#define OMP_CLAUSE_NO_CLASS ( Enum,
Str )
Value:
case llvm::omp::Enum: \
break;

◆ PPC_VECTOR_TYPE

#define PPC_VECTOR_TYPE ( Name,
Id,
Size )
Value:
case PREDEF_TYPE_##Id##_ID: \
T = Context.Id##Ty; \
break;

◆ RVV_TYPE

#define RVV_TYPE ( Name,
Id,
SingletonId )
Value:
case PREDEF_TYPE_##Id##_ID: \
T = Context.SingletonId; \
break;

◆ SANITIZER [1/2]

#define SANITIZER ( NAME,
ID )
Value:
{ \
bool InExistingModule = ExistingSanitizers.has(SanitizerKind::ID); \
bool InImportedModule = ImportedSanitizers.has(SanitizerKind::ID); \
if (InExistingModule != InImportedModule) \
Diags->Report(diag::err_ast_file_targetopt_feature_mismatch) \
<< InExistingModule << ModuleFilename << (Flag + NAME); \
}

◆ SANITIZER [2/2]

#define SANITIZER ( NAME,
ID )
Value:
LangOpts.Sanitize.set(SanitizerKind::ID, Record[Idx++]);

◆ SVE_TYPE

#define SVE_TYPE ( Name,
Id,
SingletonId )
Value:
case PREDEF_TYPE_##Id##_ID: \
T = Context.SingletonId; \
break;

◆ TYPE_BIT_CODE

#define TYPE_BIT_CODE ( CLASS_ID,
CODE_ID,
CODE_VALUE )
Value:
case TYPE_##CODE_ID: return Type::CLASS_ID;

◆ TYPELOC

#define TYPELOC ( CLASS,
PARENT )
Value:
void Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc);
Base wrapper for a particular "section" of type source info.
Definition TypeLoc.h:59

Definition at line 7223 of file ASTReader.cpp.

◆ VALUE_CODEGENOPT

#define VALUE_CODEGENOPT ( Name,
Bits,
Default,
Compatibility )
Value:
if constexpr (CK::Compatibility != CK::Benign) { \
if ((CK::Compatibility == CK::NotCompatible) || \
(CK::Compatibility == CK::Compatible && \
!AllowCompatibleDifferences)) { \
if (ExistingCGOpts.Name != CGOpts.Name) { \
if (Diags) \
Diags->Report(diag::err_ast_file_codegenopt_value_mismatch) \
<< #Name << ModuleFilename; \
return true; \
} \
} \
}

◆ VALUE_DEBUGOPT [1/2]

#define VALUE_DEBUGOPT ( Name,
Bits,
Default,
Compatibility )

◆ VALUE_DEBUGOPT [2/2]

#define VALUE_DEBUGOPT ( Name,
Bits,
Default,
Compatibility )

◆ VALUE_LANGOPT

#define VALUE_LANGOPT ( Name,
Bits,
Default,
Compatibility,
Description )
Value:
if constexpr (CK::Compatibility != CK::Benign) { \
if ((CK::Compatibility == CK::NotCompatible) || \
(CK::Compatibility == CK::Compatible && \
!AllowCompatibleDifferences)) { \
if (ExistingLangOpts.Name != LangOpts.Name) { \
if (Diags) \
Diags->Report(diag::err_ast_file_langopt_value_mismatch) \
<< Description << ModuleFilename; \
return true; \
} \
} \
}

◆ WASM_TYPE

#define WASM_TYPE ( Name,
Id,
SingletonId )
Value:
case PREDEF_TYPE_##Id##_ID: \
T = Context.SingletonId; \
break;

Enumeration Type Documentation

◆ OptionValidation

Enumerator
OptionValidateNone 
OptionValidateContradictions 
OptionValidateStrictMatches 

Definition at line 748 of file ASTReader.cpp.

Function Documentation

◆ addMethodsToPool()

void addMethodsToPool ( Sema & S,
ArrayRef< ObjCMethodDecl * > Methods,
ObjCMethodList & List )
static

Add the given set of methods to the method list.

Definition at line 9338 of file ASTReader.cpp.

References clang::SemaObjC::addMethodToGlobalList(), and clang::Sema::ObjC().

Referenced by clang::ASTReader::ReadMethodPool().

◆ checkCodegenOptions()

bool checkCodegenOptions ( const CodeGenOptions & CGOpts,
const CodeGenOptions & ExistingCGOpts,
StringRef ModuleFilename,
DiagnosticsEngine * Diags,
bool AllowCompatibleDifferences = true )
static

Definition at line 395 of file ASTReader.cpp.

Referenced by clang::PCHValidator::ReadCodeGenOptions().

◆ checkDiagnosticGroupMappings()

bool checkDiagnosticGroupMappings ( DiagnosticsEngine & StoredDiags,
DiagnosticsEngine & Diags,
StringRef ModuleFilename,
bool Complain )
static

◆ checkDiagnosticMappings()

◆ checkLanguageOptions()

bool checkLanguageOptions ( const LangOptions & LangOpts,
const LangOptions & ExistingLangOpts,
StringRef ModuleFilename,
DiagnosticsEngine * Diags,
bool AllowCompatibleDifferences = true )
static

Compare the given set of language options against an existing set of language options.

Parameters
DiagsIf non-NULL, diagnostics will be emitted via this engine.
AllowCompatibleDifferencesIf true, differences between compatible language options will be permitted.
Returns
true if the languagae options mis-match, false otherwise.

Definition at line 285 of file ASTReader.cpp.

References clang::CommentOptions::BlockCommandNames, clang::SanitizerSet::clear(), clang::LangOptions::CommentOpts, clang::getPPTransparentSanitizers(), clang::SanitizerSet::Mask, clang::LangOptions::ModuleFeatures, clang::LangOptions::ObjCRuntime, clang::DiagnosticsEngine::Report(), and clang::LangOptions::Sanitize.

Referenced by clang::PCHValidator::ReadLanguageOptions().

◆ checkModuleCachePath()

bool checkModuleCachePath ( llvm::vfs::FileSystem & VFS,
StringRef SpecificModuleCachePath,
StringRef ExistingModuleCachePath,
StringRef ModuleFilename,
DiagnosticsEngine * Diags,
const LangOptions & LangOpts,
const PreprocessorOptions & PPOpts )
static

Check that the specified and the existing module cache paths are equivalent.

Parameters
DiagsIf non-null, produce diagnostics for any mismatches incurred.
Returns
true when the module cache paths differ.

Definition at line 945 of file ASTReader.cpp.

References clang::PreprocessorOptions::AllowPCHWithDifferentModulesCachePath, and clang::DiagnosticsEngine::Report().

Referenced by clang::PCHValidator::ReadHeaderSearchOptions().

◆ checkPreprocessorOptions()

bool checkPreprocessorOptions ( const PreprocessorOptions & PPOpts,
const PreprocessorOptions & ExistingPPOpts,
StringRef ModuleFilename,
bool ReadMacros,
DiagnosticsEngine * Diags,
FileManager & FileMgr,
std::string & SuggestedPredefines,
const LangOptions & LangOpts,
OptionValidation Validation = OptionValidateContradictions )
static

Check the preprocessor options deserialized from the control block against the preprocessor options in an existing preprocessor.

Parameters
DiagsIf non-null, produce diagnostics for any mismatches incurred.
ValidationIf set to OptionValidateNone, ignore differences in preprocessor options. If set to OptionValidateContradictions, require that options passed both in the AST file and on the command line (-D or -U) match, but tolerate options missing in one or the other. If set to OptionValidateContradictions, require that there are no differences in the options between the two.

Definition at line 764 of file ASTReader.cpp.

References collectMacroDefinitions(), clang::PreprocessorOptions::DetailedRecord, clang::File, clang::PreprocessorOptions::ImplicitPCHInclude, clang::PreprocessorOptions::Includes, clang::PreprocessorOptions::MacroIncludes, OptionValidateContradictions, OptionValidateNone, OptionValidateStrictMatches, clang::PreprocessorOptions::PCHThroughHeader, clang::DiagnosticsEngine::Report(), and clang::PreprocessorOptions::UsePredefines.

Referenced by clang::PCHValidator::ReadPreprocessorOptions(), and clang::SimpleASTReaderListener::ReadPreprocessorOptions().

◆ checkTargetOptions()

bool checkTargetOptions ( const TargetOptions & TargetOpts,
const TargetOptions & ExistingTargetOpts,
StringRef ModuleFilename,
DiagnosticsEngine * Diags,
bool AllowCompatibleDifferences = true )
static

Compare the given set of target options against an existing set of target options.

Parameters
DiagsIf non-NULL, diagnostics will be emitted via this engine.
Returns
true if the target options mis-match, false otherwise.

Definition at line 463 of file ASTReader.cpp.

References CHECK_TARGET_OPT, Feature, clang::TargetOptions::FeaturesAsWritten, and clang::DiagnosticsEngine::Report().

Referenced by clang::PCHValidator::ReadTargetOptions().

◆ collectMacroDefinitions()

void collectMacroDefinitions ( const PreprocessorOptions & PPOpts,
MacroDefinitionsMap & Macros,
SmallVectorImpl< StringRef > * MacroNames = nullptr )
static

Collect the macro definitions provided by the given preprocessor options.

Definition at line 711 of file ASTReader.cpp.

References clang::Macro, clang::Macros, and clang::PreprocessorOptions::Macros.

Referenced by checkPreprocessorOptions().

◆ doesntStartWithASTFileMagic()

llvm::Error doesntStartWithASTFileMagic ( BitstreamCursor & Stream)
static

Whether Stream doesn't start with the AST file magic number 'CPCH'.

Definition at line 5049 of file ASTReader.cpp.

References clang::C.

Referenced by clang::ASTReader::getOriginalSourceFile(), clang::ASTReader::readASTFileControlBlock(), and readASTFileSignature().

◆ dumpModuleIDMap()

template<typename Key, typename ModuleFile, unsigned InitialCapacity>
LLVM_DUMP_METHOD void dumpModuleIDMap ( StringRef Name,
const ContinuousRangeMap< Key, ModuleFile *, InitialCapacity > & Map )
static

Definition at line 8930 of file ASTReader.cpp.

Referenced by clang::ASTReader::dump().

◆ getIndexForTypeID()

unsigned getIndexForTypeID ( serialization::TypeID ID)
static

Definition at line 7608 of file ASTReader.cpp.

References clang::Qualifiers::FastWidth.

Referenced by clang::ASTReader::GetType().

◆ getModuleFileIndexForTypeID()

unsigned getModuleFileIndexForTypeID ( serialization::TypeID ID)
static

Definition at line 7612 of file ASTReader.cpp.

Referenced by clang::ASTReader::getGlobalTypeID().

◆ getStableHashForModuleName()

unsigned getStableHashForModuleName ( StringRef PrimaryModuleName)
static

Definition at line 13106 of file ASTReader.cpp.

Referenced by clang::getPrimaryModuleHash().

◆ getTopImportImplicitModule()

◆ getTypeClassForCode()

std::optional< Type::TypeClass > getTypeClassForCode ( TypeCode code)
static

Definition at line 7133 of file ASTReader.cpp.

◆ getUnresolvedInputFilenames()

std::pair< StringRef, StringRef > getUnresolvedInputFilenames ( const ASTReader::RecordData & Record,
const StringRef InputBlob )
static

Definition at line 2698 of file ASTReader.cpp.

Referenced by clang::ASTReader::readASTFileControlBlock().

◆ isDiagnosedResult()

◆ isExtHandlingFromDiagsError()

◆ isInterestingIdentifier()

◆ isPredefinedType()

◆ markIdentifierFromAST()

◆ moduleKindForDiagnostic()

◆ moveMethodToBackOfGlobalList()

void moveMethodToBackOfGlobalList ( Sema & S,
ObjCMethodDecl * Method )
static

Move the given method to the back of the global list of methods.

Definition at line 4623 of file ASTReader.cpp.

References clang::Found, clang::ObjCMethodList::getNext(), clang::SemaObjC::MethodPool, and clang::Sema::ObjC().

Referenced by clang::ASTReader::makeNamesVisible().

◆ parseModuleFileExtensionMetadata()

bool parseModuleFileExtensionMetadata ( const SmallVectorImpl< uint64_t > & Record,
StringRef Blob,
ModuleFileExtensionMetadata & Metadata )
static

◆ PassObjCImplDeclToConsumer()

void PassObjCImplDeclToConsumer ( ObjCImplDecl * ImplD,
ASTConsumer * Consumer )
static

Under non-PCH compilation the consumer receives the objc methods before receiving the implementation, and codegen depends on this.

We simulate this by deserializing and passing to consumer the methods of the implementation before passing the deserialized implementation decl.

Definition at line 8798 of file ASTReader.cpp.

References clang::ASTConsumer::HandleInterestingDecl(), and clang::ObjCContainerDecl::methods().

◆ readASTFileSignature()

ASTFileSignature readASTFileSignature ( StringRef PCH)
static

◆ readBit()

bool readBit ( unsigned & Bits)
static

◆ readULEB()

uint64_t readULEB ( const unsigned char *& P)
static

Definition at line 984 of file ASTReader.cpp.

References clang::Error.

Referenced by readULEBKeyDataLength().

◆ readULEBKeyDataLength()

◆ SkipCursorToBlock()

bool SkipCursorToBlock ( BitstreamCursor & Cursor,
unsigned BlockID )
static

Given a cursor at the start of an AST file, scan ahead and drop the cursor into the start of the given block ID, returning false on success and true on failure.

Definition at line 4762 of file ASTReader.cpp.

Referenced by clang::ASTReader::getOriginalSourceFile(), clang::ASTReader::ReadAST(), clang::ASTReader::readASTFileControlBlock(), and readASTFileSignature().