Skip to content

Commit 1833c2b

Browse files
committed
Merge remote-tracking branch 'upstream/release/17.x' into rustc/17.0-2023-07-29
2 parents 7c612e1 + 2f0fb93 commit 1833c2b

File tree

178 files changed

+3502
-1649
lines changed

Some content is hidden

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

178 files changed

+3502
-1649
lines changed

.github/workflows/release-tasks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
uses: actions/checkout@v3
8585

8686
- name: Install dependencies
87-
run: apt-get install -y python3-setuptools
87+
run: sudo apt-get install -y python3-setuptools
8888

8989
- name: Test lit
9090
run: |

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,11 @@ void ClangTidyDiagnosticConsumer::HandleDiagnostic(
436436
SmallString<100> Message;
437437
Info.FormatDiagnostic(Message);
438438
FullSourceLoc Loc;
439-
if (Info.getLocation().isValid() && Info.hasSourceManager())
439+
if (Info.hasSourceManager())
440440
Loc = FullSourceLoc(Info.getLocation(), Info.getSourceManager());
441+
else if (Context.DiagEngine->hasSourceManager())
442+
Loc = FullSourceLoc(Info.getLocation(),
443+
Context.DiagEngine->getSourceManager());
441444
Converter.emitDiagnostic(Loc, DiagLevel, Message, Info.getRanges(),
442445
Info.getFixItHints());
443446
}

clang-tools-extra/clang-tidy/tool/run-clang-tidy.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,8 @@ def main():
389389
clang_apply_replacements_binary = find_binary(
390390
args.clang_apply_replacements_binary, "clang-apply-replacements", build_path
391391
)
392+
393+
if args.fix or (yaml and args.export_fixes):
392394
tmpdir = tempfile.mkdtemp()
393395

394396
try:

clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
// RUN: not clang-tidy -checks='-*,modernize-use-override' %T/diagnostics/input.cpp -- -DCOMPILATION_ERROR 2>&1 | FileCheck -check-prefix=CHECK6 -implicit-check-not='{{warning:|error:}}' %s
2626
// RUN: clang-tidy -checks='-*,modernize-use-override,clang-diagnostic-macro-redefined' %s -- -DMACRO_FROM_COMMAND_LINE -std=c++20 | FileCheck -check-prefix=CHECK4 -implicit-check-not='{{warning:|error:}}' %s
2727
// RUN: clang-tidy -checks='-*,modernize-use-override,clang-diagnostic-macro-redefined,clang-diagnostic-literal-conversion' %s -- -DMACRO_FROM_COMMAND_LINE -std=c++20 -Wno-macro-redefined | FileCheck --check-prefix=CHECK7 -implicit-check-not='{{warning:|error:}}' %s
28+
// RUN: not clang-tidy -checks='-*,modernize-use-override' %s -- -std=c++20 -DPR64602 | FileCheck -check-prefix=CHECK8 -implicit-check-not='{{warning:|error:}}' %s
2829

2930
// CHECK1: error: no input files [clang-diagnostic-error]
3031
// CHECK1: error: no such file or directory: '{{.*}}nonexistent.cpp' [clang-diagnostic-error]
@@ -54,3 +55,18 @@ void f(int a) {
5455
// CHECK6: :[[@LINE-1]]:3: error: cannot take the address of an rvalue of type 'int' [clang-diagnostic-error]
5556
}
5657
#endif
58+
59+
#ifdef PR64602 // Should not crash
60+
template <class T = void>
61+
struct S
62+
{
63+
auto foo(auto);
64+
};
65+
66+
template <>
67+
auto S<>::foo(auto)
68+
{
69+
return 1;
70+
}
71+
// CHECK8: error: template parameter list matching the non-templated nested type 'S<>' should be empty ('template<>') [clang-diagnostic-error]
72+
#endif

clang/docs/ReleaseNotes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,8 @@ LoongArch Support
921921

922922
- Patchable function entry (``-fpatchable-function-entry``) is now supported
923923
on LoongArch.
924+
- An ABI mismatch between GCC and Clang related to the handling of empty structs
925+
in C++ parameter passing under ``lp64d`` ABI was fixed.
924926
- Unaligned memory accesses can be toggled by ``-m[no-]unaligned-access`` or the
925927
aliases ``-m[no-]strict-align``.
926928
- Non ``$``-prefixed GPR names (e.g. ``r4`` and ``a0``) are allowed in inlineasm
@@ -960,6 +962,10 @@ RISC-V Support
960962
* Added intrinsics for reinterpret cast between vector boolean and vector
961963
integer ``m1`` value
962964
* Removed the ``vread_csr`` and ``vwrite_csr`` intrinsics
965+
- Default ``-fdebug-dwarf-version=`` is downgraded to 4 to work around
966+
incorrect DWARF related to ULEB128 and linker compatibility before
967+
``R_RISCV_SET_ULEB128`` becomes more widely supported.
968+
(`D157663 <https://reviews.llvm.org/D157663>`_).
963969

