diff options
author | Mandeep Singh Grang <mgrang@codeaurora.org> | 2016-11-08 07:50:19 +0000 |
---|---|---|
committer | Mandeep Singh Grang <mgrang@codeaurora.org> | 2016-11-08 07:50:19 +0000 |
commit | 7c7ea7d0ae4041e92a4d510874e78da9f5e3bc1c (patch) | |
tree | 58745ba1b5123ed61711bbf23879bf5350c74e81 /clang-tools-extra/clang-tidy/cppcoreguidelines | |
parent | d700c357d4689abb48121f61690a4080e39c326d (diff) | |
download | bcm5719-llvm-7c7ea7d0ae4041e92a4d510874e78da9f5e3bc1c.tar.gz bcm5719-llvm-7c7ea7d0ae4041e92a4d510874e78da9f5e3bc1c.zip |
[clang-tools-extra] Format sources with clang-format. NFC.
Summary:
Ran clang-format on all .c/.cpp/.h files in clang-tools-extra.
Excluded the test, unittests, clang-reorder-fields, include-fixer, modularize and pptrace directories.
Reviewers: klimek, alexfh
Subscribers: nemanjai
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D26329
llvm-svn: 286221
Diffstat (limited to 'clang-tools-extra/clang-tidy/cppcoreguidelines')
10 files changed, 29 insertions, 28 deletions
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp index dc9a7f31dd5..b34314c628f 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp @@ -22,8 +22,8 @@ #include "ProTypeStaticCastDowncastCheck.h" #include "ProTypeUnionAccessCheck.h" #include "ProTypeVarargCheck.h" -#include "SpecialMemberFunctionsCheck.h" #include "SlicingCheck.h" +#include "SpecialMemberFunctionsCheck.h" namespace clang { namespace tidy { @@ -57,8 +57,7 @@ public: "cppcoreguidelines-pro-type-vararg"); CheckFactories.registerCheck<SpecialMemberFunctionsCheck>( "cppcoreguidelines-special-member-functions"); - CheckFactories.registerCheck<SlicingCheck>( - "cppcoreguidelines-slicing"); + CheckFactories.registerCheck<SlicingCheck>("cppcoreguidelines-slicing"); CheckFactories.registerCheck<misc::UnconventionalAssignOperatorCheck>( "cppcoreguidelines-c-copy-assignment-signature"); } diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp index 56fbf742f63..3844f68ed15 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp @@ -47,12 +47,12 @@ void ProBoundsConstantArrayIndexCheck::registerMatchers(MatchFinder *Finder) { // Note: if a struct contains an array member, the compiler-generated // constructor has an arraySubscriptExpr. - Finder->addMatcher(arraySubscriptExpr(hasBase(ignoringImpCasts(hasType( - constantArrayType().bind("type")))), - hasIndex(expr().bind("index")), - unless(hasAncestor(isImplicit()))) - .bind("expr"), - this); + Finder->addMatcher( + arraySubscriptExpr( + hasBase(ignoringImpCasts(hasType(constantArrayType().bind("type")))), + hasIndex(expr().bind("index")), unless(hasAncestor(isImplicit()))) + .bind("expr"), + this); Finder->addMatcher( cxxOperatorCallExpr( @@ -112,8 +112,7 @@ void ProBoundsConstantArrayIndexCheck::check( return; if (Index.isSigned() && Index.isNegative()) { - diag(Matched->getExprLoc(), - "std::array<> index %0 is negative") + diag(Matched->getExprLoc(), "std::array<> index %0 is negative") << Index.toString(10); return; } @@ -130,8 +129,9 @@ void ProBoundsConstantArrayIndexCheck::check( // Get uint64_t values, because different bitwidths would lead to an assertion // in APInt::uge. if (Index.getZExtValue() >= ArraySize.getZExtValue()) { - diag(Matched->getExprLoc(), "std::array<> index %0 is past the end of the array " - "(which contains %1 elements)") + diag(Matched->getExprLoc(), + "std::array<> index %0 is past the end of the array " + "(which contains %1 elements)") << Index.toString(10) << ArraySize.toString(10, false); } } diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp index da850931328..d664b6401ae 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp @@ -47,8 +47,8 @@ void ProBoundsPointerArithmeticCheck::registerMatchers(MatchFinder *Finder) { this); } -void -ProBoundsPointerArithmeticCheck::check(const MatchFinder::MatchResult &Result) { +void ProBoundsPointerArithmeticCheck::check( + const MatchFinder::MatchResult &Result) { const auto *MatchedExpr = Result.Nodes.getNodeAs<Expr>("expr"); diag(MatchedExpr->getExprLoc(), "do not use pointer arithmetic"); diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.h b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.h index 6f330cf1358..5ecf93cc153 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.h +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.h @@ -17,7 +17,8 @@ namespace tidy { namespace cppcoreguidelines { /// Flags all kinds of pointer arithmetic that have result of pointer type, i.e. -/// +, -, +=, -=, ++, --. In addition, the [] operator on pointers (not on arrays) is flagged. +/// +, -, +=, -=, ++, --. In addition, the [] operator on pointers (not on +/// arrays) is flagged. /// /// For the user-facing documentation see: /// http://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-pro-bounds-pointer-arithmetic.html diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp index a5c26482e4d..e64d36a6c4f 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp @@ -278,8 +278,7 @@ void ProTypeMemberInitCheck::registerMatchers(MatchFinder *Finder) { // AST. Finder->addMatcher( cxxRecordDecl( - isDefinition(), unless(isInstantiated()), - hasDefaultConstructor(), + isDefinition(), unless(isInstantiated()), hasDefaultConstructor(), anyOf(has(cxxConstructorDecl(isDefaultConstructor(), isDefaulted(), unless(isImplicit()))), unless(has(cxxConstructorDecl()))), @@ -465,7 +464,7 @@ void ProTypeMemberInitCheck::checkMissingBaseClassInitializer( << toCommaSeparatedString(AllBases, BasesToInit); if (Ctor) - fixInitializerList(Context, Diag, Ctor, BasesToInit); + fixInitializerList(Context, Diag, Ctor, BasesToInit); } void ProTypeMemberInitCheck::checkUninitializedTrivialType( diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp index 153e1cae810..f43e4fa1ad1 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp @@ -26,7 +26,8 @@ void ProTypeStaticCastDowncastCheck::registerMatchers(MatchFinder *Finder) { this); } -void ProTypeStaticCastDowncastCheck::check(const MatchFinder::MatchResult &Result) { +void ProTypeStaticCastDowncastCheck::check( + const MatchFinder::MatchResult &Result) { const auto *MatchedCast = Result.Nodes.getNodeAs<CXXStaticCastExpr>("cast"); if (MatchedCast->getCastKind() != CK_BaseToDerived) return; diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h index 77224237f79..b6d76a69de1 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h @@ -16,7 +16,8 @@ namespace clang { namespace tidy { namespace cppcoreguidelines { -/// Checks for usages of static_cast, where a base class is downcasted to a derived class. +/// Checks for usages of static_cast, where a base class is downcasted to a +/// derived class. /// /// For the user-facing documentation see: /// http://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-pro-type-static-cast-downcast.html diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.cpp index 5233ad8f4b8..09752f69d3c 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.cpp @@ -21,15 +21,18 @@ void ProTypeUnionAccessCheck::registerMatchers(MatchFinder *Finder) { if (!getLangOpts().CPlusPlus) return; - Finder->addMatcher(memberExpr(hasObjectExpression(hasType(recordDecl(isUnion())))).bind("expr"), this); + Finder->addMatcher( + memberExpr(hasObjectExpression(hasType(recordDecl(isUnion())))) + .bind("expr"), + this); } void ProTypeUnionAccessCheck::check(const MatchFinder::MatchResult &Result) { const auto *Matched = Result.Nodes.getNodeAs<MemberExpr>("expr"); - diag(Matched->getMemberLoc(), "do not access members of unions; use (boost::)variant instead"); + diag(Matched->getMemberLoc(), + "do not access members of unions; use (boost::)variant instead"); } } // namespace cppcoreguidelines } // namespace tidy } // namespace clang - diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.h b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.h index 28097faae9e..fc7dd671d1f 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.h +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.h @@ -34,4 +34,3 @@ public: } // namespace clang #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_PRO_TYPE_UNION_ACCESS_H - diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp index 680037f9998..56227b236b4 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp @@ -26,9 +26,7 @@ void ProTypeVarargCheck::registerMatchers(MatchFinder *Finder) { Finder->addMatcher(vAArgExpr().bind("va_use"), this); Finder->addMatcher( - callExpr(callee(functionDecl(isVariadic()))) - .bind("callvararg"), - this); + callExpr(callee(functionDecl(isVariadic()))).bind("callvararg"), this); } static bool hasSingleVariadicArgumentWithValue(const CallExpr *C, uint64_t I) { |