Skip to content

Commit f923464

Browse files
committed
Merge branch 'main' of https://github.com/llvm/llvm-project into fix/147217
2 parents b4f416c + d0a4af7 commit f923464

File tree

653 files changed

+43960
-11521
lines changed

Some content is hidden

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

653 files changed

+43960
-11521
lines changed

bolt/lib/Target/X86/X86MCPlusBuilder.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2441,6 +2441,7 @@ class X86MCPlusBuilder : public MCPlusBuilder {
24412441

24422442
assert(FKI.TargetOffset == 0 && "0-bit relocation offset expected");
24432443
const uint64_t RelOffset = Fixup.getOffset();
2444+
auto [RelSymbol, RelAddend] = extractFixupExpr(Fixup);
24442445

24452446
uint32_t RelType;
24462447
if (Fixup.isPCRel()) {
@@ -2452,6 +2453,9 @@ class X86MCPlusBuilder : public MCPlusBuilder {
24522453
case 32: RelType = ELF::R_X86_64_PC32; break;
24532454
case 64: RelType = ELF::R_X86_64_PC64; break;
24542455
}
2456+
// Adjust PC-relative fixup offsets, which are calculated from the start
2457+
// of the next instruction.
2458+
RelAddend -= FKI.TargetSize / 8;
24552459
} else {
24562460
switch (FKI.TargetSize) {
24572461
default:
@@ -2463,8 +2467,6 @@ class X86MCPlusBuilder : public MCPlusBuilder {
24632467
}
24642468
}
24652469

2466-
auto [RelSymbol, RelAddend] = extractFixupExpr(Fixup);
2467-
24682470
return Relocation({RelOffset, RelSymbol, RelType, RelAddend, 0});
24692471
}
24702472

clang-tools-extra/clang-tidy/ClangTidy.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ namespace clang::tidy {
5555

5656
namespace {
5757
#if CLANG_TIDY_ENABLE_STATIC_ANALYZER
58-
static const char *AnalyzerCheckNamePrefix = "clang-analyzer-";
58+
static constexpr llvm::StringLiteral AnalyzerCheckNamePrefix =
59+
"clang-analyzer-";
5960

6061
class AnalyzerDiagnosticConsumer : public ento::PathDiagnosticConsumer {
6162
public:
@@ -351,10 +352,9 @@ ClangTidyASTConsumerFactory::ClangTidyASTConsumerFactory(
351352
static void
352353
setStaticAnalyzerCheckerOpts(const ClangTidyOptions &Opts,
353354
clang::AnalyzerOptions &AnalyzerOptions) {
354-
StringRef AnalyzerPrefix(AnalyzerCheckNamePrefix);
355355
for (const auto &Opt : Opts.CheckOptions) {
356356
StringRef OptName(Opt.getKey());
357-
if (!OptName.consume_front(AnalyzerPrefix))
357+
if (!OptName.consume_front(AnalyzerCheckNamePrefix))
358358
continue;
359359
// Analyzer options are always local options so we can ignore priority.
360360
AnalyzerOptions.Config[OptName] = Opt.getValue().Value;
@@ -476,7 +476,8 @@ std::vector<std::string> ClangTidyASTConsumerFactory::getCheckNames() {
476476
#if CLANG_TIDY_ENABLE_STATIC_ANALYZER
477477
for (const auto &AnalyzerCheck : getAnalyzerCheckersAndPackages(
478478
Context, Context.canEnableAnalyzerAlphaCheckers()))
479-
CheckNames.push_back(AnalyzerCheckNamePrefix + AnalyzerCheck.first);
479+
CheckNames.emplace_back(
480+
(AnalyzerCheckNamePrefix + AnalyzerCheck.first).str());
480481
#endif // CLANG_TIDY_ENABLE_STATIC_ANALYZER
481482

482483
llvm::sort(CheckNames);

clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,9 @@ void ClangTidyDiagnosticConsumer::forwardDiagnostic(const Diagnostic &Info) {
544544
case clang::DiagnosticsEngine::ak_attr:
545545
Builder << reinterpret_cast<Attr *>(Info.getRawArg(Index));
546546
break;
547+
case clang::DiagnosticsEngine::ak_attr_info:
548+
Builder << reinterpret_cast<AttributeCommonInfo *>(Info.getRawArg(Index));
549+
break;
547550
case clang::DiagnosticsEngine::ak_addrspace:
548551
Builder << static_cast<LangAS>(Info.getRawArg(Index));
549552
break;

clang-tools-extra/clang-tidy/abseil/AbseilMatcher.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ AST_POLYMORPHIC_MATCHER(
4646
if (PrefixPosition == StringRef::npos)
4747
return false;
4848
Path = Path.drop_front(PrefixPosition + AbslPrefix.size());
49-
static const char *AbseilLibraries[] = {
49+
static constexpr llvm::StringLiteral AbseilLibraries[] = {
5050
"algorithm", "base", "container", "debugging", "flags",
5151
"hash", "iterator", "memory", "meta", "numeric",
5252
"profiling", "random", "status", "strings", "synchronization",
5353
"time", "types", "utility"};
54-
return llvm::any_of(AbseilLibraries, [&](const char *Library) {
54+
return llvm::any_of(AbseilLibraries, [&](llvm::StringLiteral Library) {
5555
return Path.starts_with(Library);
5656
});
5757
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace {
2525

2626
AST_MATCHER(CXXMethodDecl, isVirtual) { return Node.isVirtual(); }
2727

28-
static const char *const ErrorMsg =
28+
static constexpr llvm::StringLiteral ErrorMsg =
2929
"comparing a pointer to member virtual function with other pointer is "
3030
"unspecified behavior, only compare it with a null-pointer constant for "
3131
"equality.";

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,8 @@ static bool isEmpty(ASTContext &Context, const QualType &Type) {
373373
return isIncompleteOrZeroLengthArrayType(Context, Type);
374374
}
375375

376-
static const char *getInitializer(QualType QT, bool UseAssignment) {
377-
const char *DefaultInitializer = "{}";
376+
static llvm::StringLiteral getInitializer(QualType QT, bool UseAssignment) {
377+
static constexpr llvm::StringLiteral DefaultInitializer = "{}";
378378
if (!UseAssignment)
379379
return DefaultInitializer;
380380

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ void UseUsingCheck::check(const MatchFinder::MatchResult &Result) {
119119
if (StartLoc.isMacroID() && IgnoreMacros)
120120
return;
121121

122-
static const char *UseUsingWarning = "use 'using' instead of 'typedef'";
122+
static constexpr llvm::StringLiteral UseUsingWarning =
123+
"use 'using' instead of 'typedef'";
123124

124125
// Warn at StartLoc but do not fix if there is macro or array.
125126
if (MatchedDecl->getUnderlyingType()->isArrayType() || StartLoc.isMacroID()) {

clang/docs/ReleaseNotes.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,12 @@ Improvements to Clang's diagnostics
678678
- Clang now accepts ``@tparam`` comments on variable template partial
679679
specializations. (#GH144775)
680680

681+
- Fixed a bug that caused diagnostic line wrapping to not function correctly on
682+
some systems. (#GH139499)
683+
684+
- Clang now tries to avoid printing file paths that contain ``..``, instead preferring
685+
the canonical file path if it ends up being shorter.
686+
681687
- Clang rejects the ``#`` and ``##`` preprocessor tokens in an attribute
682688
argument list in C++. The operators can be used in macro replacement lists
683689
with the usual preprocessor semantics. What is rejected are non-preprocessor
@@ -903,6 +909,7 @@ Bug Fixes to C++ Support
903909
- Clang now correctly parses arbitrary order of ``[[]]``, ``__attribute__`` and ``alignas`` attributes for declarations (#GH133107)
904910
- Fixed a crash when forming an invalid function type in a dependent context. (#GH138657) (#GH115725) (#GH68852)
905911
- Fixed a function declaration mismatch that caused inconsistencies between concepts and variable template declarations. (#GH139476)
912+
- Fixed an out-of-line declaration mismatch involving nested template parameters. (#GH145521)
906913
- Clang no longer segfaults when there is a configuration mismatch between modules and their users (http://crbug.com/400353616).
907914
- Fix an incorrect deduction when calling an explicit object member function template through an overload set address.
908915
- Fixed bug in constant evaluation that would allow using the value of a
@@ -917,6 +924,7 @@ Bug Fixes to C++ Support
917924
- Fix a bug where private access specifier of overloaded function not respected. (#GH107629)
918925
- Correctly handle allocations in the condition of a ``if constexpr``.(#GH120197) (#GH134820)
919926
- Fixed a crash when handling invalid member using-declaration in C++20+ mode. (#GH63254)
927+
- Fix a crash when trying to instantiate an ambiguous specialization. (#GH51866)
920928

921929
Bug Fixes to AST Handling
922930
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/AST/Expr.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3534,6 +3534,10 @@ class CompoundLiteralExpr : public Expr {
35343534
/// The int part of the pair stores whether this expr is file scope.
35353535
llvm::PointerIntPair<TypeSourceInfo *, 1, bool> TInfoAndScope;
35363536
Stmt *Init;
3537+
3538+
/// Value of constant literals with static storage duration.
3539+
mutable APValue *StaticValue = nullptr;
3540+
35373541
public:
35383542
CompoundLiteralExpr(SourceLocation lparenloc, TypeSourceInfo *tinfo,
35393543
QualType T, ExprValueKind VK, Expr *init, bool fileScope)
@@ -3563,6 +3567,10 @@ class CompoundLiteralExpr : public Expr {
35633567
TInfoAndScope.setPointer(tinfo);
35643568
}
35653569

3570+
bool hasStaticStorage() const { return isFileScope() && isGLValue(); }
3571+
APValue &getOrCreateStaticValue(ASTContext &Ctx) const;
3572+
APValue &getStaticValue() const;
3573+
35663574
SourceLocation getBeginLoc() const LLVM_READONLY {
35673575
// FIXME: Init should never be null.
35683576
if (!Init)

clang/include/clang/Basic/BuiltinsAMDGPU.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ TARGET_BUILTIN(__builtin_amdgcn_smfmac_f32_32x32x32_fp8_fp8, "V16fV2iV4iV16fiIiI
429429

430430
TARGET_BUILTIN(__builtin_amdgcn_cvt_f32_bf8, "fiIi", "nc", "fp8-conversion-insts")
431431
TARGET_BUILTIN(__builtin_amdgcn_cvt_f32_fp8, "fiIi", "nc", "fp8-conversion-insts")
432+
TARGET_BUILTIN(__builtin_amdgcn_cvt_f32_fp8_e5m3, "fiIi", "nc", "fp8e5m3-insts")
432433
TARGET_BUILTIN(__builtin_amdgcn_cvt_pk_f32_bf8, "V2fiIb", "nc", "fp8-conversion-insts")
433434
TARGET_BUILTIN(__builtin_amdgcn_cvt_pk_f32_fp8, "V2fiIb", "nc", "fp8-conversion-insts")
434435
TARGET_BUILTIN(__builtin_amdgcn_cvt_pk_bf8_f32, "iffiIb", "nc", "fp8-conversion-insts")

0 commit comments

Comments
 (0)