964970
CUDA/HIP Language Changes
965971
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/DiagnosticLexKinds.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,10 @@ def ext_ms_reserved_user_defined_literal : ExtWarn<
285285
def err_unsupported_string_concat : Error<
286286
"unsupported non-standard concatenation of string literals">;
287287

288+
def warn_unevaluated_string_prefix : Warning<
289+
"encoding prefix '%0' on an unevaluated string literal has no effect"
290+
"%select{| and is incompatible with c++2c}1">,
291+
InGroup<DiagGroup<"invalid-unevaluated-string">>;
288292
def err_unevaluated_string_prefix : Error<
289293
"an unevaluated string literal cannot have an encoding prefix">;
290294
def err_unevaluated_string_udl : Error<

clang/include/clang/Basic/riscv_vector.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ multiclass RVVIntBinBuiltinSet
112112
multiclass RVVSlideOneBuiltinSet
113113
: RVVOutOp1BuiltinSet<NAME, "csil",
114114
[["vx", "v", "vve"],
115-
["vx", "Uv", "UvUve"]]>;
115+
["vx", "Uv", "UvUvUe"]]>;
116116

117117
multiclass RVVSignedShiftBuiltinSet
118118
: RVVOutOp1BuiltinSet<NAME, "csil",

clang/include/clang/CodeGen/CGFunctionInfo.h

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,10 @@ class CGFunctionInfo final
567567
/// Whether this is a chain call.
568568
unsigned ChainCall : 1;
569569

570+
/// Whether this function is called by forwarding arguments.
571+
/// This doesn't support inalloca or varargs.
572+
unsigned DelegateCall : 1;
573+
570574
/// Whether this function is a CMSE nonsecure call
571575
unsigned CmseNSCall : 1;
572576

@@ -616,14 +620,11 @@ class CGFunctionInfo final
616620
CGFunctionInfo() : Required(RequiredArgs::All) {}
617621

618622
public:
619-
static CGFunctionInfo *create(unsigned llvmCC,
620-
bool instanceMethod,
621-
bool chainCall,
622-
const FunctionType::ExtInfo &extInfo,
623-
ArrayRef<ExtParameterInfo> paramInfos,
624-
CanQualType resultType,
625-
ArrayRef<CanQualType> argTypes,
626-
RequiredArgs required);
623+
static CGFunctionInfo *
624+
create(unsigned llvmCC, bool instanceMethod, bool chainCall,
625+
bool delegateCall, const FunctionType::ExtInfo &extInfo,
626+
ArrayRef<ExtParameterInfo> paramInfos, CanQualType resultType,
627+
ArrayRef<CanQualType> argTypes, RequiredArgs required);
627628
void operator delete(void *p) { ::operator delete(p); }
628629

629630
// Friending class TrailingObjects is apparently not good enough for MSVC,
@@ -663,6 +664,8 @@ class CGFunctionInfo final
663664

664665
bool isChainCall() const { return ChainCall; }
665666

667+
bool isDelegateCall() const { return DelegateCall; }
668+
666669
bool isCmseNSCall() const { return CmseNSCall; }
667670

