zhouyizhou updated this revision to Diff 345792. zhouyizhou retitled this revision from "TreeTransform.h: make the switch case more beautiful " to "NFC: TreeTransform.h: make the switch case more beautiful ". zhouyizhou added a comment.
use clang-format to fix the function TransformNestedNameSpecifierLoc CHANGES SINCE LAST ACTION https://reviews.llvm.org/D102577/new/ https://reviews.llvm.org/D102577 Files: clang/lib/Sema/TreeTransform.h Index: clang/lib/Sema/TreeTransform.h =================================================================== --- clang/lib/Sema/TreeTransform.h +++ clang/lib/Sema/TreeTransform.h @@ -3941,12 +3941,10 @@ return Sema::ConditionResult(); } -template<typename Derived> -NestedNameSpecifierLoc -TreeTransform<Derived>::TransformNestedNameSpecifierLoc( - NestedNameSpecifierLoc NNS, - QualType ObjectType, - NamedDecl *FirstQualifierInScope) { +template <typename Derived> +NestedNameSpecifierLoc TreeTransform<Derived>::TransformNestedNameSpecifierLoc( + NestedNameSpecifierLoc NNS, QualType ObjectType, + NamedDecl *FirstQualifierInScope) { SmallVector<NestedNameSpecifierLoc, 4> Qualifiers; for (NestedNameSpecifierLoc Qualifier = NNS; Qualifier; Qualifier = Qualifier.getPrefix()) @@ -3960,28 +3958,26 @@ switch (QNNS->getKind()) { case NestedNameSpecifier::Identifier: { Sema::NestedNameSpecInfo IdInfo(QNNS->getAsIdentifier(), - Q.getLocalBeginLoc(), Q.getLocalEndLoc(), ObjectType); + Q.getLocalBeginLoc(), Q.getLocalEndLoc(), + ObjectType); if (SemaRef.BuildCXXNestedNameSpecifier(/*Scope=*/nullptr, IdInfo, false, SS, FirstQualifierInScope, false)) return NestedNameSpecifierLoc(); - } break; + } case NestedNameSpecifier::Namespace: { - NamespaceDecl *NS - = cast_or_null<NamespaceDecl>( - getDerived().TransformDecl( - Q.getLocalBeginLoc(), - QNNS->getAsNamespace())); + NamespaceDecl *NS = + cast_or_null<NamespaceDecl>(getDerived().TransformDecl( + Q.getLocalBeginLoc(), QNNS->getAsNamespace())); SS.Extend(SemaRef.Context, NS, Q.getLocalBeginLoc(), Q.getLocalEndLoc()); break; } case NestedNameSpecifier::NamespaceAlias: { - NamespaceAliasDecl *Alias - = cast_or_null<NamespaceAliasDecl>( - getDerived().TransformDecl(Q.getLocalBeginLoc(), - QNNS->getAsNamespaceAlias())); + NamespaceAliasDecl *Alias = + cast_or_null<NamespaceAliasDecl>(getDerived().TransformDecl( + Q.getLocalBeginLoc(), QNNS->getAsNamespaceAlias())); SS.Extend(SemaRef.Context, Alias, Q.getLocalBeginLoc(), Q.getLocalEndLoc()); break; @@ -4017,7 +4013,7 @@ if (TL.getType()->isEnumeralType()) SemaRef.Diag(TL.getBeginLoc(), diag::warn_cxx98_compat_enum_nested_name_spec); - SS.Extend(SemaRef.Context, /*FIXME:*/SourceLocation(), TL, + SS.Extend(SemaRef.Context, /*FIXME:*/ SourceLocation(), TL, Q.getLocalEndLoc()); break; } @@ -4026,7 +4022,7 @@ TypedefTypeLoc TTL = TL.getAs<TypedefTypeLoc>(); if (!TTL || !TTL.getTypedefNameDecl()->isInvalidDecl()) { SemaRef.Diag(TL.getBeginLoc(), diag::err_nested_name_spec_non_tag) - << TL.getType() << SS.getRange(); + << TL.getType() << SS.getRange(); } return NestedNameSpecifierLoc(); }
Index: clang/lib/Sema/TreeTransform.h =================================================================== --- clang/lib/Sema/TreeTransform.h +++ clang/lib/Sema/TreeTransform.h @@ -3941,12 +3941,10 @@ return Sema::ConditionResult(); } -template<typename Derived> -NestedNameSpecifierLoc -TreeTransform<Derived>::TransformNestedNameSpecifierLoc( - NestedNameSpecifierLoc NNS, - QualType ObjectType, - NamedDecl *FirstQualifierInScope) { +template <typename Derived> +NestedNameSpecifierLoc TreeTransform<Derived>::TransformNestedNameSpecifierLoc( + NestedNameSpecifierLoc NNS, QualType ObjectType, + NamedDecl *FirstQualifierInScope) { SmallVector<NestedNameSpecifierLoc, 4> Qualifiers; for (NestedNameSpecifierLoc Qualifier = NNS; Qualifier; Qualifier = Qualifier.getPrefix()) @@ -3960,28 +3958,26 @@ switch (QNNS->getKind()) { case NestedNameSpecifier::Identifier: { Sema::NestedNameSpecInfo IdInfo(QNNS->getAsIdentifier(), - Q.getLocalBeginLoc(), Q.getLocalEndLoc(), ObjectType); + Q.getLocalBeginLoc(), Q.getLocalEndLoc(), + ObjectType); if (SemaRef.BuildCXXNestedNameSpecifier(/*Scope=*/nullptr, IdInfo, false, SS, FirstQualifierInScope, false)) return NestedNameSpecifierLoc(); - } break; + } case NestedNameSpecifier::Namespace: { - NamespaceDecl *NS - = cast_or_null<NamespaceDecl>( - getDerived().TransformDecl( - Q.getLocalBeginLoc(), - QNNS->getAsNamespace())); + NamespaceDecl *NS = + cast_or_null<NamespaceDecl>(getDerived().TransformDecl( + Q.getLocalBeginLoc(), QNNS->getAsNamespace())); SS.Extend(SemaRef.Context, NS, Q.getLocalBeginLoc(), Q.getLocalEndLoc()); break; } case NestedNameSpecifier::NamespaceAlias: { - NamespaceAliasDecl *Alias - = cast_or_null<NamespaceAliasDecl>( - getDerived().TransformDecl(Q.getLocalBeginLoc(), - QNNS->getAsNamespaceAlias())); + NamespaceAliasDecl *Alias = + cast_or_null<NamespaceAliasDecl>(getDerived().TransformDecl( + Q.getLocalBeginLoc(), QNNS->getAsNamespaceAlias())); SS.Extend(SemaRef.Context, Alias, Q.getLocalBeginLoc(), Q.getLocalEndLoc()); break; @@ -4017,7 +4013,7 @@ if (TL.getType()->isEnumeralType()) SemaRef.Diag(TL.getBeginLoc(), diag::warn_cxx98_compat_enum_nested_name_spec); - SS.Extend(SemaRef.Context, /*FIXME:*/SourceLocation(), TL, + SS.Extend(SemaRef.Context, /*FIXME:*/ SourceLocation(), TL, Q.getLocalEndLoc()); break; } @@ -4026,7 +4022,7 @@ TypedefTypeLoc TTL = TL.getAs<TypedefTypeLoc>(); if (!TTL || !TTL.getTypedefNameDecl()->isInvalidDecl()) { SemaRef.Diag(TL.getBeginLoc(), diag::err_nested_name_spec_non_tag) - << TL.getType() << SS.getRange(); + << TL.getType() << SS.getRange(); } return NestedNameSpecifierLoc(); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits