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 committed Sep 26, 2024
1 parent 6eed7f9 commit d994e9c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/metacling/src/TClingCallbacks.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,12 @@ bool TClingCallbacks::tryResolveAtRuntimeInternal(LookupResult &R, Scope *S) {
return false;
}

// Prevent redundant declarations for control statements (e.g., for, if, while)
// that have already been annotated.
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 d994e9c

Please sign in to comment.