668671
bool isNoReturn() const { return NoReturn; }
@@ -749,6 +752,7 @@ class CGFunctionInfo final
749752
ID.AddInteger(getASTCallingConvention());
750753
ID.AddBoolean(InstanceMethod);
751754
ID.AddBoolean(ChainCall);
755+
ID.AddBoolean(DelegateCall);
752756
ID.AddBoolean(NoReturn);
753757
ID.AddBoolean(ReturnsRetained);
754758
ID.AddBoolean(NoCallerSavedRegs);
@@ -766,17 +770,16 @@ class CGFunctionInfo final
766770
for (const auto &I : arguments())
767771
I.type.Profile(ID);
768772
}
769-
static void Profile(llvm::FoldingSetNodeID &ID,
770-
bool InstanceMethod,
771-
bool ChainCall,
773+
static void Profile(llvm::FoldingSetNodeID &ID, bool InstanceMethod,
774+
bool ChainCall, bool IsDelegateCall,
772775
const FunctionType::ExtInfo &info,
773776
ArrayRef<ExtParameterInfo> paramInfos,
774-
RequiredArgs required,
775-
CanQualType resultType,
777+
RequiredArgs required, CanQualType resultType,
776778
ArrayRef<CanQualType> argTypes) {
777779
ID.AddInteger(info.getCC());
778780
ID.AddBoolean(InstanceMethod);
779781
ID.AddBoolean(ChainCall);
782+
ID.AddBoolean(IsDelegateCall);
780783
ID.AddBoolean(info.getNoReturn());
781784
ID.AddBoolean(info.getProducesResult());
782785
ID.AddBoolean(info.getNoCallerSavedRegs());

clang/include/clang/Driver/ToolChain.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ class ToolChain {
561561

562562
// Return the DWARF version to emit, in the absence of arguments
563563
// to the contrary.
564-
virtual unsigned GetDefaultDwarfVersion() const { return 5; }
564+
virtual unsigned GetDefaultDwarfVersion() const;
565565

566566
// Some toolchains may have different restrictions on the DWARF version and
567567
// may need to adjust it. E.g. NVPTX may need to enforce DWARF2 even when host

clang/include/clang/Sema/Sema.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12694,8 +12694,6 @@ class Sema final {
1269412694
QualType CheckBitwiseOperands( // C99 6.5.[10...12]
1269512695
ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
1269612696
BinaryOperatorKind Opc);
12697-
void diagnoseLogicalInsteadOfBitwise(Expr *Op1, Expr *Op2, SourceLocation Loc,
12698-
BinaryOperatorKind Opc);
1269912697
QualType CheckLogicalOperands( // C99 6.5.[13,14]
1270012698
ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
1270112699
BinaryOperatorKind Opc);

clang/lib/Basic/Targets/LoongArch.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -199,18 +199,14 @@ void LoongArchTargetInfo::getTargetDefines(const LangOptions &Opts,
199199
Builder.defineMacro("__loongarch_frlen", "0");
200200

201201
// Define __loongarch_arch.
202-
StringRef Arch = llvm::LoongArch::getArch();
203-
if (Arch.empty())
204-
Arch = llvm::LoongArch::getDefaultArch(GRLen == 64);
205-
if (!Arch.empty())
206-
Builder.defineMacro("__loongarch_arch", Arch);
202+
StringRef ArchName = getCPU();
203+
Builder.defineMacro("__loongarch_arch", Twine('"') + ArchName + Twine('"'));
207204

208205
// Define __loongarch_tune.
209-
StringRef TuneCPU = llvm::LoongArch::getTuneCPU();
206+
StringRef TuneCPU = getTargetOpts().TuneCPU;
210207
if (TuneCPU.empty())
211-
TuneCPU = Arch;
212-
if (!TuneCPU.empty())
213-
Builder.defineMacro("__loongarch_tune", TuneCPU);
208+
TuneCPU = ArchName;
209+
Builder.defineMacro("__loongarch_tune", Twine('"') + TuneCPU + Twine('"'));
214210

215211
StringRef ABI = getABI();
216212
if (ABI == "lp64d" || ABI == "lp64f" || ABI == "lp64s")
@@ -283,11 +279,11 @@ bool LoongArchTargetInfo::handleTargetFeatures(
283279
return true;
284280
}
285281

286-
bool LoongArchTargetInfo::isValidTuneCPUName(StringRef Name) const {
287-
return llvm::LoongArch::isValidTuneCPUName(Name);
282+
bool LoongArchTargetInfo::isValidCPUName(StringRef Name) const {
283+
return llvm::LoongArch::isValidCPUName(Name);
288284
}
289285

290-
void LoongArchTargetInfo::fillValidTuneCPUList(
286+
void LoongArchTargetInfo::fillValidCPUList(
291287
SmallVectorImpl<StringRef> &Values) const {
292-
llvm::LoongArch::fillValidTuneCPUList(Values);
288+
llvm::LoongArch::fillValidCPUList(Values);
293289
}

clang/lib/Basic/Targets/LoongArch.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ namespace targets {
2424
class LLVM_LIBRARY_VISIBILITY LoongArchTargetInfo : public TargetInfo {
2525
protected:
2626
std::string ABI;
27+
std::string CPU;
2728
bool HasFeatureD;
2829
bool HasFeatureF;
2930

@@ -40,6 +41,15 @@ class LLVM_LIBRARY_VISIBILITY LoongArchTargetInfo : public TargetInfo {
4041
WIntType = UnsignedInt;
4142
}
4243

44+
bool setCPU(const std::string &Name) override {
45+
if (!isValidCPUName(Name))
46+
return false;
47+
CPU = Name;
48+
return true;
49+
}
50+
51+
StringRef getCPU() const { return CPU; }
52+
4353
StringRef getABI() const override { return ABI; }
4454

4555
void getTargetDefines(const LangOptions &Opts,
@@ -81,8 +91,8 @@ class LLVM_LIBRARY_VISIBILITY LoongArchTargetInfo : public TargetInfo {
8191

8292
bool hasFeature(StringRef Feature) const override;
8393

84-
bool isValidTuneCPUName(StringRef Name) const override;
85-
void fillValidTuneCPUList(SmallVectorImpl<StringRef> &Values) const override;
94+
bool isValidCPUName(StringRef Name) const override;
95+
void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override;
8696
};
8797

8898
class LLVM_LIBRARY_VISIBILITY LoongArch32TargetInfo

0 commit comments

Comments
 (0)