aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/lib/Serialization/ASTReaderStmt.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-09-02 21:17:18 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-12-08 17:34:50 +0000
commit06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e (patch)
tree62f873df87c7c675557a179e0c4c83fe9f3087bc /contrib/llvm-project/clang/lib/Serialization/ASTReaderStmt.cpp
parentcf037972ea8863e2bab7461d77345367d2c1e054 (diff)
parent7fa27ce4a07f19b07799a767fc29416f3b625afb (diff)
downloadsrc-06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e.tar.gz
src-06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e.zip
Diffstat (limited to 'contrib/llvm-project/clang/lib/Serialization/ASTReaderStmt.cpp')
-rw-r--r--contrib/llvm-project/clang/lib/Serialization/ASTReaderStmt.cpp58
1 files changed, 33 insertions, 25 deletions
diff --git a/contrib/llvm-project/clang/lib/Serialization/ASTReaderStmt.cpp b/contrib/llvm-project/clang/lib/Serialization/ASTReaderStmt.cpp
index 46d653c7f940..96307c35ad32 100644
--- a/contrib/llvm-project/clang/lib/Serialization/ASTReaderStmt.cpp
+++ b/contrib/llvm-project/clang/lib/Serialization/ASTReaderStmt.cpp
@@ -115,10 +115,6 @@ namespace clang {
TemplateArgumentLoc *ArgsLocArray,
unsigned NumTemplateArgs);
- /// Read and initialize a ExplicitTemplateArgumentList structure.
- void ReadExplicitTemplateArgumentList(ASTTemplateArgumentListInfo &ArgList,
- unsigned NumTemplateArgs);
-
void VisitStmt(Stmt *S);
#define STMT(Type, Base) \
void Visit##Type(Type *);
@@ -228,7 +224,7 @@ void ASTStmtReader::VisitIfStmt(IfStmt *S) {
if (HasElse)
S->setElse(Record.readSubStmt());
if (HasVar)
- S->setConditionVariable(Record.getContext(), readDeclAs<VarDecl>());
+ S->setConditionVariableDeclStmt(cast<DeclStmt>(Record.readSubStmt()));
if (HasInit)
S->setInit(Record.readSubStmt());
@@ -253,7 +249,7 @@ void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) {
if (HasInit)
S->setInit(Record.readSubStmt());
if (HasVar)
- S->setConditionVariable(Record.getContext(), readDeclAs<VarDecl>());
+ S->setConditionVariableDeclStmt(cast<DeclStmt>(Record.readSubStmt()));
S->setSwitchLoc(readSourceLocation());
S->setLParenLoc(readSourceLocation());
@@ -279,7 +275,7 @@ void ASTStmtReader::VisitWhileStmt(WhileStmt *S) {
S->setCond(Record.readSubExpr());
S->setBody(Record.readSubStmt());
if (HasVar)
- S->setConditionVariable(Record.getContext(), readDeclAs<VarDecl>());
+ S->setConditionVariableDeclStmt(cast<DeclStmt>(Record.readSubStmt()));
S->setWhileLoc(readSourceLocation());
S->setLParenLoc(readSourceLocation());
@@ -299,7 +295,7 @@ void ASTStmtReader::VisitForStmt(ForStmt *S) {
VisitStmt(S);
S->setInit(Record.readSubStmt());
S->setCond(Record.readSubExpr());
- S->setConditionVariable(Record.getContext(), readDeclAs<VarDecl>());
+ S->setConditionVariableDeclStmt(cast_or_null<DeclStmt>(Record.readSubStmt()));
S->setInc(Record.readSubExpr());
S->setBody(Record.readSubStmt());
S->setForLoc(readSourceLocation());
@@ -400,8 +396,10 @@ void ASTStmtReader::VisitGCCAsmStmt(GCCAsmStmt *S) {
Clobbers.push_back(cast_or_null<StringLiteral>(Record.readSubStmt()));
// Labels
- for (unsigned I = 0, N = NumLabels; I != N; ++I)
+ for (unsigned I = 0, N = NumLabels; I != N; ++I) {
+ Names.push_back(Record.readIdentifier());
Exprs.push_back(Record.readSubStmt());
+ }
S->setOutputsAndInputsAndClobbers(Record.getContext(),
Names.data(), Constraints.data(),
@@ -582,6 +580,7 @@ void ASTStmtReader::VisitPredefinedExpr(PredefinedExpr *E) {
bool HasFunctionName = Record.readInt();
E->PredefinedExprBits.HasFunctionName = HasFunctionName;
E->PredefinedExprBits.Kind = Record.readInt();
+ E->PredefinedExprBits.IsTransparent = Record.readInt();
E->setLocation(readSourceLocation());
if (HasFunctionName)
E->setFunctionName(cast<StringLiteral>(Record.readSubExpr()));
@@ -596,6 +595,7 @@ void ASTStmtReader::VisitDeclRefExpr(DeclRefExpr *E) {
E->DeclRefExprBits.HadMultipleCandidates = Record.readInt();
E->DeclRefExprBits.RefersToEnclosingVariableOrCapture = Record.readInt();
E->DeclRefExprBits.NonOdrUseReason = Record.readInt();
+ E->DeclRefExprBits.IsImmediateEscalating = Record.readInt();
unsigned NumTemplateArgs = 0;
if (E->hasTemplateKWAndArgsInfo())
NumTemplateArgs = Record.readInt();
@@ -1216,9 +1216,9 @@ void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
auto *Field = readDeclAs<FieldDecl>();
SourceLocation DotLoc = readSourceLocation();
SourceLocation FieldLoc = readSourceLocation();
- Designators.push_back(Designator(Field->getIdentifier(), DotLoc,
- FieldLoc));
- Designators.back().setField(Field);
+ Designators.push_back(Designator::CreateFieldDesignator(
+ Field->getIdentifier(), DotLoc, FieldLoc));
+ Designators.back().setFieldDecl(Field);
break;
}
@@ -1226,7 +1226,8 @@ void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
const IdentifierInfo *Name = Record.readIdentifier();
SourceLocation DotLoc = readSourceLocation();
SourceLocation FieldLoc = readSourceLocation();
- Designators.push_back(Designator(Name, DotLoc, FieldLoc));
+ Designators.push_back(Designator::CreateFieldDesignator(Name, DotLoc,
+ FieldLoc));
break;
}
@@ -1234,7 +1235,9 @@ void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
unsigned Index = Record.readInt();
SourceLocation LBracketLoc = readSourceLocation();
SourceLocation RBracketLoc = readSourceLocation();
- Designators.push_back(Designator(Index, LBracketLoc, RBracketLoc));
+ Designators.push_back(Designator::CreateArrayDesignator(Index,
+ LBracketLoc,
+ RBracketLoc));
break;
}
@@ -1243,8 +1246,8 @@ void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
SourceLocation LBracketLoc = readSourceLocation();
SourceLocation EllipsisLoc = readSourceLocation();
SourceLocation RBracketLoc = readSourceLocation();
- Designators.push_back(Designator(Index, LBracketLoc, EllipsisLoc,
- RBracketLoc));
+ Designators.push_back(Designator::CreateArrayRangeDesignator(
+ Index, LBracketLoc, EllipsisLoc, RBracketLoc));
break;
}
}
@@ -1354,6 +1357,7 @@ void ASTStmtReader::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
unsigned NumAssocs = Record.readInt();
assert(NumAssocs == E->getNumAssocs() && "Wrong NumAssocs!");
+ E->IsExprPredicate = Record.readInt();
E->ResultIndex = Record.readInt();
E->GenericSelectionExprBits.GenericLoc = readSourceLocation();
E->DefaultLoc = readSourceLocation();
@@ -1700,6 +1704,7 @@ void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) {
E->CXXConstructExprBits.StdInitListInitialization = Record.readInt();
E->CXXConstructExprBits.ZeroInitialization = Record.readInt();
E->CXXConstructExprBits.ConstructionKind = Record.readInt();
+ E->CXXConstructExprBits.IsImmediateEscalating = Record.readInt();
E->CXXConstructExprBits.Loc = readSourceLocation();
E->Constructor = readDeclAs<CXXConstructorDecl>();
E->ParenOrBraceRange = readSourceRange();
@@ -2003,9 +2008,10 @@ ASTStmtReader::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
Record.skipInts(1);
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
E->setArg(I, Record.readSubExpr());
- E->TSI = readTypeSourceInfo();
+ E->TypeAndInitForm.setPointer(readTypeSourceInfo());
E->setLParenLoc(readSourceLocation());
E->setRParenLoc(readSourceLocation());
+ E->TypeAndInitForm.setInt(Record.readInt());
}
void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) {
@@ -2805,7 +2811,7 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
case STMT_REF_PTR:
IsStmtReference = true;
- assert(StmtEntries.find(Record[0]) != StmtEntries.end() &&
+ assert(StmtEntries.contains(Record[0]) &&
"No stmt was recorded for this offset reference!");
S = StmtEntries[Record.readInt()];
break;
@@ -2929,12 +2935,14 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
case EXPR_DECL_REF:
S = DeclRefExpr::CreateEmpty(
- Context,
- /*HasQualifier=*/Record[ASTStmtReader::NumExprFields],
- /*HasFoundDecl=*/Record[ASTStmtReader::NumExprFields + 1],
- /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields + 2],
- /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields + 2] ?
- Record[ASTStmtReader::NumExprFields + 6] : 0);
+ Context,
+ /*HasQualifier=*/Record[ASTStmtReader::NumExprFields],
+ /*HasFoundDecl=*/Record[ASTStmtReader::NumExprFields + 1],
+ /*HasTemplateKWAndArgsInfo=*/Record[ASTStmtReader::NumExprFields + 2],
+ /*NumTemplateArgs=*/
+ Record[ASTStmtReader::NumExprFields + 2]
+ ? Record[ASTStmtReader::NumExprFields + 7]
+ : 0);
break;
case EXPR_INTEGER_LITERAL:
@@ -3519,7 +3527,7 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
CollapsedNum, Empty);
break;
}
-
+
case STMT_OMP_MASKED_TASKLOOP_DIRECTIVE: {
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];