DeclExtractor: exit early if there is nothing to do
In LLVM 9, the `CompoundStmt::replaceStmts()` call seems to write to an invalid memory location if the body was empty. This may happen after a parse error and might end up corrupting the program state. This patch makes `DeclExtractor` to exit early if there is nothing to do, which solves the aforementioned problem.
This commit is contained in:
parent
dad7ed462e
commit
b5348025ef
@ -117,6 +117,9 @@ namespace cling {
|
||||
Scope* TUScope = m_Sema->TUScope;
|
||||
llvm::SmallVector<Stmt*, 4> Stmts;
|
||||
|
||||
if (CS->body_empty())
|
||||
return FD;
|
||||
|
||||
for (CompoundStmt::body_iterator I = CS->body_begin(), EI = CS->body_end();
|
||||
I != EI; ++I) {
|
||||
DeclStmt* DS = dyn_cast<DeclStmt>(*I);
|
||||
|
Loading…
x
Reference in New Issue
Block a user