Skip to content

Commit 256350e

Browse files
tbaederrGeorgeARM
authored andcommitted
[clang][bytecode] Bail out on invalid function declarations (llvm#138503)
1 parent 381ed02 commit 256350e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,12 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) {
834834
return false;
835835
}
836836

837+
// Bail out if the function declaration itself is invalid. We will
838+
// have produced a relevant diagnostic while parsing it, so just
839+
// note the problematic sub-expression.
840+
if (F->getDecl()->isInvalidDecl())
841+
return Invalid(S, OpPC);
842+
837843
if (S.checkingPotentialConstantExpression() && S.Current->getDepth() != 0)
838844
return false;
839845

0 commit comments

Comments
 (0)