Skip to content
Merged
Prev Previous commit
Next Next commit
In UpdateClassInfoWithDecl, improve semantic use of variable name.
I.e. don't reuse a variable for a slightly different menaing.
  • Loading branch information
pcanal committed Sep 6, 2019
commit d739e7fd5bdbac74f8e16738e4ec3c4f4d79cad8
8 changes: 3 additions & 5 deletions core/metacling/src/TCling.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -6520,16 +6520,14 @@ void TCling::UpdateClassInfoWithDecl(const NamedDecl* ND)
tdDef = td->getDefinition();
// Let's pass the decl to the TClass only if it has a definition.
if (!tdDef) return;
td = tdDef;
ND = td;

if (!td->isCompleteDefinition() || llvm::isa<clang::FunctionDecl>(td->getDeclContext())) {
if (!tdDef->isCompleteDefinition() || llvm::isa<clang::FunctionDecl>(tdDef->getDeclContext())) {
// Ignore incomplete definition.
// Ignore declaration within a function.
return;
}

auto declName=ND->getNameAsString();
auto declName = tdDef->getNameAsString();
// Check if we have registered the unqualified name into the list
// of TClass that are in kNoInfo, kEmulated or kFwdDeclaredState.
// Since this is used as heureutistic to avoid spurrious calls to GetNormalizedName
Expand All @@ -6540,7 +6538,7 @@ void TCling::UpdateClassInfoWithDecl(const NamedDecl* ND)
return;
}

clang::QualType type(td->getTypeForDecl(), 0);
clang::QualType type(tdDef->getTypeForDecl(), 0);
ROOT::TMetaUtils::GetNormalizedName(name, type, *fInterpreter, *fNormalizedCtxt);
} else {
name = ND->getQualifiedNameAsString();
Expand Down