Skip to content

Commit

Permalink
[TCling] Do not add decls for control statements if already annotated
Browse files Browse the repository at this point in the history
  • Loading branch information
devajithvs authored and dpiparo committed Sep 25, 2024
1 parent cb520c7 commit 13af1b8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/metacling/src/TClingCallbacks.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,13 @@ bool TClingCallbacks::tryResolveAtRuntimeInternal(LookupResult &R, Scope *S) {
return false;
}

// FIX-8367
// Do not try to resolve if/switch/while/for statement, if already annotated
// for(i=0;i<0;); was failing due to multiple addDecls for the same variable.
if (auto annot = Wrapper->getAttr<AnnotateAttr>())
if (annot->getAnnotation().equals("__ResolveAtRuntime") && S->isControlScope())
return false;

VarDecl* Result = VarDecl::Create(C, TU, Loc, Loc, II, C.DependentTy,
/*TypeSourceInfo*/nullptr, SC_None);

Expand Down

0 comments on commit 13af1b8

Please sign in to comment.