diff options
author | Eugene Zelenko <eugene.zelenko@gmail.com> | 2016-02-12 22:53:10 +0000 |
---|---|---|
committer | Eugene Zelenko <eugene.zelenko@gmail.com> | 2016-02-12 22:53:10 +0000 |
commit | 1ced5095e4c621373ec4d24927216af67a28fe37 (patch) | |
tree | 8303fc76bead3a0ac79d1df61e095bc34f44ee0b /clang/lib/Sema/SemaDeclAttr.cpp | |
parent | b534ce46bd40eaa909a20f40ae576a2627da4f90 (diff) | |
download | bcm5719-llvm-1ced5095e4c621373ec4d24927216af67a28fe37.tar.gz bcm5719-llvm-1ced5095e4c621373ec4d24927216af67a28fe37.zip |
Fix remaining Clang-tidy readability-redundant-control-flow warnings; other minor fixes.
Differential revision: http://reviews.llvm.org/D17218
llvm-svn: 260757
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 81a57b222fd..e95e4b70e8d 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -32,6 +32,7 @@ #include "clang/Sema/Scope.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/MathExtras.h" + using namespace clang; using namespace sema; @@ -41,7 +42,7 @@ namespace AttributeLangSupport { Cpp, ObjC }; -} +} // end namespace AttributeLangSupport //===----------------------------------------------------------------------===// // Helper functions @@ -53,6 +54,7 @@ namespace AttributeLangSupport { static bool isFunctionOrMethod(const Decl *D) { return (D->getFunctionType() != nullptr) || isa<ObjCMethodDecl>(D); } + /// \brief Return true if the given decl has function type (function or /// function-typed variable) or an Objective-C method or a block. static bool isFunctionOrMethodOrBlock(const Decl *D) { @@ -888,7 +890,6 @@ static void handleConsumableAttr(Sema &S, Decl *D, const AttributeList &Attr) { Attr.getAttributeSpellingListIndex())); } - static bool checkForConsumableClass(Sema &S, const CXXMethodDecl *MD, const AttributeList &Attr) { ASTContext &CurrContext = S.getASTContext(); @@ -906,7 +907,6 @@ static bool checkForConsumableClass(Sema &S, const CXXMethodDecl *MD, return true; } - static void handleCallableWhenAttr(Sema &S, Decl *D, const AttributeList &Attr) { if (!checkAttributeAtLeastNumArgs(S, Attr, 1)) @@ -945,7 +945,6 @@ static void handleCallableWhenAttr(Sema &S, Decl *D, States.size(), Attr.getAttributeSpellingListIndex())); } - static void handleParamTypestateAttr(Sema &S, Decl *D, const AttributeList &Attr) { ParamTypestateAttr::ConsumedState ParamState; @@ -983,7 +982,6 @@ static void handleParamTypestateAttr(Sema &S, Decl *D, Attr.getAttributeSpellingListIndex())); } - static void handleReturnTypestateAttr(Sema &S, Decl *D, const AttributeList &Attr) { ReturnTypestateAttr::ConsumedState ReturnState; @@ -1032,7 +1030,6 @@ static void handleReturnTypestateAttr(Sema &S, Decl *D, Attr.getAttributeSpellingListIndex())); } - static void handleSetTypestateAttr(Sema &S, Decl *D, const AttributeList &Attr) { if (!checkForConsumableClass(S, cast<CXXMethodDecl>(D), Attr)) return; @@ -2615,7 +2612,6 @@ static void handleTargetAttr(Sema &S, Decl *D, const AttributeList &Attr) { D->addAttr(NewAttr); } - static void handleCleanupAttr(Sema &S, Decl *D, const AttributeList &Attr) { VarDecl *VD = cast<VarDecl>(D); if (!VD->hasLocalStorage()) { @@ -3073,7 +3069,6 @@ void Sema::AddAlignValueAttr(SourceRange AttrRange, Decl *D, Expr *E, // Save dependent expressions in the AST to be instantiated. D->addAttr(::new (Context) AlignValueAttr(TmpAttr)); - return; } static void handleAlignedAttr(Sema &S, Decl *D, const AttributeList &Attr) { @@ -3878,7 +3873,6 @@ bool Sema::CheckRegparmAttr(const AttributeList &Attr, unsigned &numParams) { static bool checkLaunchBoundsArgument(Sema &S, Expr *E, const CUDALaunchBoundsAttr &Attr, const unsigned Idx) { - if (S.DiagnoseUnexpandedParameterPack(E)) return false; @@ -4021,6 +4015,7 @@ static bool isValidSubjectOfNSAttribute(Sema &S, QualType type) { type->isObjCObjectPointerType() || S.Context.isObjCNSObjectType(type); } + static bool isValidSubjectOfCFAttribute(Sema &S, QualType type) { return type->isDependentType() || type->isPointerType() || @@ -4057,7 +4052,6 @@ static void handleNSConsumedAttr(Sema &S, Decl *D, const AttributeList &Attr) { static void handleNSReturnsRetainedAttr(Sema &S, Decl *D, const AttributeList &Attr) { - QualType returnType; if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) @@ -5260,53 +5254,42 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, case AttributeList::AT_VecReturn: handleVecReturnAttr(S, D, Attr); break; - case AttributeList::AT_ObjCOwnership: handleObjCOwnershipAttr(S, D, Attr); break; case AttributeList::AT_ObjCPreciseLifetime: handleObjCPreciseLifetimeAttr(S, D, Attr); break; - case AttributeList::AT_ObjCReturnsInnerPointer: handleObjCReturnsInnerPointerAttr(S, D, Attr); break; - case AttributeList::AT_ObjCRequiresSuper: handleObjCRequiresSuperAttr(S, D, Attr); break; - case AttributeList::AT_ObjCBridge: handleObjCBridgeAttr(S, scope, D, Attr); break; - case AttributeList::AT_ObjCBridgeMutable: handleObjCBridgeMutableAttr(S, scope, D, Attr); break; - case AttributeList::AT_ObjCBridgeRelated: handleObjCBridgeRelatedAttr(S, scope, D, Attr); break; - case AttributeList::AT_ObjCDesignatedInitializer: handleObjCDesignatedInitializer(S, D, Attr); break; - case AttributeList::AT_ObjCRuntimeName: handleObjCRuntimeName(S, D, Attr); break; - case AttributeList::AT_ObjCBoxable: handleObjCBoxable(S, D, Attr); break; - case AttributeList::AT_CFAuditedTransfer: handleCFAuditedTransferAttr(S, D, Attr); break; case AttributeList::AT_CFUnknownTransfer: handleCFUnknownTransferAttr(S, D, Attr); break; - case AttributeList::AT_CFConsumed: case AttributeList::AT_NSConsumed: handleNSConsumedAttr(S, D, Attr); @@ -5314,7 +5297,6 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, case AttributeList::AT_NSConsumesSelf: handleSimpleAttribute<NSConsumesSelfAttr>(S, D, Attr); break; - case AttributeList::AT_NSReturnsAutoreleased: case AttributeList::AT_NSReturnsNotRetained: case AttributeList::AT_CFReturnsNotRetained: @@ -5331,11 +5313,9 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, case AttributeList::AT_VecTypeHint: handleVecTypeHint(S, D, Attr); break; - case AttributeList::AT_InitPriority: handleInitPriorityAttr(S, D, Attr); break; - case AttributeList::AT_Packed: handlePackedAttr(S, D, Attr); break; @@ -5863,7 +5843,6 @@ static void handleDelayedForbiddenType(Sema &S, DelayedDiagnostic &diag, diag.Triggered = true; } - static bool isDeclDeprecated(Decl *D) { do { if (D->isDeprecated()) @@ -5969,7 +5948,6 @@ static void DoEmitAvailabilityWarning(Sema &S, Sema::AvailabilityDiagnostic K, } } } - break; case Sema::AD_Partial: |