Skip to content

Commit 7aabdb8

Browse files
committed
[clang][Interp][NFC] Protect ByteCodeEmitter against unfinished fns
This is similar to a check in TextNodeDumper.cpp. Without this, we will crash later when trying to iterate over FuncDecl->params().
1 parent 14c323c commit 7aabdb8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

clang/lib/AST/Interp/ByteCodeEmitter.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ static bool isUnevaluatedBuiltin(unsigned BuiltinID) {
3131
}
3232

3333
Function *ByteCodeEmitter::compileFunc(const FunctionDecl *FuncDecl) {
34+
35+
// Manually created functions that haven't been assigned proper
36+
// parameters yet.
37+
if (!FuncDecl->param_empty() && !FuncDecl->param_begin())
38+
return nullptr;
39+
3440
bool IsLambdaStaticInvoker = false;
3541
if (const auto *MD = dyn_cast<CXXMethodDecl>(FuncDecl);
3642
MD && MD->isLambdaStaticInvoker()) {

0 commit comments

Comments
 (0)