From aa83cba3fd762f6995985c9ec6f5b8bd50ae7e36 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Sat, 3 May 2014 22:07:35 +0000 Subject: [PATCH] Minor cleanups, no behavior change. * Fixes a "return" that was indented at the same level as the continuation from the previous line * Wrap several lines to 80 columns * Remove an if check that was always true * Move a variable declaration slightly closer to its use git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207922 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaDecl.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 3404e7de20..743a8f2943 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -172,11 +172,9 @@ ParsedType Sema::getTypeName(const IdentifierInfo &II, SourceLocation NameLoc, return ActOnTypenameType(S, SourceLocation(), *SS, II, NameLoc).get(); NestedNameSpecifierLoc QualifierLoc = SS->getWithLocInContext(Context); - QualType T = - CheckTypenameType(ETK_None, SourceLocation(), QualifierLoc, - II, NameLoc); - - return ParsedType::make(T); + QualType T = CheckTypenameType(ETK_None, SourceLocation(), QualifierLoc, + II, NameLoc); + return ParsedType::make(T); } return ParsedType(); @@ -311,8 +309,7 @@ ParsedType Sema::getTypeName(const IdentifierInfo &II, SourceLocation NameLoc, if (TypeDecl *TD = dyn_cast(IIDecl)) { DiagnoseUseOfDecl(IIDecl, NameLoc); - if (T.isNull()) - T = Context.getTypeDeclType(TD); + T = Context.getTypeDeclType(TD); // NOTE: avoid constructing an ElaboratedType(Loc) if this is a // constructor or destructor name (in such a case, the scope specifier @@ -825,8 +822,8 @@ Corrected: ObjCInterfaceDecl *Class = dyn_cast(FirstDecl); if (!Class) { // FIXME: It's unfortunate that we don't have a Type node for handling this. - if (ObjCCompatibleAliasDecl *Alias - = dyn_cast(FirstDecl)) + if (ObjCCompatibleAliasDecl *Alias = + dyn_cast(FirstDecl)) Class = Alias->getClassInterface(); } @@ -1314,7 +1311,8 @@ static bool ShouldDiagnoseUnusedDecl(const NamedDecl *D) { return false; if (const Expr *Init = VD->getInit()) { - if (const ExprWithCleanups *Cleanups = dyn_cast(Init)) + if (const ExprWithCleanups *Cleanups = + dyn_cast(Init)) Init = Cleanups->getSubExpr(); const CXXConstructExpr *Construct = dyn_cast(Init); @@ -1349,10 +1347,10 @@ static void GenerateFixForUnusedDecl(const NamedDecl *D, ASTContext &Ctx, /// DiagnoseUnusedDecl - Emit warnings about declarations that are not used /// unless they are marked attr(unused). void Sema::DiagnoseUnusedDecl(const NamedDecl *D) { - FixItHint Hint; if (!ShouldDiagnoseUnusedDecl(D)) return; + FixItHint Hint; GenerateFixForUnusedDecl(D, Context, Hint); unsigned DiagID; -- 2.40.0