Skip to content

Commit 83bc89c

Browse files
authored
Merge branch 'main' into scalar_layout
2 parents 43f9f0e + e04c938 commit 83bc89c

File tree

635 files changed

+30241
-10542
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

635 files changed

+30241
-10542
lines changed

bolt/unittests/Profile/PerfSpeEvents.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct PerfSpeEventsTestHelper : public testing::Test {
6565
BC = cantFail(BinaryContext::createBinaryContext(
6666
ObjFile->makeTriple(), std::make_shared<orc::SymbolStringPool>(),
6767
ObjFile->getFileName(), nullptr, /*IsPIC*/ false,
68-
DWARFContext::create(*ObjFile.get()), {llvm::outs(), llvm::errs()}));
68+
DWARFContext::create(*ObjFile), {llvm::outs(), llvm::errs()}));
6969
ASSERT_FALSE(!BC);
7070
}
7171

clang-tools-extra/clang-tidy/cppcoreguidelines/AvoidGotoCheck.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,20 @@ namespace {
1717
AST_MATCHER(GotoStmt, isForwardJumping) {
1818
return Node.getBeginLoc() < Node.getLabel()->getBeginLoc();
1919
}
20+
21+
AST_MATCHER(GotoStmt, isInMacro) {
22+
return Node.getBeginLoc().isMacroID() && Node.getEndLoc().isMacroID();
23+
}
2024
} // namespace
2125

