Skip to content

Commit aaa8032

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:0012b1ea84e671a9e0c9f7f2d1564315ed9cbcca into amd-gfx:b8aa986939d6
Local branch amd-gfx b8aa986 Manually Merged main:f52d29c9ab7d3c712d36c28d00adc95fe7d52805 into amd-gfx:88b9a742871e Remote branch main 0012b1e [libc++] Refactor flaky tests for std::shared_lock (llvm#91779)
2 parents b8aa986 + 0012b1e commit aaa8032

File tree

90 files changed

+3376
-1397
lines changed

Some content is hidden

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

90 files changed

+3376
-1397
lines changed

.ci/generate-buildkite-pipeline-premerge

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function compute-projects-to-test() {
6868
done
6969
;;
7070
clang)
71-
for p in clang-tools-extra compiler-rt flang lldb cross-project-tests; do
71+
for p in clang-tools-extra compiler-rt lldb cross-project-tests; do
7272
echo $p
7373
done
7474
;;

clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ static const NamedDecl *getFailureForNamedDecl(const NamedDecl *ND) {
123123
if (const auto *Method = dyn_cast<CXXMethodDecl>(ND)) {
124124
if (const CXXMethodDecl *Overridden = getOverrideMethod(Method))
125125
Canonical = cast<NamedDecl>(Overridden->getCanonicalDecl());
126+
else if (const FunctionTemplateDecl *Primary = Method->getPrimaryTemplate())
127+
if (const FunctionDecl *TemplatedDecl = Primary->getTemplatedDecl())
128+
Canonical = cast<NamedDecl>(TemplatedDecl->getCanonicalDecl());
126129

127130
if (Canonical != ND)
128131
return Canonical;

clang-tools-extra/clangd/test/infinite-instantiation.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: rm -rf %t.dir && mkdir -p %t.dir
2-
// RUN: echo '[{"directory": "%/t.dir", "command": "clang -ftemplate-depth=100 -x c++ %s", "file": "%/s"}]' > %t.dir/compile_commands.json
2+
// RUN: echo '[{"directory": "%/t.dir", "command": "clang -ftemplate-depth=100 -x c++ %/s", "file": "%/s"}]' > %t.dir/compile_commands.json
33
// RUN: not clangd --compile-commands-dir=%t.dir -check=%s 2>&1 | FileCheck -strict-whitespace %s
44

55
// CHECK: [template_recursion_depth_exceeded]

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,8 @@ Changes in existing checks
375375
<clang-tidy/checks/readability/identifier-naming>` check in `GetConfigPerFile`
376376
mode by resolving symbolic links to header files. Fixed handling of Hungarian
377377
Prefix when configured to `LowerCase`. Added support for renaming designated
378-
initializers. Added support for renaming macro arguments.
378+
initializers. Added support for renaming macro arguments. Fixed renaming
379+
conflicts arising from out-of-line member function template definitions.
379380

380381
- Improved :doc:`readability-implicit-bool-conversion
381382
<clang-tidy/checks/readability/implicit-bool-conversion>` check to provide
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// RUN: %check_clang_tidy %s readability-identifier-naming %t -std=c++20 \
2+
// RUN: --config='{CheckOptions: { \
3+
// RUN: readability-identifier-naming.MethodCase: CamelCase, \
4+
// RUN: }}'
5+
6+
namespace SomeNamespace {
7+
namespace Inner {
8+
9+
class SomeClass {
10+
public:
11+
template <typename T>
12+
int someMethod();
13+
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for method 'someMethod' [readability-identifier-naming]
14+
// CHECK-FIXES: {{^}} int SomeMethod();
15+
};
16+
template <typename T>
17+
int SomeClass::someMethod() {
18+
// CHECK-FIXES: {{^}}int SomeClass::SomeMethod() {
19+
return 5;
20+
}
21+
22+
} // namespace Inner
23+
24+
void someFunc() {
25+
Inner::SomeClass S;
26+
S.someMethod<int>();
27+
// CHECK-FIXES: {{^}} S.SomeMethod<int>();
28+
}
29+
30+
} // namespace SomeNamespace

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -599,9 +599,6 @@ def warn_drv_unsupported_gpopt : Warning<
599599
"ignoring '-mgpopt' option as it cannot be used with %select{|the implicit"
600600
" usage of }0-mabicalls">,
601601
InGroup<UnsupportedGPOpt>;
602-
def warn_drv_unsupported_tocdata: Warning<
603-
"ignoring '-mtocdata' as it is only supported for -mcmodel=small">,
604-
InGroup<OptionIgnored>;
605602
def warn_drv_unsupported_sdata : Warning<
606603
"ignoring '-msmall-data-limit=' with -mcmodel=large for -fpic or RV64">,
607604
InGroup<OptionIgnored>;

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ def err_invalid_vector_long_double_decl_spec : Error<
310310
def err_invalid_vector_complex_decl_spec : Error<
311311
"cannot use '_Complex' with '__vector'">;
312312
def warn_vector_long_decl_spec_combination : Warning<
313-
"Use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>;
313+
"use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>;
314314

315315
def err_redeclaration_different_type : Error<
316316
"redeclaration of %0 with a different type%diff{: $ vs $|}1,2">;
@@ -3975,7 +3975,7 @@ def warn_acquired_before : Warning<
39753975
"%0 '%1' must be acquired before '%2'">,
39763976
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
39773977
def warn_acquired_before_after_cycle : Warning<
3978-
"Cycle in acquired_before/after dependencies, starting with '%0'">,
3978+
"cycle in acquired_before/after dependencies, starting with '%0'">,
39793979
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
39803980

39813981

@@ -8003,9 +8003,9 @@ def warn_deprecated_altivec_src_compat : Warning<
80038003
InGroup<DiagGroup<"deprecated-altivec-src-compat">>;
80048004

80058005
def warn_deprecated_lax_vec_conv_all : Warning<
8006-
"Implicit conversion between vector types ('%0' and '%1') is deprecated. "
8007-
"In the future, the behavior implied by '-fno-lax-vector-conversions' "
8008-
"will be the default.">,
8006+
"implicit conversion between vector types ('%0' and '%1') is deprecated; "
8007+
"in the future, the behavior implied by '-fno-lax-vector-conversions' "
8008+
"will be the default">,
80098009
InGroup<DiagGroup<"deprecate-lax-vec-conv-all">>;
80108010

80118011
def err_catch_incomplete_ptr : Error<
@@ -8853,7 +8853,7 @@ def err_atomic_exclusive_builtin_pointer_size : Error<
88538853
"address argument to load or store exclusive builtin must be a pointer to"
88548854
" 1,2,4 or 8 byte type (%0 invalid)">;
88558855
def err_atomic_builtin_ext_int_size : Error<
8856-
"Atomic memory operand must have a power-of-two size">;
8856+
"atomic memory operand must have a power-of-two size">;
88578857
def err_atomic_builtin_bit_int_prohibit : Error<
88588858
"argument to atomic builtin of type '_BitInt' is not supported">;
88598859
def err_atomic_op_needs_atomic : Error<

clang/include/clang/Parse/Parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2814,7 +2814,7 @@ class Parser : public CodeCompletionHandler {
28142814
SourceLocation CorrectLocation);
28152815

28162816
void stripTypeAttributesOffDeclSpec(ParsedAttributes &Attrs, DeclSpec &DS,
2817-
Sema::TagUseKind TUK);
2817+
TagUseKind TUK);
28182818

28192819
// FixItLoc = possible correct location for the attributes
28202820
void ProhibitAttributes(ParsedAttributes &Attrs,

clang/include/clang/Sema/Sema.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,13 @@ enum class CheckedConversionKind {
447447
ForBuiltinOverloadedOp
448448
};
449449

450+
enum class TagUseKind {
451+
Reference, // Reference to a tag: 'struct foo *X;'
452+
Declaration, // Fwd decl of a tag: 'struct foo;'
453+
Definition, // Definition of a tag: 'struct foo { int X; } Y;'
454+
Friend // Friend declaration: 'friend struct foo;'
455+
};
456+
450457
/// Sema - This implements semantic analysis and AST building for C.
451458
/// \nosubgrouping
452459
class Sema final : public SemaBase {
@@ -3168,13 +3175,6 @@ class Sema final : public SemaBase {
31683175
bool isDefinition, SourceLocation NewTagLoc,
31693176
const IdentifierInfo *Name);
31703177

3171-
enum TagUseKind {
3172-
TUK_Reference, // Reference to a tag: 'struct foo *X;'
3173-
TUK_Declaration, // Fwd decl of a tag: 'struct foo;'
3174-
TUK_Definition, // Definition of a tag: 'struct foo { int X; } Y;'
3175-
TUK_Friend // Friend declaration: 'friend struct foo;'
3176-
};
3177-
31783178
enum OffsetOfKind {
31793179
// Not parsing a type within __builtin_offsetof.
31803180
OOK_Outside,

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5740,15 +5740,17 @@ CodeGenModule::getLLVMLinkageVarDefinition(const VarDecl *VD) {
57405740
static void replaceUsesOfNonProtoConstant(llvm::Constant *old,
57415741
llvm::Function *newFn) {
57425742
// Fast path.
5743-
if (old->use_empty()) return;
5743+
if (old->use_empty())
5744+
return;
57445745

57455746
llvm::Type *newRetTy = newFn->getReturnType();
5746-
SmallVector<llvm::Value*, 4> newArgs;
5747+
SmallVector<llvm::Value *, 4> newArgs;
5748+
5749+
SmallVector<llvm::CallBase *> callSitesToBeRemovedFromParent;
57475750

57485751
for (llvm::Value::use_iterator ui = old->use_begin(), ue = old->use_end();
5749-
ui != ue; ) {
5750-
llvm::Value::use_iterator use = ui++; // Increment before the use is erased.
5751-
llvm::User *user = use->getUser();
5752+
ui != ue; ui++) {
5753+
llvm::User *user = ui->getUser();
57525754

57535755
// Recognize and replace uses of bitcasts. Most calls to
57545756
// unprototyped functions will use bitcasts.
@@ -5760,8 +5762,9 @@ static void replaceUsesOfNonProtoConstant(llvm::Constant *old,
57605762

57615763
// Recognize calls to the function.
57625764
llvm::CallBase *callSite = dyn_cast<llvm::CallBase>(user);
5763-
if (!callSite) continue;
5764-
if (!callSite->isCallee(&*use))
5765+
if (!callSite)
5766+
continue;
5767+
if (!callSite->isCallee(&*ui))
57655768
continue;
57665769

57675770
// If the return types don't match exactly, then we can't
@@ -5830,6 +5833,10 @@ static void replaceUsesOfNonProtoConstant(llvm::Constant *old,
58305833
if (callSite->getDebugLoc())
58315834
newCall->setDebugLoc(callSite->getDebugLoc());
58325835

5836+
callSitesToBeRemovedFromParent.push_back(callSite);
5837+
}
5838+
5839+
for (auto *callSite : callSitesToBeRemovedFromParent) {
58335840
callSite->eraseFromParent();
58345841
}
58355842
}

clang/lib/Driver/ToolChains/AIX.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -479,14 +479,6 @@ static void addTocDataOptions(const llvm::opt::ArgList &Args,
479479
return false;
480480
}();
481481

482-
// Currently only supported for small code model.
483-
if (TOCDataGloballyinEffect &&
484-
(Args.getLastArgValue(options::OPT_mcmodel_EQ) == "large" ||
485-
Args.getLastArgValue(options::OPT_mcmodel_EQ) == "medium")) {
486-
D.Diag(clang::diag::warn_drv_unsupported_tocdata);
487-
return;
488-
}
489-
490482
enum TOCDataSetting {
491483
AddressInTOC = 0, // Address of the symbol stored in the TOC.
492484
DataInTOC = 1 // Symbol defined in the TOC.

clang/lib/Interpreter/IncrementalParser.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,7 @@ std::unique_ptr<llvm::Module> IncrementalParser::GenModule() {
387387

388388
void IncrementalParser::CleanUpPTU(PartialTranslationUnit &PTU) {
389389
TranslationUnitDecl *MostRecentTU = PTU.TUPart;
390-
TranslationUnitDecl *FirstTU = MostRecentTU->getFirstDecl();
391-
if (StoredDeclsMap *Map = FirstTU->getPrimaryContext()->getLookupPtr()) {
390+
if (StoredDeclsMap *Map = MostRecentTU->getPrimaryContext()->getLookupPtr()) {
392391
for (auto &&[Key, List] : *Map) {
393392
DeclContextLookupResult R = List.getLookupResult();
394393
std::vector<NamedDecl *> NamedDeclsToRemove;
@@ -407,6 +406,16 @@ void IncrementalParser::CleanUpPTU(PartialTranslationUnit &PTU) {
407406
}
408407
}
409408
}
409+
410+
// FIXME: We should de-allocate MostRecentTU
411+
for (Decl *D : MostRecentTU->decls()) {
412+
auto *ND = dyn_cast<NamedDecl>(D);
413+
if (!ND)
414+
continue;
415+
// Check if we need to clean up the IdResolver chain.
416+
if (ND->getDeclName().getFETokenInfo())
417+
getCI()->getSema().IdResolver.RemoveDecl(ND);
418+
}
410419
}
411420

412421
llvm::StringRef IncrementalParser::GetMangledName(GlobalDecl GD) const {

clang/lib/Parse/ParseDecl.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,9 +1923,8 @@ void Parser::DiagnoseCXX11AttributeExtension(ParsedAttributes &Attrs) {
19231923
// variable.
19241924
// This function moves attributes that should apply to the type off DS to Attrs.
19251925
void Parser::stripTypeAttributesOffDeclSpec(ParsedAttributes &Attrs,
1926-
DeclSpec &DS,
1927-
Sema::TagUseKind TUK) {
1928-
if (TUK == Sema::TUK_Reference)
1926+
DeclSpec &DS, TagUseKind TUK) {
1927+
if (TUK == TagUseKind::Reference)
19291928
return;
19301929

19311930
llvm::SmallVector<ParsedAttr *, 1> ToBeMoved;
@@ -5287,9 +5286,9 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
52875286
// enum foo {..}; void bar() { enum foo; } <- new foo in bar.
52885287
// enum foo {..}; void bar() { enum foo x; } <- use of old foo.
52895288
//
5290-
Sema::TagUseKind TUK;
5289+
TagUseKind TUK;
52915290
if (AllowEnumSpecifier == AllowDefiningTypeSpec::No)
5292-
TUK = Sema::TUK_Reference;
5291+
TUK = TagUseKind::Reference;
52935292
else if (Tok.is(tok::l_brace)) {
52945293
if (DS.isFriendSpecified()) {
52955294
Diag(Tok.getLocation(), diag::err_friend_decl_defines_type)
@@ -5301,9 +5300,9 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
53015300
ScopedEnumKWLoc = SourceLocation();
53025301
IsScopedUsingClassTag = false;
53035302
BaseType = TypeResult();
5304-
TUK = Sema::TUK_Friend;
5303+
TUK = TagUseKind::Friend;
53055304
} else {
5306-
TUK = Sema::TUK_Definition;
5305+
TUK = TagUseKind::Definition;
53075306
}
53085307
} else if (!isTypeSpecifier(DSC) &&
53095308
(Tok.is(tok::semi) ||
@@ -5312,29 +5311,29 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
53125311
// An opaque-enum-declaration is required to be standalone (no preceding or
53135312
// following tokens in the declaration). Sema enforces this separately by
53145313
// diagnosing anything else in the DeclSpec.
5315-
TUK = DS.isFriendSpecified() ? Sema::TUK_Friend : Sema::TUK_Declaration;
5314+
TUK = DS.isFriendSpecified() ? TagUseKind::Friend : TagUseKind::Declaration;
53165315
if (Tok.isNot(tok::semi)) {
53175316
// A semicolon was missing after this declaration. Diagnose and recover.
53185317
ExpectAndConsume(tok::semi, diag::err_expected_after, "enum");
53195318
PP.EnterToken(Tok, /*IsReinject=*/true);
53205319
Tok.setKind(tok::semi);
53215320
}
53225321
} else {
5323-
TUK = Sema::TUK_Reference;
5322+
TUK = TagUseKind::Reference;
53245323
}
53255324

53265325
bool IsElaboratedTypeSpecifier =
5327-
TUK == Sema::TUK_Reference || TUK == Sema::TUK_Friend;
5326+
TUK == TagUseKind::Reference || TUK == TagUseKind::Friend;
53285327

53295328
// If this is an elaborated type specifier nested in a larger declaration,
53305329
// and we delayed diagnostics before, just merge them into the current pool.
5331-
if (TUK == Sema::TUK_Reference && shouldDelayDiagsInTag) {
5330+
if (TUK == TagUseKind::Reference && shouldDelayDiagsInTag) {
53325331
diagsFromTag.redelay();
53335332
}
53345333

53355334
MultiTemplateParamsArg TParams;
53365335
if (TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate &&
5337-
TUK != Sema::TUK_Reference) {
5336+
TUK != TagUseKind::Reference) {
53385337
if (!getLangOpts().CPlusPlus11 || !SS.isSet()) {
53395338
// Skip the rest of this declarator, up until the comma or semicolon.
53405339
Diag(Tok, diag::err_enum_template);
@@ -5355,7 +5354,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
53555354
SS.setTemplateParamLists(TParams);
53565355
}
53575356

5358-
if (!Name && TUK != Sema::TUK_Definition) {
5357+
if (!Name && TUK != TagUseKind::Definition) {
53595358
Diag(Tok, diag::err_enumerator_unnamed_no_def);
53605359

53615360
DS.SetTypeSpecError();
@@ -5388,7 +5387,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
53885387
stripTypeAttributesOffDeclSpec(attrs, DS, TUK);
53895388

53905389
SkipBodyInfo SkipBody;
5391-
if (!Name && TUK == Sema::TUK_Definition && Tok.is(tok::l_brace) &&
5390+
if (!Name && TUK == TagUseKind::Definition && Tok.is(tok::l_brace) &&
53925391
NextToken().is(tok::identifier))
53935392
SkipBody = Actions.shouldSkipAnonEnumBody(getCurScope(),
53945393
NextToken().getIdentifierInfo(),
@@ -5409,7 +5408,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
54095408
OffsetOfState, &SkipBody).get();
54105409

54115410
if (SkipBody.ShouldSkip) {
5412-
assert(TUK == Sema::TUK_Definition && "can only skip a definition");
5411+
assert(TUK == TagUseKind::Definition && "can only skip a definition");
54135412

54145413
BalancedDelimiterTracker T(*this, tok::l_brace);
54155414
T.consumeOpen();
@@ -5451,7 +5450,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
54515450
if (!TagDecl) {
54525451
// The action failed to produce an enumeration tag. If this is a
54535452
// definition, consume the entire definition.
5454-
if (Tok.is(tok::l_brace) && TUK != Sema::TUK_Reference) {
5453+
if (Tok.is(tok::l_brace) && TUK != TagUseKind::Reference) {
54555454
ConsumeBrace();
54565455
SkipUntil(tok::r_brace, StopAtSemi);
54575456
}
@@ -5460,7 +5459,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
54605459
return;
54615460
}
54625461

5463-
if (Tok.is(tok::l_brace) && TUK == Sema::TUK_Definition) {
5462+
if (Tok.is(tok::l_brace) && TUK == TagUseKind::Definition) {
54645463
Decl *D = SkipBody.CheckSameAsPrevious ? SkipBody.New : TagDecl;
54655464
ParseEnumBody(StartLoc, D);
54665465
if (SkipBody.CheckSameAsPrevious &&

0 commit comments

Comments
 (0)