From: Axel Naumann Date: Thu, 28 Aug 2014 13:58:42 +0000 (+0200) Subject: Do not fwd declare unnamed classes nor typedefs to them (ALICE). X-Git-Tag: v6-02-00-rc1~257 X-Git-Url: https://root.cern.ch/gitweb?p=root.git;a=commitdiff_plain;h=64875add541aaa85a28d93ada73975cd511bd46e Do not fwd declare unnamed classes nor typedefs to them (ALICE). --- diff --git a/core/metautils/src/TMetaUtils.cxx b/core/metautils/src/TMetaUtils.cxx index 0b91c81..39663e8 100644 --- a/core/metautils/src/TMetaUtils.cxx +++ b/core/metautils/src/TMetaUtils.cxx @@ -4668,6 +4668,10 @@ int ROOT::TMetaUtils::AST2SourceTools::FwdDeclFromRcdDecl(const clang::RecordDec if (ROOT::TMetaUtils::IsStdClass(recordDecl) && !acceptStl) return 0; + // Do not fwd declare unnamed decls. + if (!recordDecl.getIdentifier()) + return 0; + // We may need to fwd declare the arguments of the template std::string argsFwdDecl; @@ -4730,7 +4734,16 @@ int ROOT::TMetaUtils::AST2SourceTools::FwdDeclFromTypeDefNameDecl(const clang::T std::string buffer = tdnDecl.getNameAsString(); std::string underlyingName; - auto underlyingType = tdnDecl.getUnderlyingType(); + auto underlyingType = tdnDecl.getUnderlyingType().getCanonicalType(); + if (const clang::TagType* TT + = llvm::dyn_cast(underlyingType.getTypePtr())) { + if (clang::NamedDecl* ND = TT->getDecl()) { + if (!ND->getIdentifier()) { + // No fwd decl for unnamed underlying entities. + return 0; + } + } + } TNormalizedCtxt nCtxt(interpreter.getLookupHelper()); ROOT::TMetaUtils::GetNormalizedName(underlyingName,