26+
AvoidGotoCheck::AvoidGotoCheck(StringRef Name, ClangTidyContext *Context)
27+
: ClangTidyCheck(Name, Context),
28+
IgnoreMacros(Options.get("IgnoreMacros", false)) {}
29+
30+
void AvoidGotoCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
31+
Options.store(Opts, "IgnoreMacros", IgnoreMacros);
32+
}
33+
2234
void AvoidGotoCheck::registerMatchers(MatchFinder *Finder) {
2335
// TODO: This check does not recognize `IndirectGotoStmt` which is a
2436
// GNU extension. These must be matched separately and an AST matcher
@@ -29,7 +41,10 @@ void AvoidGotoCheck::registerMatchers(MatchFinder *Finder) {
2941
auto Loop = mapAnyOf(forStmt, cxxForRangeStmt, whileStmt, doStmt);
3042
auto NestedLoop = Loop.with(hasAncestor(Loop));
3143

32-
Finder->addMatcher(gotoStmt(anyOf(unless(hasAncestor(NestedLoop)),
44+
const ast_matchers::internal::Matcher<GotoStmt> Anything = anything();
45+
46+
Finder->addMatcher(gotoStmt(IgnoreMacros ? unless(isInMacro()) : Anything,
47+
anyOf(unless(hasAncestor(NestedLoop)),
3348
unless(isForwardJumping())))
3449
.bind("goto"),
3550
this);

clang-tools-extra/clang-tidy/cppcoreguidelines/AvoidGotoCheck.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,16 @@ namespace clang::tidy::cppcoreguidelines {
2020
/// http://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/avoid-goto.html
2121
class AvoidGotoCheck : public ClangTidyCheck {
2222
public:
23-
AvoidGotoCheck(StringRef Name, ClangTidyContext *Context)
24-
: ClangTidyCheck(Name, Context) {}
23+
AvoidGotoCheck(StringRef Name, ClangTidyContext *Context);
2524
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
2625
return LangOpts.CPlusPlus;
2726
}
27+
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
2828
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
2929
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
30+
31+
private:
32+
const bool IgnoreMacros;
3033
};
3134

3235
} // namespace clang::tidy::cppcoreguidelines

clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ using namespace clang::ast_matchers;
1818

1919
namespace clang::tidy::cppcoreguidelines {
2020

21+
namespace {
22+
AST_MATCHER(CXXRecordDecl, isInMacro) {
23+
return Node.getBeginLoc().isMacroID() && Node.getEndLoc().isMacroID();
24+
}
25+
} // namespace
26+
2127
SpecialMemberFunctionsCheck::SpecialMemberFunctionsCheck(
2228
StringRef Name, ClangTidyContext *Context)
2329
: ClangTidyCheck(Name, Context), AllowMissingMoveFunctions(Options.get(
@@ -26,7 +32,8 @@ SpecialMemberFunctionsCheck::SpecialMemberFunctionsCheck(
2632
AllowMissingMoveFunctionsWhenCopyIsDeleted(
2733
Options.get("AllowMissingMoveFunctionsWhenCopyIsDeleted", false)),
2834
AllowImplicitlyDeletedCopyOrMove(
29-
Options.get("AllowImplicitlyDeletedCopyOrMove", false)) {}
35+
Options.get("AllowImplicitlyDeletedCopyOrMove", false)),
36+
IgnoreMacros(Options.get("IgnoreMacros", true)) {}
3037

3138
void SpecialMemberFunctionsCheck::storeOptions(
3239
ClangTidyOptions::OptionMap &Opts) {
@@ -36,6 +43,7 @@ void SpecialMemberFunctionsCheck::storeOptions(
3643
AllowMissingMoveFunctionsWhenCopyIsDeleted);
3744
Options.store(Opts, "AllowImplicitlyDeletedCopyOrMove",
3845
AllowImplicitlyDeletedCopyOrMove);
46+
Options.store(Opts, "IgnoreMacros", IgnoreMacros);
3947
}
4048

4149
std::optional<TraversalKind>
@@ -45,11 +53,12 @@ SpecialMemberFunctionsCheck::getCheckTraversalKind() const {
4553
}
4654

4755
void SpecialMemberFunctionsCheck::registerMatchers(MatchFinder *Finder) {
48-
auto IsNotImplicitOrDeleted = anyOf(unless(isImplicit()), isDeleted());
56+
const auto IsNotImplicitOrDeleted = anyOf(unless(isImplicit()), isDeleted());
57+
const ast_matchers::internal::Matcher<CXXRecordDecl> Anything = anything();
4958

5059
Finder->addMatcher(
5160
cxxRecordDecl(
52-
unless(isImplicit()),
61+
unless(isImplicit()), IgnoreMacros ? unless(isInMacro()) : Anything,
5362
eachOf(has(cxxDestructorDecl(unless(isImplicit())).bind("dtor")),
5463
has(cxxConstructorDecl(isCopyConstructor(),
5564
IsNotImplicitOrDeleted)

clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class SpecialMemberFunctionsCheck : public ClangTidyCheck {
6969
const bool AllowMissingMoveFunctionsWhenCopyIsDeleted;
7070
const bool AllowImplicitlyDeletedCopyOrMove;
7171
ClassDefiningSpecialMembersMap ClassWithSpecialMembers;
72+
const bool IgnoreMacros;
7273
};
7374

7475
} // namespace clang::tidy::cppcoreguidelines

clang-tools-extra/clang-tidy/readability/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ add_clang_library(clangTidyReadabilityModule STATIC
5858
UniqueptrDeleteReleaseCheck.cpp
5959
UppercaseLiteralSuffixCheck.cpp
6060
UseAnyOfAllOfCheck.cpp
61-
UseNumericLimitsCheck.cpp
6261
UseStdMinMaxCheck.cpp
6362

6463
LINK_LIBS

clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
#include "UniqueptrDeleteReleaseCheck.h"
6262
#include "UppercaseLiteralSuffixCheck.h"
6363
#include "UseAnyOfAllOfCheck.h"
64-
#include "UseNumericLimitsCheck.h"
6564
#include "UseStdMinMaxCheck.h"
6665

6766
namespace clang::tidy {
@@ -174,8 +173,6 @@ class ReadabilityModule : public ClangTidyModule {
174173
"readability-uppercase-literal-suffix");
175174
CheckFactories.registerCheck<UseAnyOfAllOfCheck>(
176175
"readability-use-anyofallof");
177-
CheckFactories.registerCheck<UseNumericLimitsCheck>(
178-
"readability-use-numeric-limits");
179176
CheckFactories.registerCheck<UseStdMinMaxCheck>(
180177
"readability-use-std-min-max");
181178
}

clang-tools-extra/clang-tidy/readability/UseNumericLimitsCheck.cpp

Lines changed: 0 additions & 160 deletions
This file was deleted.

clang-tools-extra/clang-tidy/readability/UseNumericLimitsCheck.h

Lines changed: 0 additions & 38 deletions
This file was deleted.

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,6 @@ New checks
154154
Finds potentially erroneous calls to ``reset`` method on smart pointers when
155155
the pointee type also has a ``reset`` method.
156156

157-
- New :doc:`readability-use-numeric-limits
158-
<clang-tidy/checks/readability/use-numeric-limits>` check.
159-
160-
Finds certain integer literals and suggests replacing them with equivalent
161-
``std::numeric_limits`` calls.
162-
163157
New check aliases
164158
^^^^^^^^^^^^^^^^^
165159

@@ -203,11 +197,27 @@ Changes in existing checks
203197
<clang-tidy/checks/concurrency/mt-unsafe>` check by fixing a false positive
204198
where ``strerror`` was flagged as MT-unsafe.
205199

200+
- Improved :doc:`cppcoreguidelines-avoid-goto
201+
<clang-tidy/checks/cppcoreguidelines/avoid-goto>` check by adding the option
202+
`IgnoreMacros` to ignore ``goto`` labels defined in macros.
203+
204+
- Improved :doc:`cppcoreguidelines-special-member-functions
205+
<clang-tidy/checks/cppcoreguidelines/special-member-functions>` check by
206+
adding the option `IgnoreMacros` to ignore classes defined in macros.
207+
206208
- Improved :doc:`google-readability-namespace-comments
207209
<clang-tidy/checks/google/readability-namespace-comments>` check by adding
208210
the option `AllowOmittingNamespaceComments` to accept if a namespace comment
209211
is omitted entirely.
210212

213+
- Improved :doc:`hicpp-avoid-goto
214+
<clang-tidy/checks/hicpp/avoid-goto>` check by adding the option
215+
`IgnoreMacros` to ignore ``goto`` labels defined in macros.
216+
217+
- Improved :doc:`hicpp-special-member-functions
218+
<clang-tidy/checks/hicpp/special-member-functions>` check by adding the
219+
option `IgnoreMacros` to ignore classes defined in macros.
220+
211221
- Improved :doc:`llvm-namespace-comment
212222
<clang-tidy/checks/llvm/namespace-comment>` check by adding the option
213223
`AllowOmittingNamespaceComments` to accept if a namespace comment is omitted

0 commit comments

Comments
 (0)