mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-12 02:47:10 +00:00
[Serialization] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 329851
This commit is contained in:
parent
0cba63c064
commit
e69b33f232
@ -1,4 +1,4 @@
|
||||
//===--- Module.h - Module description --------------------------*- C++ -*-===//
|
||||
//===- Module.h - Module description ----------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -15,42 +15,49 @@
|
||||
#ifndef LLVM_CLANG_SERIALIZATION_MODULE_H
|
||||
#define LLVM_CLANG_SERIALIZATION_MODULE_H
|
||||
|
||||
#include "clang/Basic/FileManager.h"
|
||||
#include "clang/Basic/Module.h"
|
||||
#include "clang/Basic/SourceLocation.h"
|
||||
#include "clang/Serialization/ASTBitCodes.h"
|
||||
#include "clang/Serialization/ContinuousRangeMap.h"
|
||||
#include "clang/Serialization/ModuleFileExtension.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/PointerIntPair.h"
|
||||
#include "llvm/ADT/SetVector.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Bitcode/BitstreamReader.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace llvm {
|
||||
template <typename Info> class OnDiskChainedHashTable;
|
||||
template <typename Info> class OnDiskIterableChainedHashTable;
|
||||
}
|
||||
#include <vector>
|
||||
|
||||
namespace clang {
|
||||
|
||||
class DeclContext;
|
||||
class Module;
|
||||
class FileEntry;
|
||||
|
||||
namespace serialization {
|
||||
|
||||
namespace reader {
|
||||
class ASTDeclContextNameLookupTrait;
|
||||
}
|
||||
|
||||
/// \brief Specifies the kind of module that has been loaded.
|
||||
enum ModuleKind {
|
||||
MK_ImplicitModule, ///< File is an implicitly-loaded module.
|
||||
MK_ExplicitModule, ///< File is an explicitly-loaded module.
|
||||
MK_PCH, ///< File is a PCH file treated as such.
|
||||
MK_Preamble, ///< File is a PCH file treated as the preamble.
|
||||
MK_MainFile, ///< File is a PCH file treated as the actual main file.
|
||||
MK_PrebuiltModule ///< File is from a prebuilt module path.
|
||||
/// File is an implicitly-loaded module.
|
||||
MK_ImplicitModule,
|
||||
|
||||
/// File is an explicitly-loaded module.
|
||||
MK_ExplicitModule,
|
||||
|
||||
/// File is a PCH file treated as such.
|
||||
MK_PCH,
|
||||
|
||||
/// File is a PCH file treated as the preamble.
|
||||
MK_Preamble,
|
||||
|
||||
/// File is a PCH file treated as the actual main file.
|
||||
MK_MainFile,
|
||||
|
||||
/// File is from a prebuilt module path.
|
||||
MK_PrebuiltModule
|
||||
};
|
||||
|
||||
/// \brief The input file that has been loaded from this AST file, along with
|
||||
@ -65,7 +72,8 @@ class InputFile {
|
||||
llvm::PointerIntPair<const FileEntry *, 2, unsigned> Val;
|
||||
|
||||
public:
|
||||
InputFile() {}
|
||||
InputFile() = default;
|
||||
|
||||
InputFile(const FileEntry *File,
|
||||
bool isOverridden = false, bool isOutOfDate = false) {
|
||||
assert(!(isOverridden && isOutOfDate) &&
|
||||
@ -205,6 +213,7 @@ public:
|
||||
StringRef ModuleOffsetMap;
|
||||
|
||||
// === Input Files ===
|
||||
|
||||
/// \brief The cursor to the start of the input-files block.
|
||||
llvm::BitstreamCursor InputFilesCursor;
|
||||
|
||||
@ -347,6 +356,7 @@ public:
|
||||
void *HeaderFileInfoTable = nullptr;
|
||||
|
||||
// === Submodule information ===
|
||||
|
||||
/// \brief The number of submodules in this module.
|
||||
unsigned LocalNumSubmodules = 0;
|
||||
|
||||
@ -470,8 +480,8 @@ public:
|
||||
void dump();
|
||||
};
|
||||
|
||||
} // end namespace serialization
|
||||
} // namespace serialization
|
||||
|
||||
} // end namespace clang
|
||||
} // namespace clang
|
||||
|
||||
#endif
|
||||
#endif // LLVM_CLANG_SERIALIZATION_MODULE_H
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
//===--- ASTReaderStmt.cpp - Stmt/Expr Deserialization ----------*- C++ -*-===//
|
||||
//===- ASTReaderStmt.cpp - Stmt/Expr Deserialization ----------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -14,13 +14,55 @@
|
||||
|
||||
#include "clang/Serialization/ASTReader.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/AttrIterator.h"
|
||||
#include "clang/AST/Decl.h"
|
||||
#include "clang/AST/DeclAccessPair.h"
|
||||
#include "clang/AST/DeclCXX.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/ExprObjC.h"
|
||||
#include "clang/AST/ExprOpenMP.h"
|
||||
#include "clang/AST/NestedNameSpecifier.h"
|
||||
#include "clang/AST/OpenMPClause.h"
|
||||
#include "clang/AST/OperationKinds.h"
|
||||
#include "clang/AST/Stmt.h"
|
||||
#include "clang/AST/StmtCXX.h"
|
||||
#include "clang/AST/StmtObjC.h"
|
||||
#include "clang/AST/StmtOpenMP.h"
|
||||
#include "clang/AST/StmtVisitor.h"
|
||||
#include "clang/AST/TemplateBase.h"
|
||||
#include "clang/AST/Type.h"
|
||||
#include "clang/AST/UnresolvedSet.h"
|
||||
#include "clang/Basic/CapturedStmt.h"
|
||||
#include "clang/Basic/ExpressionTraits.h"
|
||||
#include "clang/Basic/LLVM.h"
|
||||
#include "clang/Basic/Lambda.h"
|
||||
#include "clang/Basic/LangOptions.h"
|
||||
#include "clang/Basic/OpenMPKinds.h"
|
||||
#include "clang/Basic/OperatorKinds.h"
|
||||
#include "clang/Basic/SourceLocation.h"
|
||||
#include "clang/Basic/Specifiers.h"
|
||||
#include "clang/Basic/TypeTraits.h"
|
||||
#include "clang/Lex/Token.h"
|
||||
#include "clang/Serialization/ASTBitCodes.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Bitcode/BitstreamReader.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
using namespace clang;
|
||||
using namespace clang::serialization;
|
||||
using namespace serialization;
|
||||
|
||||
namespace clang {
|
||||
|
||||
@ -80,6 +122,7 @@ namespace clang {
|
||||
void ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args,
|
||||
TemplateArgumentLoc *ArgsLocArray,
|
||||
unsigned NumTemplateArgs);
|
||||
|
||||
/// \brief Read and initialize a ExplicitTemplateArgumentList structure.
|
||||
void ReadExplicitTemplateArgumentList(ASTTemplateArgumentListInfo &ArgList,
|
||||
unsigned NumTemplateArgs);
|
||||
@ -89,7 +132,8 @@ namespace clang {
|
||||
void Visit##Type(Type *);
|
||||
#include "clang/AST/StmtNodes.inc"
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace clang
|
||||
|
||||
void ASTStmtReader::ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args,
|
||||
TemplateArgumentLoc *ArgsLocArray,
|
||||
@ -146,7 +190,7 @@ void ASTStmtReader::VisitDefaultStmt(DefaultStmt *S) {
|
||||
|
||||
void ASTStmtReader::VisitLabelStmt(LabelStmt *S) {
|
||||
VisitStmt(S);
|
||||
LabelDecl *LD = ReadDeclAs<LabelDecl>();
|
||||
auto *LD = ReadDeclAs<LabelDecl>();
|
||||
LD->setStmt(S);
|
||||
S->setDecl(LD);
|
||||
S->setSubStmt(Record.readSubStmt());
|
||||
@ -508,8 +552,7 @@ void ASTStmtReader::VisitStringLiteral(StringLiteral *E) {
|
||||
assert(Record.peekInt() == E->getNumConcatenated() &&
|
||||
"Wrong number of concatenated tokens!");
|
||||
Record.skipInts(1);
|
||||
StringLiteral::StringKind kind =
|
||||
static_cast<StringLiteral::StringKind>(Record.readInt());
|
||||
auto kind = static_cast<StringLiteral::StringKind>(Record.readInt());
|
||||
bool isPascal = Record.readInt();
|
||||
|
||||
// Read string data
|
||||
@ -550,13 +593,13 @@ void ASTStmtReader::VisitParenListExpr(ParenListExpr *E) {
|
||||
|
||||
void ASTStmtReader::VisitUnaryOperator(UnaryOperator *E) {
|
||||
VisitExpr(E);
|
||||
E->setSubExpr(Record.readSubExpr());
|
||||
E->setOpcode((UnaryOperator::Opcode)Record.readInt());
|
||||
E->setOperatorLoc(ReadSourceLocation());
|
||||
E->setCanOverflow(Record.readInt());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) {
|
||||
E->setSubExpr(Record.readSubExpr());
|
||||
E->setOpcode((UnaryOperator::Opcode)Record.readInt());
|
||||
E->setOperatorLoc(ReadSourceLocation());
|
||||
E->setCanOverflow(Record.readInt());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) {
|
||||
VisitExpr(E);
|
||||
assert(E->getNumComponents() == Record.peekInt());
|
||||
Record.skipInts(1);
|
||||
@ -566,7 +609,7 @@ void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) {
|
||||
E->setRParenLoc(ReadSourceLocation());
|
||||
E->setTypeSourceInfo(GetTypeSourceInfo());
|
||||
for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
|
||||
OffsetOfNode::Kind Kind = static_cast<OffsetOfNode::Kind>(Record.readInt());
|
||||
auto Kind = static_cast<OffsetOfNode::Kind>(Record.readInt());
|
||||
SourceLocation Start = ReadSourceLocation();
|
||||
SourceLocation End = ReadSourceLocation();
|
||||
switch (Kind) {
|
||||
@ -586,7 +629,7 @@ void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) {
|
||||
break;
|
||||
|
||||
case OffsetOfNode::Base: {
|
||||
CXXBaseSpecifier *Base = new (Record.getContext()) CXXBaseSpecifier();
|
||||
auto *Base = new (Record.getContext()) CXXBaseSpecifier();
|
||||
*Base = Record.readCXXBaseSpecifier();
|
||||
E->setComponent(I, OffsetOfNode(Base));
|
||||
break;
|
||||
@ -676,7 +719,7 @@ void ASTStmtReader::VisitCastExpr(CastExpr *E) {
|
||||
E->setCastKind((CastKind)Record.readInt());
|
||||
CastExpr::path_iterator BaseI = E->path_begin();
|
||||
while (NumBaseSpecs--) {
|
||||
CXXBaseSpecifier *BaseSpec = new (Record.getContext()) CXXBaseSpecifier;
|
||||
auto *BaseSpec = new (Record.getContext()) CXXBaseSpecifier;
|
||||
*BaseSpec = Record.readCXXBaseSpecifier();
|
||||
*BaseI++ = BaseSpec;
|
||||
}
|
||||
@ -750,7 +793,7 @@ void ASTStmtReader::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
|
||||
|
||||
void ASTStmtReader::VisitInitListExpr(InitListExpr *E) {
|
||||
VisitExpr(E);
|
||||
if (InitListExpr *SyntForm = cast_or_null<InitListExpr>(Record.readSubStmt()))
|
||||
if (auto *SyntForm = cast_or_null<InitListExpr>(Record.readSubStmt()))
|
||||
E->setSyntacticForm(SyntForm);
|
||||
E->setLBraceLoc(ReadSourceLocation());
|
||||
E->setRBraceLoc(ReadSourceLocation());
|
||||
@ -776,7 +819,7 @@ void ASTStmtReader::VisitInitListExpr(InitListExpr *E) {
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
|
||||
typedef DesignatedInitExpr::Designator Designator;
|
||||
using Designator = DesignatedInitExpr::Designator;
|
||||
|
||||
VisitExpr(E);
|
||||
unsigned NumSubExprs = Record.readInt();
|
||||
@ -790,7 +833,7 @@ void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
|
||||
while (Record.getIdx() < Record.size()) {
|
||||
switch ((DesignatorTypes)Record.readInt()) {
|
||||
case DESIG_FIELD_DECL: {
|
||||
FieldDecl *Field = ReadDeclAs<FieldDecl>();
|
||||
auto *Field = ReadDeclAs<FieldDecl>();
|
||||
SourceLocation DotLoc = ReadSourceLocation();
|
||||
SourceLocation FieldLoc = ReadSourceLocation();
|
||||
Designators.push_back(Designator(Field->getIdentifier(), DotLoc,
|
||||
@ -995,9 +1038,9 @@ void ASTStmtReader::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
|
||||
assert(NumElements == E->getNumElements() && "Wrong number of elements");
|
||||
bool HasPackExpansions = Record.readInt();
|
||||
assert(HasPackExpansions == E->HasPackExpansions &&"Pack expansion mismatch");
|
||||
ObjCDictionaryLiteral::KeyValuePair *KeyValues =
|
||||
auto *KeyValues =
|
||||
E->getTrailingObjects<ObjCDictionaryLiteral::KeyValuePair>();
|
||||
ObjCDictionaryLiteral::ExpansionData *Expansions =
|
||||
auto *Expansions =
|
||||
E->getTrailingObjects<ObjCDictionaryLiteral::ExpansionData>();
|
||||
for (unsigned I = 0; I != NumElements; ++I) {
|
||||
KeyValues[I].Key = Record.readSubExpr();
|
||||
@ -1048,8 +1091,8 @@ void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
|
||||
unsigned MethodRefFlags = Record.readInt();
|
||||
bool Implicit = Record.readInt() != 0;
|
||||
if (Implicit) {
|
||||
ObjCMethodDecl *Getter = ReadDeclAs<ObjCMethodDecl>();
|
||||
ObjCMethodDecl *Setter = ReadDeclAs<ObjCMethodDecl>();
|
||||
auto *Getter = ReadDeclAs<ObjCMethodDecl>();
|
||||
auto *Setter = ReadDeclAs<ObjCMethodDecl>();
|
||||
E->setImplicitProperty(Getter, Setter, MethodRefFlags);
|
||||
} else {
|
||||
E->setExplicitProperty(ReadDeclAs<ObjCPropertyDecl>(), MethodRefFlags);
|
||||
@ -1086,8 +1129,7 @@ void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) {
|
||||
E->SelLocsKind = Record.readInt();
|
||||
E->setDelegateInitCall(Record.readInt());
|
||||
E->IsImplicit = Record.readInt();
|
||||
ObjCMessageExpr::ReceiverKind Kind
|
||||
= static_cast<ObjCMessageExpr::ReceiverKind>(Record.readInt());
|
||||
auto Kind = static_cast<ObjCMessageExpr::ReceiverKind>(Record.readInt());
|
||||
switch (Kind) {
|
||||
case ObjCMessageExpr::Instance:
|
||||
E->setInstanceReceiver(Record.readSubExpr());
|
||||
@ -1521,8 +1563,8 @@ void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) {
|
||||
unsigned NumDecls = Record.readInt();
|
||||
UnresolvedSet<8> Decls;
|
||||
for (unsigned i = 0; i != NumDecls; ++i) {
|
||||
NamedDecl *D = ReadDeclAs<NamedDecl>();
|
||||
AccessSpecifier AS = (AccessSpecifier)Record.readInt();
|
||||
auto *D = ReadDeclAs<NamedDecl>();
|
||||
auto AS = (AccessSpecifier)Record.readInt();
|
||||
Decls.addDecl(D, AS);
|
||||
}
|
||||
E->initializeResults(Record.getContext(), Decls.begin(), Decls.end());
|
||||
@ -1556,7 +1598,7 @@ void ASTStmtReader::VisitTypeTraitExpr(TypeTraitExpr *E) {
|
||||
E->Loc = Range.getBegin();
|
||||
E->RParenLoc = Range.getEnd();
|
||||
|
||||
TypeSourceInfo **Args = E->getTrailingObjects<TypeSourceInfo *>();
|
||||
auto **Args = E->getTrailingObjects<TypeSourceInfo *>();
|
||||
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
|
||||
Args[I] = GetTypeSourceInfo();
|
||||
}
|
||||
@ -1640,7 +1682,7 @@ void ASTStmtReader::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
|
||||
E->NumParameters = Record.readInt();
|
||||
E->ParamPack = ReadDeclAs<ParmVarDecl>();
|
||||
E->NameLoc = ReadSourceLocation();
|
||||
ParmVarDecl **Parms = E->getTrailingObjects<ParmVarDecl *>();
|
||||
auto **Parms = E->getTrailingObjects<ParmVarDecl *>();
|
||||
for (unsigned i = 0, n = E->NumParameters; i != n; ++i)
|
||||
Parms[i] = ReadDeclAs<ParmVarDecl>();
|
||||
}
|
||||
@ -1648,7 +1690,7 @@ void ASTStmtReader::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
|
||||
void ASTStmtReader::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
|
||||
VisitExpr(E);
|
||||
E->State = Record.readSubExpr();
|
||||
auto VD = ReadDeclAs<ValueDecl>();
|
||||
auto *VD = ReadDeclAs<ValueDecl>();
|
||||
unsigned ManglingNumber = Record.readInt();
|
||||
E->setExtendingDecl(VD, ManglingNumber);
|
||||
}
|
||||
@ -1758,19 +1800,23 @@ void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr *E) {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace clang {
|
||||
|
||||
class OMPClauseReader : public OMPClauseVisitor<OMPClauseReader> {
|
||||
ASTStmtReader *Reader;
|
||||
ASTContext &Context;
|
||||
|
||||
public:
|
||||
OMPClauseReader(ASTStmtReader *R, ASTRecordReader &Record)
|
||||
: Reader(R), Context(Record.getContext()) {}
|
||||
|
||||
#define OPENMP_CLAUSE(Name, Class) void Visit##Class(Class *C);
|
||||
#include "clang/Basic/OpenMPKinds.def"
|
||||
OMPClause *readClause();
|
||||
void VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C);
|
||||
void VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C);
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace clang
|
||||
|
||||
OMPClause *OMPClauseReader::readClause() {
|
||||
OMPClause *C;
|
||||
@ -2395,7 +2441,7 @@ void OMPClauseReader::VisitOMPMapClause(OMPMapClause *C) {
|
||||
Components.reserve(TotalComponents);
|
||||
for (unsigned i = 0; i < TotalComponents; ++i) {
|
||||
Expr *AssociatedExpr = Reader->Record.readSubExpr();
|
||||
ValueDecl *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>();
|
||||
auto *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>();
|
||||
Components.push_back(OMPClauseMappableExprCommon::MappableComponent(
|
||||
AssociatedExpr, AssociatedDecl));
|
||||
}
|
||||
@ -2489,7 +2535,7 @@ void OMPClauseReader::VisitOMPToClause(OMPToClause *C) {
|
||||
Components.reserve(TotalComponents);
|
||||
for (unsigned i = 0; i < TotalComponents; ++i) {
|
||||
Expr *AssociatedExpr = Reader->Record.readSubExpr();
|
||||
ValueDecl *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>();
|
||||
auto *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>();
|
||||
Components.push_back(OMPClauseMappableExprCommon::MappableComponent(
|
||||
AssociatedExpr, AssociatedDecl));
|
||||
}
|
||||
@ -2531,7 +2577,7 @@ void OMPClauseReader::VisitOMPFromClause(OMPFromClause *C) {
|
||||
Components.reserve(TotalComponents);
|
||||
for (unsigned i = 0; i < TotalComponents; ++i) {
|
||||
Expr *AssociatedExpr = Reader->Record.readSubExpr();
|
||||
ValueDecl *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>();
|
||||
auto *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>();
|
||||
Components.push_back(OMPClauseMappableExprCommon::MappableComponent(
|
||||
AssociatedExpr, AssociatedDecl));
|
||||
}
|
||||
@ -2581,7 +2627,7 @@ void OMPClauseReader::VisitOMPUseDevicePtrClause(OMPUseDevicePtrClause *C) {
|
||||
Components.reserve(TotalComponents);
|
||||
for (unsigned i = 0; i < TotalComponents; ++i) {
|
||||
Expr *AssociatedExpr = Reader->Record.readSubExpr();
|
||||
ValueDecl *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>();
|
||||
auto *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>();
|
||||
Components.push_back(OMPClauseMappableExprCommon::MappableComponent(
|
||||
AssociatedExpr, AssociatedDecl));
|
||||
}
|
||||
@ -2624,7 +2670,7 @@ void OMPClauseReader::VisitOMPIsDevicePtrClause(OMPIsDevicePtrClause *C) {
|
||||
Components.reserve(TotalComponents);
|
||||
for (unsigned i = 0; i < TotalComponents; ++i) {
|
||||
Expr *AssociatedExpr = Reader->Record.readSubExpr();
|
||||
ValueDecl *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>();
|
||||
auto *AssociatedDecl = Reader->Record.readDeclAs<ValueDecl>();
|
||||
Components.push_back(OMPClauseMappableExprCommon::MappableComponent(
|
||||
AssociatedExpr, AssociatedDecl));
|
||||
}
|
||||
@ -2634,6 +2680,7 @@ void OMPClauseReader::VisitOMPIsDevicePtrClause(OMPIsDevicePtrClause *C) {
|
||||
//===----------------------------------------------------------------------===//
|
||||
// OpenMP Directives.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void ASTStmtReader::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
|
||||
E->setLocStart(ReadSourceLocation());
|
||||
E->setLocEnd(ReadSourceLocation());
|
||||
@ -2919,6 +2966,7 @@ void ASTStmtReader::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPDistributeParallelForDirective(
|
||||
OMPDistributeParallelForDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
@ -3027,7 +3075,6 @@ Expr *ASTReader::ReadSubExpr() {
|
||||
// stack. Evaluation terminates when we see a STMT_STOP record, and
|
||||
// the single remaining expression on the stack is our result.
|
||||
Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
|
||||
|
||||
ReadingKindTracker ReadingKind(Read_Stmt, *this);
|
||||
llvm::BitstreamCursor &Cursor = F.DeclsCursor;
|
||||
|
||||
@ -3256,15 +3303,15 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
|
||||
|
||||
bool HadMultipleCandidates = Record.readInt();
|
||||
|
||||
NamedDecl *FoundD = Record.readDeclAs<NamedDecl>();
|
||||
AccessSpecifier AS = (AccessSpecifier)Record.readInt();
|
||||
auto *FoundD = Record.readDeclAs<NamedDecl>();
|
||||
auto AS = (AccessSpecifier)Record.readInt();
|
||||
DeclAccessPair FoundDecl = DeclAccessPair::make(FoundD, AS);
|
||||
|
||||
QualType T = Record.readType();
|
||||
ExprValueKind VK = static_cast<ExprValueKind>(Record.readInt());
|
||||
ExprObjectKind OK = static_cast<ExprObjectKind>(Record.readInt());
|
||||
auto VK = static_cast<ExprValueKind>(Record.readInt());
|
||||
auto OK = static_cast<ExprObjectKind>(Record.readInt());
|
||||
Expr *Base = ReadSubExpr();
|
||||
ValueDecl *MemberD = Record.readDeclAs<ValueDecl>();
|
||||
auto *MemberD = Record.readDeclAs<ValueDecl>();
|
||||
SourceLocation MemberLoc = Record.readSourceLocation();
|
||||
DeclarationNameInfo MemberNameInfo(MemberD->getDeclName(), MemberLoc);
|
||||
bool IsArrow = Record.readInt();
|
||||
@ -3384,93 +3431,121 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
|
||||
case EXPR_OBJC_STRING_LITERAL:
|
||||
S = new (Context) ObjCStringLiteral(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_OBJC_BOXED_EXPRESSION:
|
||||
S = new (Context) ObjCBoxedExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_OBJC_ARRAY_LITERAL:
|
||||
S = ObjCArrayLiteral::CreateEmpty(Context,
|
||||
Record[ASTStmtReader::NumExprFields]);
|
||||
break;
|
||||
|
||||
case EXPR_OBJC_DICTIONARY_LITERAL:
|
||||
S = ObjCDictionaryLiteral::CreateEmpty(Context,
|
||||
Record[ASTStmtReader::NumExprFields],
|
||||
Record[ASTStmtReader::NumExprFields + 1]);
|
||||
break;
|
||||
|
||||
case EXPR_OBJC_ENCODE:
|
||||
S = new (Context) ObjCEncodeExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_OBJC_SELECTOR_EXPR:
|
||||
S = new (Context) ObjCSelectorExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_OBJC_PROTOCOL_EXPR:
|
||||
S = new (Context) ObjCProtocolExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_OBJC_IVAR_REF_EXPR:
|
||||
S = new (Context) ObjCIvarRefExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_OBJC_PROPERTY_REF_EXPR:
|
||||
S = new (Context) ObjCPropertyRefExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_OBJC_SUBSCRIPT_REF_EXPR:
|
||||
S = new (Context) ObjCSubscriptRefExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_OBJC_KVC_REF_EXPR:
|
||||
llvm_unreachable("mismatching AST file");
|
||||
|
||||
case EXPR_OBJC_MESSAGE_EXPR:
|
||||
S = ObjCMessageExpr::CreateEmpty(Context,
|
||||
Record[ASTStmtReader::NumExprFields],
|
||||
Record[ASTStmtReader::NumExprFields + 1]);
|
||||
break;
|
||||
|
||||
case EXPR_OBJC_ISA:
|
||||
S = new (Context) ObjCIsaExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_OBJC_INDIRECT_COPY_RESTORE:
|
||||
S = new (Context) ObjCIndirectCopyRestoreExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_OBJC_BRIDGED_CAST:
|
||||
S = new (Context) ObjCBridgedCastExpr(Empty);
|
||||
break;
|
||||
|
||||
case STMT_OBJC_FOR_COLLECTION:
|
||||
S = new (Context) ObjCForCollectionStmt(Empty);
|
||||
break;
|
||||
|
||||
case STMT_OBJC_CATCH:
|
||||
S = new (Context) ObjCAtCatchStmt(Empty);
|
||||
break;
|
||||
|
||||
case STMT_OBJC_FINALLY:
|
||||
S = new (Context) ObjCAtFinallyStmt(Empty);
|
||||
break;
|
||||
|
||||
case STMT_OBJC_AT_TRY:
|
||||
S = ObjCAtTryStmt::CreateEmpty(Context,
|
||||
Record[ASTStmtReader::NumStmtFields],
|
||||
Record[ASTStmtReader::NumStmtFields + 1]);
|
||||
break;
|
||||
|
||||
case STMT_OBJC_AT_SYNCHRONIZED:
|
||||
S = new (Context) ObjCAtSynchronizedStmt(Empty);
|
||||
break;
|
||||
|
||||
case STMT_OBJC_AT_THROW:
|
||||
S = new (Context) ObjCAtThrowStmt(Empty);
|
||||
break;
|
||||
|
||||
case STMT_OBJC_AUTORELEASE_POOL:
|
||||
S = new (Context) ObjCAutoreleasePoolStmt(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_OBJC_BOOL_LITERAL:
|
||||
S = new (Context) ObjCBoolLiteralExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_OBJC_AVAILABILITY_CHECK:
|
||||
S = new (Context) ObjCAvailabilityCheckExpr(Empty);
|
||||
break;
|
||||
|
||||
case STMT_SEH_LEAVE:
|
||||
S = new (Context) SEHLeaveStmt(Empty);
|
||||
break;
|
||||
|
||||
case STMT_SEH_EXCEPT:
|
||||
S = new (Context) SEHExceptStmt(Empty);
|
||||
break;
|
||||
|
||||
case STMT_SEH_FINALLY:
|
||||
S = new (Context) SEHFinallyStmt(Empty);
|
||||
break;
|
||||
|
||||
case STMT_SEH_TRY:
|
||||
S = new (Context) SEHTryStmt(Empty);
|
||||
break;
|
||||
|
||||
case STMT_CXX_CATCH:
|
||||
S = new (Context) CXXCatchStmt(Empty);
|
||||
break;
|
||||
@ -3752,11 +3827,10 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_TARGET_TEAMS_DIRECTIVE: {
|
||||
case STMT_OMP_TARGET_TEAMS_DIRECTIVE:
|
||||
S = OMPTargetTeamsDirective::CreateEmpty(
|
||||
Context, Record[ASTStmtReader::NumStmtFields], Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE: {
|
||||
auto NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
@ -3849,36 +3923,47 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
|
||||
case EXPR_CXX_NULL_PTR_LITERAL:
|
||||
S = new (Context) CXXNullPtrLiteralExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_CXX_TYPEID_EXPR:
|
||||
S = new (Context) CXXTypeidExpr(Empty, true);
|
||||
break;
|
||||
|
||||
case EXPR_CXX_TYPEID_TYPE:
|
||||
S = new (Context) CXXTypeidExpr(Empty, false);
|
||||
break;
|
||||
|
||||
case EXPR_CXX_UUIDOF_EXPR:
|
||||
S = new (Context) CXXUuidofExpr(Empty, true);
|
||||
break;
|
||||
|
||||
case EXPR_CXX_PROPERTY_REF_EXPR:
|
||||
S = new (Context) MSPropertyRefExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR:
|
||||
S = new (Context) MSPropertySubscriptExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_CXX_UUIDOF_TYPE:
|
||||
S = new (Context) CXXUuidofExpr(Empty, false);
|
||||
break;
|
||||
|
||||
case EXPR_CXX_THIS:
|
||||
S = new (Context) CXXThisExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_CXX_THROW:
|
||||
S = new (Context) CXXThrowExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_CXX_DEFAULT_ARG:
|
||||
S = new (Context) CXXDefaultArgExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_CXX_DEFAULT_INIT:
|
||||
S = new (Context) CXXDefaultInitExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_CXX_BIND_TEMPORARY:
|
||||
S = new (Context) CXXBindTemporaryExpr(Empty);
|
||||
break;
|
||||
@ -3886,12 +3971,15 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
|
||||
case EXPR_CXX_SCALAR_VALUE_INIT:
|
||||
S = new (Context) CXXScalarValueInitExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_CXX_NEW:
|
||||
S = new (Context) CXXNewExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_CXX_DELETE:
|
||||
S = new (Context) CXXDeleteExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_CXX_PSEUDO_DESTRUCTOR:
|
||||
S = new (Context) CXXPseudoDestructorExpr(Empty);
|
||||
break;
|
||||
@ -4035,7 +4123,6 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
|
||||
case EXPR_DEPENDENT_COAWAIT:
|
||||
S = new (Context) DependentCoawaitExpr(Empty);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
// We hit a STMT_STOP, so we're done with this expression.
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===--- Module.cpp - Module description ------------------------*- C++ -*-===//
|
||||
//===- Module.cpp - Module description ------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -11,8 +11,12 @@
|
||||
// been loaded from an AST file.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/Serialization/Module.h"
|
||||
#include "ASTReaderInternals.h"
|
||||
#include "clang/Serialization/ContinuousRangeMap.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
||||
using namespace clang;
|
||||
@ -32,7 +36,8 @@ dumpLocalRemap(StringRef Name,
|
||||
if (Map.begin() == Map.end())
|
||||
return;
|
||||
|
||||
typedef ContinuousRangeMap<Key, Offset, InitialCapacity> MapType;
|
||||
using MapType = ContinuousRangeMap<Key, Offset, InitialCapacity>;
|
||||
|
||||
llvm::errs() << " " << Name << ":\n";
|
||||
for (typename MapType::const_iterator I = Map.begin(), IEnd = Map.end();
|
||||
I != IEnd; ++I) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user