Skip to content

Commit 0e2da3d

Browse files
tbaederrsvkeerthy
authored andcommitted
[clang][bytecode] Only check expr in CheckThis() if we have to (#141951)
Pre C++11, we dont't need to get the value of IsImplicit.
1 parent c2bf1e2 commit 0e2da3d

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -966,16 +966,15 @@ bool CheckThis(InterpState &S, CodePtr OpPC, const Pointer &This) {
966966
if (!This.isZero())
967967
return true;
968968

969-
const SourceInfo &Loc = S.Current->getSource(OpPC);
970-
971-
bool IsImplicit = false;
972-
if (const auto *E = dyn_cast_if_present<CXXThisExpr>(Loc.asExpr()))
973-
IsImplicit = E->isImplicit();
974-
975-
if (S.getLangOpts().CPlusPlus11)
976-
S.FFDiag(Loc, diag::note_constexpr_this) << IsImplicit;
977-
else
978-
S.FFDiag(Loc);
969+
const Expr *E = S.Current->getExpr(OpPC);
970+
if (S.getLangOpts().CPlusPlus11) {
971+
bool IsImplicit = false;
972+
if (const auto *TE = dyn_cast<CXXThisExpr>(E))
973+
IsImplicit = TE->isImplicit();
974+
S.FFDiag(E, diag::note_constexpr_this) << IsImplicit;
975+
} else {
976+
S.FFDiag(E);
977+
}
979978

980979
return false;
981980
}

0 commit comments

Comments
 (0)