Skip to content

Commit a9731df

Browse files
authored
[clang][bytecode][NFC] Avoid a getSource() call (#117311)
This is only needed when we actually emit a diagnostic, so move the getSource() after the early return.
1 parent 11ee216 commit a9731df

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1481,11 +1481,12 @@ bool CheckNewTypeMismatch(InterpState &S, CodePtr OpPC, const Expr *E,
14811481

14821482
bool InvalidNewDeleteExpr(InterpState &S, CodePtr OpPC, const Expr *E) {
14831483
assert(E);
1484-
const auto &Loc = S.Current->getSource(OpPC);
14851484

14861485
if (S.getLangOpts().CPlusPlus26)
14871486
return true;
14881487

1488+
const auto &Loc = S.Current->getSource(OpPC);
1489+
14891490
if (const auto *NewExpr = dyn_cast<CXXNewExpr>(E)) {
14901491
const FunctionDecl *OperatorNew = NewExpr->getOperatorNew();
14911492

0 commit comments

Comments
 (0)