Skip to content

Commit 9f12dab

Browse files
committed
Merge remote-tracking branch 'origin/main' into vplan-max-cost-sentinel
2 parents 0bf2760 + 2d666de commit 9f12dab

File tree

877 files changed

+21444
-18333
lines changed

Some content is hidden

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

877 files changed

+21444
-18333
lines changed

clang-tools-extra/clang-apply-replacements/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ set(LLVM_LINK_COMPONENTS
22
Support
33
)
44

5-
add_clang_library(clangApplyReplacements
5+
add_clang_library(clangApplyReplacements STATIC
66
lib/Tooling/ApplyReplacements.cpp
77

88
DEPENDS

clang-tools-extra/clang-change-namespace/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
Support
44
)
55

6-
add_clang_library(clangChangeNamespace
6+
add_clang_library(clangChangeNamespace STATIC
77
ChangeNamespace.cpp
88

99
DEPENDS

clang-tools-extra/clang-doc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set(LLVM_LINK_COMPONENTS
44
FrontendOpenMP
55
)
66

7-
add_clang_library(clangDoc
7+
add_clang_library(clangDoc STATIC
88
BitcodeReader.cpp
99
BitcodeWriter.cpp
1010
ClangDoc.cpp

clang-tools-extra/clang-include-fixer/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ set(LLVM_LINK_COMPONENTS
22
support
33
)
44

5-
add_clang_library(clangIncludeFixer
5+
add_clang_library(clangIncludeFixer STATIC
66
IncludeFixer.cpp
77
IncludeFixerContext.cpp
88
InMemorySymbolIndex.cpp

clang-tools-extra/clang-include-fixer/find-all-symbols/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
FrontendOpenMP
44
)
55

6-
add_clang_library(findAllSymbols
6+
add_clang_library(findAllSymbols STATIC
77
FindAllSymbols.cpp
88
FindAllSymbolsAction.cpp
99
FindAllMacros.cpp

clang-tools-extra/clang-include-fixer/plugin/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
add_clang_library(clangIncludeFixerPlugin
1+
add_clang_library(clangIncludeFixerPlugin STATIC
22
IncludeFixerPlugin.cpp
33

44
LINK_LIBS

clang-tools-extra/clang-move/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
FrontendOpenMP
44
)
55

6-
add_clang_library(clangMove
6+
add_clang_library(clangMove STATIC
77
Move.cpp
88
HelperDeclRefGraph.cpp
99

clang-tools-extra/clang-query/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set(LLVM_LINK_COMPONENTS
44
FrontendOpenMP
55
)
66

7-
add_clang_library(clangQuery
7+
add_clang_library(clangQuery STATIC
88
Query.cpp
99
QueryParser.cpp
1010

clang-tools-extra/clang-reorder-fields/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
support
44
)
55

6-
add_clang_library(clangReorderFields
6+
add_clang_library(clangReorderFields STATIC
77
ReorderFieldsAction.cpp
88

99
DEPENDS

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ configure_file(
88
${CMAKE_CURRENT_BINARY_DIR}/clang-tidy-config.h)
99
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
1010

11-
add_clang_library(clangTidy
11+
add_clang_library(clangTidy STATIC
1212
ClangTidy.cpp
1313
ClangTidyCheck.cpp
1414
ClangTidyModule.cpp

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
FrontendOpenMP
44
)
55

6-
add_clang_library(clangTidyAbseilModule
6+
add_clang_library(clangTidyAbseilModule STATIC
77
AbseilTidyModule.cpp
88
CleanupCtadCheck.cpp
99
DurationAdditionCheck.cpp

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
support
44
)
55

6-
add_clang_library(clangTidyAlteraModule
6+
add_clang_library(clangTidyAlteraModule STATIC
77
AlteraTidyModule.cpp
88
IdDependentBackwardBranchCheck.cpp
99
KernelNameRestrictionCheck.cpp

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
FrontendOpenMP
44
)
55

6-
add_clang_library(clangTidyAndroidModule
6+
add_clang_library(clangTidyAndroidModule STATIC
77
AndroidTidyModule.cpp
88
CloexecAccept4Check.cpp
99
CloexecAcceptCheck.cpp

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
FrontendOpenMP
44
)
55

6-
add_clang_library(clangTidyBoostModule
6+
add_clang_library(clangTidyBoostModule STATIC
77
BoostTidyModule.cpp
88
UseRangesCheck.cpp
99
UseToStringCheck.cpp

clang-tools-extra/clang-tidy/boost/UseRangesCheck.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ utils::UseRangesCheck::ReplacerMap UseRangesCheck::getReplacerMap() const {
204204
ReplacerMap Results;
205205
static const Signature SingleSig = {{0}};
206206
static const Signature TwoSig = {{0}, {2}};
207-
static const auto AddFrom =
207+
const auto AddFrom =
208208
[&Results](llvm::IntrusiveRefCntPtr<UseRangesCheck::Replacer> Replacer,
209209
std::initializer_list<StringRef> Names, StringRef Prefix) {
210210
llvm::SmallString<64> Buffer;
@@ -214,17 +214,17 @@ utils::UseRangesCheck::ReplacerMap UseRangesCheck::getReplacerMap() const {
214214
}
215215
};
216216

217-
static const auto AddFromStd =
218-
[](llvm::IntrusiveRefCntPtr<UseRangesCheck::Replacer> Replacer,
219-
std::initializer_list<StringRef> Names) {
217+
const auto AddFromStd =
218+
[&](llvm::IntrusiveRefCntPtr<UseRangesCheck::Replacer> Replacer,
219+
std::initializer_list<StringRef> Names) {
220220
AddFrom(Replacer, Names, "std");
221221
};
222222

223-
static const auto AddFromBoost =
224-
[](llvm::IntrusiveRefCntPtr<UseRangesCheck::Replacer> Replacer,
225-
std::initializer_list<
226-
std::pair<StringRef, std::initializer_list<StringRef>>>
227-
NamespaceAndNames) {
223+
const auto AddFromBoost =
224+
[&](llvm::IntrusiveRefCntPtr<UseRangesCheck::Replacer> Replacer,
225+
std::initializer_list<
226+
std::pair<StringRef, std::initializer_list<StringRef>>>
227+
NamespaceAndNames) {
228228
for (auto [Namespace, Names] : NamespaceAndNames)
229229
AddFrom(Replacer, Names,
230230
SmallString<64>{"boost", (Namespace.empty() ? "" : "::"),
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//===--- BitwisePointerCastCheck.cpp - clang-tidy -------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "BitwisePointerCastCheck.h"
10+
#include "clang/ASTMatchers/ASTMatchFinder.h"
11+
12+
using namespace clang::ast_matchers;
13+
14+
namespace clang::tidy::bugprone {
15+
16+
void BitwisePointerCastCheck::registerMatchers(MatchFinder *Finder) {
17+
if (getLangOpts().CPlusPlus20) {
18+
auto IsPointerType = refersToType(qualType(isAnyPointer()));
19+
Finder->addMatcher(callExpr(hasDeclaration(functionDecl(allOf(
20+
hasName("::std::bit_cast"),
21+
hasTemplateArgument(0, IsPointerType),
22+
hasTemplateArgument(1, IsPointerType)))))
23+
.bind("bit_cast"),
24+
this);
25+
}
26+
27+
auto IsDoublePointerType =
28+
hasType(qualType(pointsTo(qualType(isAnyPointer()))));
29+
Finder->addMatcher(callExpr(hasArgument(0, IsDoublePointerType),
30+
hasArgument(1, IsDoublePointerType),
31+
hasDeclaration(functionDecl(hasName("::memcpy"))))
32+
.bind("memcpy"),
33+
this);
34+
}
35+
36+
void BitwisePointerCastCheck::check(const MatchFinder::MatchResult &Result) {
37+
if (const auto *Call = Result.Nodes.getNodeAs<CallExpr>("bit_cast"))
38+
diag(Call->getBeginLoc(),
39+
"do not use 'std::bit_cast' to cast between pointers")
40+
<< Call->getSourceRange();
41+
else if (const auto *Call = Result.Nodes.getNodeAs<CallExpr>("memcpy"))
42+
diag(Call->getBeginLoc(), "do not use 'memcpy' to cast between pointers")
43+
<< Call->getSourceRange();
44+
}
45+
46+
} // namespace clang::tidy::bugprone
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//===--- BitwisePointerCastCheck.h - clang-tidy -----------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_BITWISEPOINTERCASTCHECK_H
10+
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_BITWISEPOINTERCASTCHECK_H
11+
12+
#include "../ClangTidyCheck.h"
13+
14+
namespace clang::tidy::bugprone {
15+
16+
/// Warns about code that tries to cast between pointers by means of
17+
/// ``std::bit_cast`` or ``memcpy``.
18+
///
19+
/// For the user-facing documentation see:
20+
/// http://clang.llvm.org/extra/clang-tidy/checks/bugprone/bitwise-pointer-cast.html
21+
class BitwisePointerCastCheck : public ClangTidyCheck {
22+
public:
23+
BitwisePointerCastCheck(StringRef Name, ClangTidyContext *Context)
24+
: ClangTidyCheck(Name, Context) {}
25+
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
26+
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
27+
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
28+
return LangOpts.CPlusPlus;
29+
}
30+
};
31+
32+
} // namespace clang::tidy::bugprone
33+
34+
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_BITWISEPOINTERCASTCHECK_H

clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "AssertSideEffectCheck.h"
1515
#include "AssignmentInIfConditionCheck.h"
1616
#include "BadSignalToKillThreadCheck.h"
17+
#include "BitwisePointerCastCheck.h"
1718
#include "BoolPointerImplicitConversionCheck.h"
1819
#include "BranchCloneCheck.h"
1920
#include "CastingThroughVoidCheck.h"
@@ -109,6 +110,8 @@ class BugproneModule : public ClangTidyModule {
109110
"bugprone-assignment-in-if-condition");
110111
CheckFactories.registerCheck<BadSignalToKillThreadCheck>(
111112
"bugprone-bad-signal-to-kill-thread");
113+
CheckFactories.registerCheck<BitwisePointerCastCheck>(
114+
"bugprone-bitwise-pointer-cast");
112115
CheckFactories.registerCheck<BoolPointerImplicitConversionCheck>(
113116
"bugprone-bool-pointer-implicit-conversion");
114117
CheckFactories.registerCheck<BranchCloneCheck>("bugprone-branch-clone");

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ set(LLVM_LINK_COMPONENTS
33
FrontendOpenMP
44
)
55

6-
add_clang_library(clangTidyBugproneModule
6+
add_clang_library(clangTidyBugproneModule STATIC
77
ArgumentCommentCheck.cpp
88
AssertSideEffectCheck.cpp
99
AssignmentInIfConditionCheck.cpp
1010
BadSignalToKillThreadCheck.cpp
11+
BitwisePointerCastCheck.cpp
1112
BoolPointerImplicitConversionCheck.cpp
1213
BranchCloneCheck.cpp
1314
BugproneTidyModule.cpp

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
FrontendOpenMP
44
)
55

6-
add_clang_library(clangTidyCERTModule
6+
add_clang_library(clangTidyCERTModule STATIC
77
CERTTidyModule.cpp
88
CommandProcessorCheck.cpp
99
DefaultOperatorNewAlignmentCheck.cpp

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
Support
44
)
55

6-
add_clang_library(clangTidyConcurrencyModule
6+
add_clang_library(clangTidyConcurrencyModule STATIC
77
ConcurrencyTidyModule.cpp
88
MtUnsafeCheck.cpp
99
ThreadCanceltypeAsynchronousCheck.cpp

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
Support
44
)
55

6-
add_clang_library(clangTidyCppCoreGuidelinesModule
6+
add_clang_library(clangTidyCppCoreGuidelinesModule STATIC
77
AvoidCapturingLambdaCoroutinesCheck.cpp
88
AvoidConstOrRefDataMembersCheck.cpp
99
AvoidDoWhileCheck.cpp

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
Support
44
)
55

6-
add_clang_library(clangTidyDarwinModule
6+
add_clang_library(clangTidyDarwinModule STATIC
77
AvoidSpinlockCheck.cpp
88
DarwinTidyModule.cpp
99
DispatchOnceNonstaticCheck.cpp

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
Support
44
)
55

6-
add_clang_library(clangTidyFuchsiaModule
6+
add_clang_library(clangTidyFuchsiaModule STATIC
77
DefaultArgumentsCallsCheck.cpp
88
DefaultArgumentsDeclarationsCheck.cpp
99
FuchsiaTidyModule.cpp

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
Support
44
)
55

6-
add_clang_library(clangTidyGoogleModule
6+
add_clang_library(clangTidyGoogleModule STATIC
77
AvoidCStyleCastsCheck.cpp
88
AvoidNSObjectNewCheck.cpp
99
AvoidThrowingObjCExceptionCheck.cpp

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
Support
44
)
55

6-
add_clang_library(clangTidyHICPPModule
6+
add_clang_library(clangTidyHICPPModule STATIC
77
ExceptionBaseclassCheck.cpp
88
HICPPTidyModule.cpp
99
IgnoredRemoveResultCheck.cpp

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
Support
44
)
55

6-
add_clang_library(clangTidyLinuxKernelModule
6+
add_clang_library(clangTidyLinuxKernelModule STATIC
77
LinuxKernelTidyModule.cpp
88
MustCheckErrsCheck.cpp
99

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
Support
44
)
55

6-
add_clang_library(clangTidyLLVMModule
6+
add_clang_library(clangTidyLLVMModule STATIC
77
HeaderGuardCheck.cpp
88
IncludeOrderCheck.cpp
99
LLVMTidyModule.cpp

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
Support
44
)
55

6-
add_clang_library(clangTidyLLVMLibcModule
6+
add_clang_library(clangTidyLLVMLibcModule STATIC
77
CalleeNamespaceCheck.cpp
88
ImplementationInNamespaceCheck.cpp
99
InlineFunctionDeclCheck.cpp

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ add_custom_command(
1717
add_custom_target(genconfusable DEPENDS Confusables.inc)
1818
set_target_properties(genconfusable PROPERTIES FOLDER "Clang Tools Extra/Sourcegenning")
1919

20-
add_clang_library(clangTidyMiscModule
20+
add_clang_library(clangTidyMiscModule STATIC
2121
ConstCorrectnessCheck.cpp
2222
CoroutineHostileRAIICheck.cpp
2323
DefinitionsInHeadersCheck.cpp

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
Support
44
)
55

6-
add_clang_library(clangTidyModernizeModule
6+
add_clang_library(clangTidyModernizeModule STATIC
77
AvoidBindCheck.cpp
88
AvoidCArraysCheck.cpp
99
ConcatNestedNamespacesCheck.cpp

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
Support
44
)
55

6-
add_clang_library(clangTidyMPIModule
6+
add_clang_library(clangTidyMPIModule STATIC
77
BufferDerefCheck.cpp
88
MPITidyModule.cpp
99
TypeMismatchCheck.cpp

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
Support
44
)
55

6-
add_clang_library(clangTidyObjCModule
6+
add_clang_library(clangTidyObjCModule STATIC
77
AssertEquals.cpp
88
AvoidNSErrorInitCheck.cpp
99
DeallocInCategoryCheck.cpp

0 commit comments

Comments
 (0)