forked from OSchip/llvm-project
NFC: TreeTransform.h: make the function TransformNestedNameSpecifierLoc more beautiful
Hi, I am new to LLVM, and I really want to get involved in LLVM community. I guess if the following switch case of function TransformNestedNameSpecifierLoc could possibly made more beautiful with 'break' stmt moved inside of the right brace. I think move of 'break' stmt will not change the invoking destructor of IdInfo. Thanks for your effort. I have done make check-all on x86_64-linux Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com> Reviewed By: pengfei Differential Revision: https://reviews.llvm.org/D102577
This commit is contained in:
parent
e2815398ce
commit
e6ec7ab582
|
@ -4031,12 +4031,10 @@ Sema::ConditionResult TreeTransform<Derived>::TransformCondition(
|
|||
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())
|
||||
|
@ -4050,28 +4048,26 @@ TreeTransform<Derived>::TransformNestedNameSpecifierLoc(
|
|||
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;
|
||||
|
@ -4107,7 +4103,7 @@ TreeTransform<Derived>::TransformNestedNameSpecifierLoc(
|
|||
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;
|
||||
}
|
||||
|
@ -4116,7 +4112,7 @@ TreeTransform<Derived>::TransformNestedNameSpecifierLoc(
|
|||
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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue