Changeset View
Changeset View
Standalone View
Standalone View
clang/lib/AST/DeclPrinter.cpp
Show First 20 Lines • Show All 1,001 Lines • ▼ Show 20 Lines | if (auto S = dyn_cast<ClassTemplateSpecializationDecl>(D)) { | ||||
if (const auto *TST = | if (const auto *TST = | ||||
dyn_cast<TemplateSpecializationType>(TSI->getType())) | dyn_cast<TemplateSpecializationType>(TSI->getType())) | ||||
Args = TST->template_arguments(); | Args = TST->template_arguments(); | ||||
printTemplateArguments( | printTemplateArguments( | ||||
Args, S->getSpecializedTemplate()->getTemplateParameters()); | Args, S->getSpecializedTemplate()->getTemplateParameters()); | ||||
} | } | ||||
} | } | ||||
if (auto *Def = D->getDefinition()) { | |||||
sammccall: isEffectivelyFinal returns true for
`struct X { ~X() final; }`
I don't think we want to print… | |||||
Agreed. Would probably make sense to add a bool hasFinalAttribute() const to CXXRecordDecl? tom-anders: Agreed. Would probably make sense to add a `bool hasFinalAttribute() const` to `CXXRecordDecl`? | |||||
Not Done ReplyInline ActionsI'm not sure such a method pays for itself, the abstraction it might provides over hasAttr() is:
Given that, I think it's probably best here just to inline the logic, but I don't feel strongly. sammccall: I'm not sure such a method pays for itself, the abstraction it might provides over hasAttr() is… | |||||
if (D->hasAttr<FinalAttr>()) { | |||||
Out << " final"; | |||||
} | |||||
} | |||||
if (D->isCompleteDefinition()) { | if (D->isCompleteDefinition()) { | ||||
// Print the base classes | // Print the base classes | ||||
if (D->getNumBases()) { | if (D->getNumBases()) { | ||||
Out << " : "; | Out << " : "; | ||||
for (CXXRecordDecl::base_class_iterator Base = D->bases_begin(), | for (CXXRecordDecl::base_class_iterator Base = D->bases_begin(), | ||||
BaseEnd = D->bases_end(); Base != BaseEnd; ++Base) { | BaseEnd = D->bases_end(); Base != BaseEnd; ++Base) { | ||||
if (Base != D->bases_begin()) | if (Base != D->bases_begin()) | ||||
Out << ", "; | Out << ", "; | ||||
▲ Show 20 Lines • Show All 767 Lines • Show Last 20 Lines |
isEffectivelyFinal returns true for
struct X { ~X() final; }
I don't think we want to print struct X final {} in that case.
Probably want to replicate the check for FinalAttr instead?