CompoundStmt::Create takes FPOptionsOverride

This commit is contained in:
Jonas Hahnfeld 2023-01-20 11:30:09 +01:00 committed by jenkins
parent d5aec8274b
commit 85c348828f
6 changed files with 31 additions and 10 deletions

View File

@ -43,9 +43,14 @@ namespace cling {
m_HandledDecls.insert(m_FoundDRE->getDecl());
}
}
if (CS->size() != Stmts.size())
return CompoundStmt::Create(m_Sema->getASTContext(), Stmts,
if (CS->size() != Stmts.size()) {
FPOptionsOverride FPFeatures;
if (CS->hasStoredFPFeatures()) {
FPFeatures = CS->getStoredFPFeatures();
}
return CompoundStmt::Create(m_Sema->getASTContext(), Stmts, FPFeatures,
CS->getLBracLoc(), CS->getRBracLoc());
}
return nullptr;
}

View File

@ -210,8 +210,12 @@ namespace cling {
}
// Create a new body.
auto newCS = CompoundStmt::Create(*m_Context, Stmts, CS->getLBracLoc(),
CS->getRBracLoc());
FPOptionsOverride FPFeatures;
if (CS->hasStoredFPFeatures()) {
FPFeatures = CS->getStoredFPFeatures();
}
auto newCS = CompoundStmt::Create(*m_Context, Stmts, FPFeatures,
CS->getLBracLoc(), CS->getRBracLoc());
FD->setBody(newCS);
if (hasNoErrors && !TouchedDecls.empty()) {
@ -268,7 +272,7 @@ namespace cling {
// Wrap Stmts into a function body.
llvm::ArrayRef<Stmt*> StmtsRef(Stmts.data(), Stmts.size());
CompoundStmt* CS = CompoundStmt::Create(*m_Context, StmtsRef, Loc, Loc);
CompoundStmt* CS = CompoundStmt::Create(*m_Context, StmtsRef, {}, Loc, Loc);
FD->setBody(CS);
Emit(FD);

View File

@ -389,7 +389,11 @@ namespace cling {
}
}
auto* NewCS = CompoundStmt::Create(*m_Context, NewChildren,
FPOptionsOverride FPFeatures;
if (Node->hasStoredFPFeatures()) {
FPFeatures = Node->getStoredFPFeatures();
}
auto* NewCS = CompoundStmt::Create(*m_Context, NewChildren, FPFeatures,
Node->getLBracLoc(),
Node->getRBracLoc());

View File

@ -671,7 +671,7 @@ static const char* BuildAndEmitVPWrapperBody(cling::Interpreter &Interp,
return "ERROR in cling's callPrintValue(): cannot build return expression";
auto *Body
= clang::CompoundStmt::Create(Ctx, {RetStmt.get()}, noSrcLoc, noSrcLoc);
= clang::CompoundStmt::Create(Ctx, {RetStmt.get()}, {}, noSrcLoc, noSrcLoc);
WrapperFD->setBody(Body);
auto &Consumer = Interp.getCI()->getASTConsumer();
Consumer.HandleTopLevelDecl(clang::DeclGroupRef(WrapperFD));

View File

@ -180,8 +180,12 @@ namespace cling {
return 0;
if (CS->size() != FBody.size()) {
auto BodyCS = CompoundStmt::Create(*m_Context, FBody, CS->getLBracLoc(),
CS->getRBracLoc());
FPOptionsOverride FPFeatures;
if (CS->hasStoredFPFeatures()) {
FPFeatures = CS->getStoredFPFeatures();
}
auto BodyCS = CompoundStmt::Create(*m_Context, FBody, FPFeatures,
CS->getLBracLoc(), CS->getRBracLoc());
FD->setBody(BodyCS);
}

View File

@ -150,8 +150,12 @@ namespace utils {
newBody.insert(newBody.begin() + indexOfLastExpr, DRE);
// Attach a new body.
FPOptionsOverride FPFeatures;
if (CS->hasStoredFPFeatures()) {
FPFeatures = CS->getStoredFPFeatures();
}
auto newCS = CompoundStmt::Create(S->getASTContext(), newBody,
CS->getLBracLoc(),
FPFeatures, CS->getLBracLoc(),
CS->getRBracLoc());
FD->setBody(newCS);
if (FoundAt)