Skip to content

Commit 658b655

Browse files
committed
[clang][Interp][NFC] Refactor ByteCodeEmitter a bit
1 parent 241848b commit 658b655

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

clang/lib/AST/Interp/ByteCodeEmitter.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -109,23 +109,22 @@ ByteCodeEmitter::compileFunc(const FunctionDecl *FuncDecl) {
109109
// Return a dummy function if compilation failed.
110110
if (BailLocation)
111111
return llvm::make_error<ByteCodeGenError>(*BailLocation);
112-
else {
113-
Func->setIsFullyCompiled(true);
114-
return Func;
115-
}
116-
} else {
117-
// Create scopes from descriptors.
118-
llvm::SmallVector<Scope, 2> Scopes;
119-
for (auto &DS : Descriptors) {
120-
Scopes.emplace_back(std::move(DS));
121-
}
122112

123-
// Set the function's code.
124-
Func->setCode(NextLocalOffset, std::move(Code), std::move(SrcMap),
125-
std::move(Scopes), FuncDecl->hasBody());
126113
Func->setIsFullyCompiled(true);
127114
return Func;
128115
}
116+
117+
// Create scopes from descriptors.
118+
llvm::SmallVector<Scope, 2> Scopes;
119+
for (auto &DS : Descriptors) {
120+
Scopes.emplace_back(std::move(DS));
121+
}
122+
123+
// Set the function's code.
124+
Func->setCode(NextLocalOffset, std::move(Code), std::move(SrcMap),
125+
std::move(Scopes), FuncDecl->hasBody());
126+
Func->setIsFullyCompiled(true);
127+
return Func;
129128
}
130129

131130
Scope::Local ByteCodeEmitter::createLocal(Descriptor *D) {

0 commit comments

Comments
 (0)