From 7a2fb5f436ed9bef215df27817073b67b78b5a32 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Thu, 17 Apr 2014 20:08:36 +0000 Subject: [PATCH] Nitpicky refactoring -- use of nullptr and auto, made a bit more const-correct. No functional changes intended. llvm-svn: 206491 --- clang/lib/Sema/SemaDecl.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 6627e0792001..50462b792733 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -1923,43 +1923,43 @@ static bool mergeAlignedAttrs(Sema &S, NamedDecl *New, Decl *Old) { return AnyAdded; } -static bool mergeDeclAttribute(Sema &S, NamedDecl *D, InheritableAttr *Attr, - bool Override) { - InheritableAttr *NewAttr = NULL; +static bool mergeDeclAttribute(Sema &S, NamedDecl *D, + const InheritableAttr *Attr, bool Override) { + InheritableAttr *NewAttr = nullptr; unsigned AttrSpellingListIndex = Attr->getSpellingListIndex(); - if (AvailabilityAttr *AA = dyn_cast(Attr)) + if (const auto *AA = dyn_cast(Attr)) NewAttr = S.mergeAvailabilityAttr(D, AA->getRange(), AA->getPlatform(), AA->getIntroduced(), AA->getDeprecated(), AA->getObsoleted(), AA->getUnavailable(), AA->getMessage(), Override, AttrSpellingListIndex); - else if (VisibilityAttr *VA = dyn_cast(Attr)) + else if (const auto *VA = dyn_cast(Attr)) NewAttr = S.mergeVisibilityAttr(D, VA->getRange(), VA->getVisibility(), AttrSpellingListIndex); - else if (TypeVisibilityAttr *VA = dyn_cast(Attr)) + else if (const auto *VA = dyn_cast(Attr)) NewAttr = S.mergeTypeVisibilityAttr(D, VA->getRange(), VA->getVisibility(), AttrSpellingListIndex); - else if (DLLImportAttr *ImportA = dyn_cast(Attr)) + else if (const auto *ImportA = dyn_cast(Attr)) NewAttr = S.mergeDLLImportAttr(D, ImportA->getRange(), AttrSpellingListIndex); - else if (DLLExportAttr *ExportA = dyn_cast(Attr)) + else if (const auto *ExportA = dyn_cast(Attr)) NewAttr = S.mergeDLLExportAttr(D, ExportA->getRange(), AttrSpellingListIndex); - else if (FormatAttr *FA = dyn_cast(Attr)) + else if (const auto *FA = dyn_cast(Attr)) NewAttr = S.mergeFormatAttr(D, FA->getRange(), FA->getType(), FA->getFormatIdx(), FA->getFirstArg(), AttrSpellingListIndex); - else if (SectionAttr *SA = dyn_cast(Attr)) + else if (const auto *SA = dyn_cast(Attr)) NewAttr = S.mergeSectionAttr(D, SA->getRange(), SA->getName(), AttrSpellingListIndex); - else if (MSInheritanceAttr *IA = dyn_cast(Attr)) + else if (const auto *IA = dyn_cast(Attr)) NewAttr = S.mergeMSInheritanceAttr(D, IA->getRange(), IA->getBestCase(), AttrSpellingListIndex, IA->getSemanticSpelling()); else if (isa(Attr)) // AlignedAttrs are handled separately, because we need to handle all // such attributes on a declaration at the same time. - NewAttr = 0; + NewAttr = nullptr; else if (Attr->duplicatesAllowed() || !DeclHasAttr(D, Attr)) NewAttr = cast(Attr->clone(S.Context));