Skip to content

Commit 19809d1

Browse files
authored
Merge branch 'main' into clang-freeze-padding-in-vectors
2 parents dd821bb + c2aa22f commit 19809d1

File tree

384 files changed

+76065
-9326
lines changed

Some content is hidden

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

384 files changed

+76065
-9326
lines changed

bolt/include/bolt/Passes/MarkRAStates.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@
1313
#define BOLT_PASSES_MARK_RA_STATES
1414

1515
#include "bolt/Passes/BinaryPasses.h"
16+
#include <mutex>
1617

1718
namespace llvm {
1819
namespace bolt {
1920

2021
class MarkRAStates : public BinaryFunctionPass {
22+
// setIgnored() is not thread-safe, but the pass is running on functions in
23+
// parallel.
24+
std::mutex IgnoreMutex;
25+
2126
public:
2227
explicit MarkRAStates() : BinaryFunctionPass(false) {}
2328

bolt/lib/Passes/MarkRAStates.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ bool MarkRAStates::runOnFunction(BinaryFunction &BF) {
4343
// Not all functions have .cfi_negate_ra_state in them. But if one does,
4444
// we expect psign/pauth instructions to have the hasNegateRAState
4545
// annotation.
46-
BF.setIgnored();
4746
BC.outs() << "BOLT-INFO: inconsistent RAStates in function "
4847
<< BF.getPrintName()
4948
<< ": ptr sign/auth inst without .cfi_negate_ra_state\n";
49+
std::lock_guard<std::mutex> Lock(IgnoreMutex);
50+
BF.setIgnored();
5051
return false;
5152
}
5253
}
@@ -67,6 +68,7 @@ bool MarkRAStates::runOnFunction(BinaryFunction &BF) {
6768
BC.outs() << "BOLT-INFO: inconsistent RAStates in function "
6869
<< BF.getPrintName()
6970
<< ": ptr signing inst encountered in Signed RA state\n";
71+
std::lock_guard<std::mutex> Lock(IgnoreMutex);
7072
BF.setIgnored();
7173
return false;
7274
}
@@ -80,6 +82,7 @@ bool MarkRAStates::runOnFunction(BinaryFunction &BF) {
8082
<< BF.getPrintName()
8183
<< ": ptr authenticating inst encountered in Unsigned RA "
8284
"state\n";
85+
std::lock_guard<std::mutex> Lock(IgnoreMutex);
8386
BF.setIgnored();
8487
return false;
8588
}

bolt/test/X86/dwarf4-ftypes-dwp-input-dwo-output.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# UNSUPPORTED: system-linux
21
; RUN: rm -rf %t
32
; RUN: mkdir %t
43
; RUN: cd %t

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,26 @@ void MacroUsageCheck::registerPPCallbacks(const SourceManager &SM,
8282
void MacroUsageCheck::warnMacro(const MacroDirective *MD, StringRef MacroName) {
8383
const MacroInfo *Info = MD->getMacroInfo();
8484
StringRef Message;
85+
bool MacroBodyExpressionLike;
86+
if (Info->getNumTokens() > 0) {
87+
const Token &Tok = Info->getReplacementToken(0);
88+
// Now notice that keywords like `__attribute` cannot be a leading
89+
// token in an expression.
90+
MacroBodyExpressionLike = !Tok.is(tok::kw___attribute);
91+
} else {
92+
MacroBodyExpressionLike = true;
93+
}
8594

8695
if (llvm::all_of(Info->tokens(), std::mem_fn(&Token::isLiteral)))
8796
Message = "macro '%0' used to declare a constant; consider using a "
8897
"'constexpr' constant";
8998
// A variadic macro is function-like at the same time. Therefore variadic
9099
// macros are checked first and will be excluded for the function-like
91100
// diagnostic.
92-
else if (Info->isVariadic())
101+
else if (Info->isVariadic() && MacroBodyExpressionLike)
93102
Message = "variadic macro '%0' used; consider using a 'constexpr' "
94103
"variadic template function";
95-
else if (Info->isFunctionLike())
104+
else if (Info->isFunctionLike() && MacroBodyExpressionLike)
96105
Message = "function-like macro '%0' used; consider a 'constexpr' template "
97106
"function";
98107

clang-tools-extra/clang-tidy/modernize/UseScopedLockCheck.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ void UseScopedLockCheck::diagOnSingleLock(
217217

218218
// Create Fix-its only if we can find the constructor call to properly handle
219219
// 'std::lock_guard l(m, std::adopt_lock)' case.
220-
const auto *CtorCall = dyn_cast<CXXConstructExpr>(LockGuard->getInit());
220+
const auto *CtorCall =
221+
dyn_cast_if_present<CXXConstructExpr>(LockGuard->getInit());
221222
if (!CtorCall)
222223
return;
223224

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,18 @@ namespace readability {
8383
m(Member) \
8484
m(ClassConstant) \
8585
m(ClassMember) \
86+
m(ClassConstexpr) \
87+
m(GlobalConstexprVariable) \
8688
m(GlobalConstant) \
8789
m(GlobalConstantPointer) \
8890
m(GlobalPointer) \
8991
m(GlobalVariable) \
92+
m(LocalConstexprVariable) \
9093
m(LocalConstant) \
9194
m(LocalConstantPointer) \
9295
m(LocalPointer) \
9396
m(LocalVariable) \
97+
m(StaticConstexprVariable) \
9498
m(StaticConstant) \
9599
m(StaticVariable) \
96100
m(Constant) \
@@ -1497,8 +1501,22 @@ StyleKind IdentifierNamingCheck::findStyleKindForField(
14971501
StyleKind IdentifierNamingCheck::findStyleKindForVar(
14981502
const VarDecl *Var, QualType Type,
14991503
ArrayRef<std::optional<NamingStyle>> NamingStyles) const {
1500-
if (Var->isConstexpr() && NamingStyles[SK_ConstexprVariable])
1501-
return SK_ConstexprVariable;
1504+
if (Var->isConstexpr()) {
1505+
if (Var->isStaticDataMember() && NamingStyles[SK_ClassConstexpr])
1506+
return SK_ClassConstexpr;
1507+
1508+
if (Var->isFileVarDecl() && NamingStyles[SK_GlobalConstexprVariable])
1509+
return SK_GlobalConstexprVariable;
1510+
1511+
if (Var->isStaticLocal() && NamingStyles[SK_StaticConstexprVariable])
1512+
return SK_StaticConstexprVariable;
1513+
1514+
if (Var->isLocalVarDecl() && NamingStyles[SK_LocalConstexprVariable])
1515+
return SK_LocalConstexprVariable;
1516+
1517+
if (NamingStyles[SK_ConstexprVariable])
1518+
return SK_ConstexprVariable;
1519+
}
15021520

15031521
if (!Type.isNull() && Type.isConstQualified()) {
15041522
if (Var->isStaticDataMember() && NamingStyles[SK_ClassConstant])

0 commit comments

Comments
 (0)