diff options
Diffstat (limited to 'clang-tools-extra')
19 files changed, 137 insertions, 45 deletions
diff --git a/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp b/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp index 7adff8a..2e21a4c4 100644 --- a/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp @@ -24,6 +24,7 @@  #include "CopyConstructorInitCheck.h"  #include "CrtpConstructorAccessibilityCheck.h"  #include "DanglingHandleCheck.h" +#include "DefaultOperatorNewOnOveralignedTypeCheck.h"  #include "DerivedMethodShadowingBaseMethodCheck.h"  #include "DynamicStaticInitializersCheck.h"  #include "EasilySwappableParametersCheck.h" @@ -140,6 +141,8 @@ public:          "bugprone-copy-constructor-init");      CheckFactories.registerCheck<DanglingHandleCheck>(          "bugprone-dangling-handle"); +    CheckFactories.registerCheck<DefaultOperatorNewOnOveralignedTypeCheck>( +        "bugprone-default-operator-new-on-overaligned-type");      CheckFactories.registerCheck<DerivedMethodShadowingBaseMethodCheck>(          "bugprone-derived-method-shadowing-base-method");      CheckFactories.registerCheck<DynamicStaticInitializersCheck>( diff --git a/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt b/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt index c0fdb4d..31a0e69 100644 --- a/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt +++ b/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt @@ -20,6 +20,7 @@ add_clang_library(clangTidyBugproneModule STATIC    CopyConstructorInitCheck.cpp    CrtpConstructorAccessibilityCheck.cpp    DanglingHandleCheck.cpp +  DefaultOperatorNewOnOveralignedTypeCheck.cpp    DerivedMethodShadowingBaseMethodCheck.cpp    DynamicStaticInitializersCheck.cpp    EasilySwappableParametersCheck.cpp diff --git a/clang-tools-extra/clang-tidy/cert/DefaultOperatorNewAlignmentCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/DefaultOperatorNewOnOveralignedTypeCheck.cpp index 45c170e..0aafdfd 100644 --- a/clang-tools-extra/clang-tidy/cert/DefaultOperatorNewAlignmentCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/DefaultOperatorNewOnOveralignedTypeCheck.cpp @@ -6,21 +6,22 @@  //  //===----------------------------------------------------------------------===// -#include "DefaultOperatorNewAlignmentCheck.h" +#include "DefaultOperatorNewOnOveralignedTypeCheck.h"  #include "clang/AST/ASTContext.h"  #include "clang/ASTMatchers/ASTMatchFinder.h"  #include "clang/Basic/TargetInfo.h"  using namespace clang::ast_matchers; -namespace clang::tidy::cert { +namespace clang::tidy::bugprone { -void DefaultOperatorNewAlignmentCheck::registerMatchers(MatchFinder *Finder) { +void DefaultOperatorNewOnOveralignedTypeCheck::registerMatchers( +    MatchFinder *Finder) {    Finder->addMatcher(        cxxNewExpr(unless(hasAnyPlacementArg(anything()))).bind("new"), this);  } -void DefaultOperatorNewAlignmentCheck::check( +void DefaultOperatorNewOnOveralignedTypeCheck::check(      const MatchFinder::MatchResult &Result) {    // Get the found 'new' expression.    const auto *NewExpr = Result.Nodes.getNodeAs<CXXNewExpr>("new"); @@ -61,4 +62,4 @@ void DefaultOperatorNewAlignmentCheck::check(          << (SpecifiedAlignment / CharWidth);  } -} // namespace clang::tidy::cert +} // namespace clang::tidy::bugprone diff --git a/clang-tools-extra/clang-tidy/cert/DefaultOperatorNewAlignmentCheck.h b/clang-tools-extra/clang-tidy/bugprone/DefaultOperatorNewOnOveralignedTypeCheck.h index 8f9d0e4..b5b365b 100644 --- a/clang-tools-extra/clang-tidy/cert/DefaultOperatorNewAlignmentCheck.h +++ b/clang-tools-extra/clang-tidy/bugprone/DefaultOperatorNewOnOveralignedTypeCheck.h @@ -6,21 +6,22 @@  //  //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CERT_DEFAULTOPERATORNEWALIGNMENTCHECK_H -#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CERT_DEFAULTOPERATORNEWALIGNMENTCHECK_H +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_DEFAULTOPERATORNEWONOVERALIGNEDTYPECHECK_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_DEFAULTOPERATORNEWONOVERALIGNEDTYPECHECK_H  #include "../ClangTidyCheck.h" -namespace clang::tidy::cert { +namespace clang::tidy::bugprone {  /// Checks if an object of type with extended alignment is allocated by using  /// the default operator new.  ///  /// For the user-facing documentation see: -/// https://clang.llvm.org/extra/clang-tidy/checks/cert/mem57-cpp.html -class DefaultOperatorNewAlignmentCheck : public ClangTidyCheck { +/// https://clang.llvm.org/extra/clang-tidy/checks/bugprone/bugprone-default-operator-new-on-overaligned-type.html +class DefaultOperatorNewOnOveralignedTypeCheck : public ClangTidyCheck {  public: -  DefaultOperatorNewAlignmentCheck(StringRef Name, ClangTidyContext *Context) +  DefaultOperatorNewOnOveralignedTypeCheck(StringRef Name, +                                           ClangTidyContext *Context)        : ClangTidyCheck(Name, Context) {}    bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {      return !LangOpts.CPlusPlus17; @@ -29,6 +30,6 @@ public:    void check(const ast_matchers::MatchFinder::MatchResult &Result) override;  }; -} // namespace clang::tidy::cert +} // namespace clang::tidy::bugprone -#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CERT_DEFAULTOPERATORNEWALIGNMENTCHECK_H +#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_DEFAULTOPERATORNEWONOVERALIGNEDTYPECHECK_H diff --git a/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp b/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp index fa1eb4a..d517977 100644 --- a/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp @@ -11,6 +11,7 @@  #include "../ClangTidyModuleRegistry.h"  #include "../bugprone/BadSignalToKillThreadCheck.h"  #include "../bugprone/CommandProcessorCheck.h" +#include "../bugprone/DefaultOperatorNewOnOveralignedTypeCheck.h"  #include "../bugprone/PointerArithmeticOnPolymorphicObjectCheck.h"  #include "../bugprone/RawMemoryCallOnNonTrivialTypeCheck.h"  #include "../bugprone/ReservedIdentifierCheck.h" @@ -35,7 +36,6 @@  #include "../performance/MoveConstructorInitCheck.h"  #include "../readability/EnumInitialValueCheck.h"  #include "../readability/UppercaseLiteralSuffixCheck.h" -#include "DefaultOperatorNewAlignmentCheck.h"  #include "DontModifyStdNamespaceCheck.h"  #include "FloatLoopCounter.h"  #include "LimitedRandomnessCheck.h" @@ -265,8 +265,9 @@ public:      CheckFactories.registerCheck<misc::ThrowByValueCatchByReferenceCheck>(          "cert-err61-cpp");      // MEM -    CheckFactories.registerCheck<DefaultOperatorNewAlignmentCheck>( -        "cert-mem57-cpp"); +    CheckFactories +        .registerCheck<bugprone::DefaultOperatorNewOnOveralignedTypeCheck>( +            "cert-mem57-cpp");      // MSC      CheckFactories.registerCheck<LimitedRandomnessCheck>("cert-msc50-cpp");      CheckFactories.registerCheck<ProperlySeededRandomGeneratorCheck>( diff --git a/clang-tools-extra/clang-tidy/cert/CMakeLists.txt b/clang-tools-extra/clang-tidy/cert/CMakeLists.txt index ce57faa..db3b2f5 100644 --- a/clang-tools-extra/clang-tidy/cert/CMakeLists.txt +++ b/clang-tools-extra/clang-tidy/cert/CMakeLists.txt @@ -5,7 +5,6 @@ set(LLVM_LINK_COMPONENTS  add_clang_library(clangTidyCERTModule STATIC    CERTTidyModule.cpp -  DefaultOperatorNewAlignmentCheck.cpp    DontModifyStdNamespaceCheck.cpp    FloatLoopCounter.cpp    LimitedRandomnessCheck.cpp diff --git a/clang-tools-extra/clangd/Selection.cpp b/clang-tools-extra/clangd/Selection.cpp index 06165df..faa00d2 100644 --- a/clang-tools-extra/clangd/Selection.cpp +++ b/clang-tools-extra/clangd/Selection.cpp @@ -958,6 +958,18 @@ private:          claimRange(SourceRange(FTL.getLParenLoc(), FTL.getEndLoc()), Result);          return;        } +      if (auto ATL = TL->getAs<AttributedTypeLoc>()) { +        // For attributed function types like `int foo() [[attr]]`, the +        // AttributedTypeLoc's range includes the function name. We want to +        // allow the function name to be associated with the FunctionDecl +        // rather than the AttributedTypeLoc, so we only claim the attribute +        // range itself. +        if (ATL.getModifiedLoc().getAs<FunctionTypeLoc>()) { +          // Only claim the attribute's source range, not the whole type. +          claimRange(ATL.getLocalSourceRange(), Result); +          return; +        } +      }      }      claimRange(getSourceRange(N), Result);    } diff --git a/clang-tools-extra/clangd/refactor/tweaks/OverridePureVirtuals.cpp b/clang-tools-extra/clangd/refactor/tweaks/OverridePureVirtuals.cpp index 16febec..b557066 100644 --- a/clang-tools-extra/clangd/refactor/tweaks/OverridePureVirtuals.cpp +++ b/clang-tools-extra/clangd/refactor/tweaks/OverridePureVirtuals.cpp @@ -79,7 +79,7 @@  #include "clang/AST/ASTContext.h"  #include "clang/AST/DeclCXX.h" -#include "clang/AST/Type.h" +#include "clang/AST/TypeBase.h"  #include "clang/AST/TypeLoc.h"  #include "clang/Basic/LLVM.h"  #include "clang/Basic/SourceLocation.h" @@ -116,7 +116,8 @@ std::string removePureVirtualSyntax(const std::string &MethodDecl,      DeclString += Tk.text();      if (Tk.Kind != tok::l_paren && Next.Kind != tok::comma && -        Next.Kind != tok::r_paren && Next.Kind != tok::l_paren) +        Next.Kind != tok::r_paren && Next.Kind != tok::l_paren && +        Tk.Kind != tok::coloncolon && Next.Kind != tok::coloncolon)        DeclString += ' ';    }    // Trim the last whitespace. diff --git a/clang-tools-extra/clangd/unittests/SelectionTests.cpp b/clang-tools-extra/clangd/unittests/SelectionTests.cpp index 3df19d8..63c0403 100644 --- a/clang-tools-extra/clangd/unittests/SelectionTests.cpp +++ b/clang-tools-extra/clangd/unittests/SelectionTests.cpp @@ -311,6 +311,19 @@ TEST(SelectionTest, CommonAncestor) {        {"[[void foo^()]];", "FunctionProtoTypeLoc"},        {"[[^void foo^()]];", "FunctionDecl"},        {"[[void ^foo()]];", "FunctionDecl"}, +      // Tricky case: with function attributes, the AttributedTypeLoc's range +      // includes the function name, but we want the name to be associated with +      // the CXXMethodDecl. +      {"struct X { [[const int* ^Get() const <:[clang::lifetimebound]:> " +       "{return nullptr;}]]; };", +       "CXXMethodDecl"}, +      // When the cursor is on the attribute itself, we should select the +      // AttributedTypeLoc. Note: Due to a bug or deliberate quirk in the AST +      // modeling of AttributedTypeLoc, its range ends at the attribute name +      // token, not including the closing brackets ":>:>". +      {"struct X { const [[int* Foo() const <:<:clang::life^timebound]]:>:> " +       "{return nullptr;}; };", +       "AttributedTypeLoc"},        // Tricky case: two VarDecls share a specifier.        {"[[int ^a]], b;", "VarDecl"},        {"[[int a, ^b]];", "VarDecl"}, diff --git a/clang-tools-extra/clangd/unittests/tweaks/OverridePureVirtualsTests.cpp b/clang-tools-extra/clangd/unittests/tweaks/OverridePureVirtualsTests.cpp index b7dcbee..72095ab 100644 --- a/clang-tools-extra/clangd/unittests/tweaks/OverridePureVirtualsTests.cpp +++ b/clang-tools-extra/clangd/unittests/tweaks/OverridePureVirtualsTests.cpp @@ -715,6 +715,45 @@ public:    EXPECT_EQ(Expected, Applied) << "Applied result:\n" << Applied;  } +TEST_F(OverridePureVirtualsTests, QualifiedNames) { +  constexpr auto Before = R"cpp( +namespace foo { struct S{}; namespace bar { struct S2{}; } } + +class B { +public: +  virtual foo::S foo(int var = 0) = 0; +  virtual foo::bar::S2 bar(int var = 0) = 0; +}; + +class ^D : public B {}; +)cpp"; + +  constexpr auto Expected = R"cpp( +namespace foo { struct S{}; namespace bar { struct S2{}; } } + +class B { +public: +  virtual foo::S foo(int var = 0) = 0; +  virtual foo::bar::S2 bar(int var = 0) = 0; +}; + +class D : public B { +public: +  foo::S foo(int var = 0) override { +    // TODO: Implement this pure virtual method. +    static_assert(false, "Method `foo` is not implemented."); +  } + +  foo::bar::S2 bar(int var = 0) override { +    // TODO: Implement this pure virtual method. +    static_assert(false, "Method `bar` is not implemented."); +  } +}; +)cpp"; +  auto Applied = apply(Before); +  EXPECT_EQ(Expected, Applied) << "Applied result:\n" << Applied; +} +  } // namespace  } // namespace clangd  } // namespace clang diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index f4eeb3e..26f00e9 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -264,6 +264,11 @@ New check aliases    <clang-tidy/checks/bugprone/throwing-static-initialization>`    keeping initial check as an alias to the new one. +- Renamed :doc:`cert-mem57-cpp <clang-tidy/checks/cert/mem57-cpp>` to +  :doc:`bugprone-default-operator-new-on-overaligned-type +  <clang-tidy/checks/bugprone/default-operator-new-on-overaligned-type>` +  keeping initial check as an alias to the new one. +  - Renamed :doc:`cert-oop57-cpp <clang-tidy/checks/cert/oop57-cpp>` to    :doc:`bugprone-raw-memory-call-on-non-trivial-type    <clang-tidy/checks/bugprone/raw-memory-call-on-non-trivial-type>` @@ -374,7 +379,8 @@ Changes in existing checks    <clang-tidy/checks/misc/const-correctness>` check to avoid false    positives when pointers is transferred to non-const references    and avoid false positives of function pointer and fix false -  positives on return of non-const pointer. +  positives on return of non-const pointer and fix false positives on +  pointer-to-member operator.  - Improved :doc:`misc-header-include-cycle    <clang-tidy/checks/misc/header-include-cycle>` check performance. diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/default-operator-new-on-overaligned-type.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/default-operator-new-on-overaligned-type.rst new file mode 100644 index 0000000..c991812 --- /dev/null +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/default-operator-new-on-overaligned-type.rst @@ -0,0 +1,20 @@ +.. title:: clang-tidy - bugprone-default-operator-new-on-overaligned-type + +bugprone-default-operator-new-on-overaligned-type +================================================= + +Flags uses of default ``operator new`` where the type has extended +alignment (an alignment greater than the fundamental alignment). + +The default ``operator new`` is guaranteed to provide the correct alignment +if the requested alignment is less or equal to the fundamental alignment. +Only cases are detected (by design) where the ``operator new`` is not +user-defined and is not a placement new (the reason is that in these cases we +assume that the user provided the correct memory allocation). + +References +---------- + +This check corresponds to the CERT C++ Coding Standard rule +`MEM57-CPP. Avoid using default operator new for over-aligned types +<https://wiki.sei.cmu.edu/confluence/display/cplusplus/MEM57-CPP.+Avoid+using+default+operator+new+for+over-aligned+types>`_. diff --git a/clang-tools-extra/docs/clang-tidy/checks/cert/mem57-cpp.rst b/clang-tools-extra/docs/clang-tidy/checks/cert/mem57-cpp.rst index 135cfb8..cc0c729 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/cert/mem57-cpp.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/cert/mem57-cpp.rst @@ -3,13 +3,9 @@  cert-mem57-cpp  ============== -This check flags uses of default ``operator new`` where the type has extended -alignment (an alignment greater than the fundamental alignment). (The default -``operator new`` is guaranteed to provide the correct alignment if the -requested alignment is less or equal to the fundamental alignment). -Only cases are detected (by design) where the ``operator new`` is not -user-defined and is not a placement new (the reason is that in these cases we -assume that the user provided the correct memory allocation). +The `cert-mem57-cpp` is an aliaes, please see +`bugprone-default-operator-new-on-overaligned-type <../bugprone/default-operator-new-on-overaligned-type>`_ +for more information.  This check corresponds to the CERT C++ Coding Standard rule  `MEM57-CPP. Avoid using default operator new for over-aligned types diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst index c7a922a..e14ac71 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/list.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst @@ -92,6 +92,7 @@ Clang-Tidy Checks     :doc:`bugprone-copy-constructor-init <bugprone/copy-constructor-init>`, "Yes"     :doc:`bugprone-crtp-constructor-accessibility <bugprone/crtp-constructor-accessibility>`, "Yes"     :doc:`bugprone-dangling-handle <bugprone/dangling-handle>`, +   :doc:`bugprone-default-operator-new-on-overaligned-type <bugprone/default-operator-new-on-overaligned-type>`,     :doc:`bugprone-derived-method-shadowing-base-method <bugprone/derived-method-shadowing-base-method>`,     :doc:`bugprone-dynamic-static-initializers <bugprone/dynamic-static-initializers>`,     :doc:`bugprone-easily-swappable-parameters <bugprone/easily-swappable-parameters>`, @@ -178,7 +179,6 @@ Clang-Tidy Checks     :doc:`cert-err33-c <cert/err33-c>`,     :doc:`cert-err60-cpp <cert/err60-cpp>`,     :doc:`cert-flp30-c <cert/flp30-c>`, -   :doc:`cert-mem57-cpp <cert/mem57-cpp>`,     :doc:`cert-msc50-cpp <cert/msc50-cpp>`,     :doc:`cert-msc51-cpp <cert/msc51-cpp>`,     :doc:`cert-oop58-cpp <cert/oop58-cpp>`, @@ -452,6 +452,7 @@ Check aliases     :doc:`cert-fio38-c <cert/fio38-c>`, :doc:`misc-non-copyable-objects <misc/non-copyable-objects>`,     :doc:`cert-flp37-c <cert/flp37-c>`, :doc:`bugprone-suspicious-memory-comparison <bugprone/suspicious-memory-comparison>`,     :doc:`cert-int09-c <cert/int09-c>`, :doc:`readability-enum-initial-value <readability/enum-initial-value>`, "Yes" +   :doc:`cert-mem57-cpp <cert/mem57-cpp>`, :doc:`bugprone-default-operator-new-on-overaligned-type <bugprone/default-operator-new-on-overaligned-type>`,     :doc:`cert-msc24-c <cert/msc24-c>`, :doc:`bugprone-unsafe-functions <bugprone/unsafe-functions>`,     :doc:`cert-msc30-c <cert/msc30-c>`, :doc:`cert-msc50-cpp <cert/msc50-cpp>`,     :doc:`cert-msc32-c <cert/msc32-c>`, :doc:`cert-msc51-cpp <cert/msc51-cpp>`, diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/default-operator-new-on-overaligned-type-cpp17.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/default-operator-new-on-overaligned-type-cpp17.cpp new file mode 100644 index 0000000..b05108c --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/default-operator-new-on-overaligned-type-cpp17.cpp @@ -0,0 +1,12 @@ +// RUN: %check_clang_tidy %s -std=c++14 bugprone-default-operator-new-on-overaligned-type %t +// RUN: clang-tidy -checks='-*,bugprone-default-operator-new-on-overaligned-type' --extra-arg=-Wno-unused-variable --warnings-as-errors='*' %s -- -std=c++17 -faligned-allocation +// RUN: clang-tidy -checks='-*,bugprone-default-operator-new-on-overaligned-type' --extra-arg=-Wno-unused-variable --warnings-as-errors='*' %s -- -std=c++17 -faligned-allocation + +struct alignas(128) Vector { +  char Elems[128]; +}; + +void f() { +  auto *V1 = new Vector;        // CHECK-MESSAGES: warning: allocation function returns a pointer with alignment {{[0-9]+}} but the over-aligned type being allocated requires alignment 128 [bugprone-default-operator-new-on-overaligned-type] +  auto *V1_Arr = new Vector[2]; // CHECK-MESSAGES: warning: allocation function returns a pointer with alignment {{[0-9]+}} but the over-aligned type being allocated requires alignment 128 [bugprone-default-operator-new-on-overaligned-type] +} diff --git a/clang-tools-extra/test/clang-tidy/checkers/cert/mem57-cpp.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/default-operator-new-on-overaligned-type.cpp index e0300e3..379d8a2 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/cert/mem57-cpp.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/default-operator-new-on-overaligned-type.cpp @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy %s -std=c++14 cert-mem57-cpp %t +// RUN: %check_clang_tidy %s -std=c++14 bugprone-default-operator-new-on-overaligned-type %t  namespace std {  typedef __typeof(sizeof(int)) size_t; @@ -30,10 +30,10 @@ struct alignas(8) Vector4 {  void f() {    auto *V1 = new Vector1; -  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: allocation function returns a pointer with alignment {{[0-9]+}} but the over-aligned type being allocated requires alignment 128 [cert-mem57-cpp] +  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: allocation function returns a pointer with alignment {{[0-9]+}} but the over-aligned type being allocated requires alignment 128 [bugprone-default-operator-new-on-overaligned-type]    auto *V2 = new Vector2;    auto *V3 = new Vector3;    auto *V4 = new Vector4;    auto *V1_Arr = new Vector1[2]; -  // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: allocation function returns a pointer with alignment {{[0-9]+}} but the over-aligned type being allocated requires alignment 128 [cert-mem57-cpp] +  // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: allocation function returns a pointer with alignment {{[0-9]+}} but the over-aligned type being allocated requires alignment 128 [bugprone-default-operator-new-on-overaligned-type]  } diff --git a/clang-tools-extra/test/clang-tidy/checkers/cert/mem57-cpp-cpp17.cpp b/clang-tools-extra/test/clang-tidy/checkers/cert/mem57-cpp-cpp17.cpp deleted file mode 100644 index 38ffcbd..0000000 --- a/clang-tools-extra/test/clang-tidy/checkers/cert/mem57-cpp-cpp17.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// RUN: %check_clang_tidy %s -std=c++14 cert-mem57-cpp %t -// RUN: clang-tidy -checks='-*,cert-mem57-cpp' --extra-arg=-Wno-unused-variable --warnings-as-errors='*' %s -- -std=c++17 -faligned-allocation -// RUN: clang-tidy -checks='-*,cert-mem57-cpp' --extra-arg=-Wno-unused-variable --warnings-as-errors='*' %s -- -std=c++17 -faligned-allocation - -struct alignas(128) Vector { -  char Elems[128]; -}; - -void f() { -  auto *V1 = new Vector;        // CHECK-MESSAGES: warning: allocation function returns a pointer with alignment {{[0-9]+}} but the over-aligned type being allocated requires alignment 128 [cert-mem57-cpp] -  auto *V1_Arr = new Vector[2]; // CHECK-MESSAGES: warning: allocation function returns a pointer with alignment {{[0-9]+}} but the over-aligned type being allocated requires alignment 128 [cert-mem57-cpp] -} diff --git a/clang-tools-extra/test/pp-trace/pp-trace-include.cpp b/clang-tools-extra/test/pp-trace/pp-trace-include.cpp index ea9896e..fccbd9b 100644 --- a/clang-tools-extra/test/pp-trace/pp-trace-include.cpp +++ b/clang-tools-extra/test/pp-trace/pp-trace-include.cpp @@ -39,7 +39,6 @@  // CHECK-NEXT:   Reason: EnterFile  // CHECK-NEXT:   FileType: C_User  // CHECK-NEXT:   PrevFID: (invalid) -// CHECK:      - Callback: MacroDefined  // CHECK:      - Callback: FileChanged  // CHECK-NEXT:   Loc: "<built-in>:1:1"  // CHECK-NEXT:   Reason: ExitFile diff --git a/clang-tools-extra/test/pp-trace/pp-trace-macro.cpp b/clang-tools-extra/test/pp-trace/pp-trace-macro.cpp index 7c2a231..5bd38e0 100644 --- a/clang-tools-extra/test/pp-trace/pp-trace-macro.cpp +++ b/clang-tools-extra/test/pp-trace/pp-trace-macro.cpp @@ -40,7 +40,6 @@ X  // CHECK-NEXT:   MacroNameTok: __STDC_EMBED_EMPTY__  // CHECK-NEXT:   MacroDirective: MD_Define  // CHECK:      - Callback: MacroDefined -// CHECK:      - Callback: MacroDefined  // CHECK-NEXT:   MacroNameTok: MACRO  // CHECK-NEXT:   MacroDirective: MD_Define  // CHECK-NEXT: - Callback: MacroExpands  | 
