18.0.1-rc4 Release
This commit is contained in:
parent
152d45a205
commit
3d9fc8eb23
|
@ -1,260 +0,0 @@
|
|||
From fabda7312b91a768617f4ff1fabe0e1cc7d9131c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=E5=88=98=E9=9B=A8=E5=9F=B9?= <liuyupei951018@hotmail.com>
|
||||
Date: Wed, 1 Nov 2023 21:45:48 +0800
|
||||
Subject: [PATCH] [Clang] Defer the instantiation of explicit-specifier until
|
||||
constraint checking completes (#70548)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Modifications:
|
||||
|
||||
- Skip the instantiation of the explicit-specifier during Decl
|
||||
substitution if we are deducing template arguments and the
|
||||
explicit-specifier is value dependent.
|
||||
|
||||
- Instantiate the explicit-specifier after the constraint checking
|
||||
completes.
|
||||
|
||||
- Make `instantiateExplicitSpecifier` a member function in order to
|
||||
instantiate the explicit-specifier in different stages.
|
||||
|
||||
This PR doesn’t defer the instantiation of the explicit specifier for
|
||||
deduction guides, because I’m not familiar with deduction guides yet.
|
||||
I’ll dig into it after this PR.
|
||||
|
||||
According to my local test, GCC 13 tuple works with this PR.
|
||||
|
||||
Fixes #59827.
|
||||
|
||||
---------
|
||||
|
||||
Co-authored-by: Erich Keane <ekeane@nvidia.com>
|
||||
(cherry picked from commit 128b3b61fe6768c724975fd1df2be0abec848cf6)
|
||||
---
|
||||
clang/docs/ReleaseNotes.rst | 4 ++
|
||||
clang/include/clang/Sema/Sema.h | 3 ++
|
||||
clang/lib/Sema/SemaTemplateDeduction.cpp | 53 +++++++++++++++++++
|
||||
.../lib/Sema/SemaTemplateInstantiateDecl.cpp | 40 +++++++++-----
|
||||
.../SemaCXX/cxx2a-explicit-bool-deferred.cpp | 31 +++++++++++
|
||||
5 files changed, 117 insertions(+), 14 deletions(-)
|
||||
create mode 100644 clang/test/SemaCXX/cxx2a-explicit-bool-deferred.cpp
|
||||
|
||||
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
|
||||
index a1143e14562e..8e3b94ca2017 100644
|
||||
--- a/clang/docs/ReleaseNotes.rst
|
||||
+++ b/clang/docs/ReleaseNotes.rst
|
||||
@@ -857,6 +857,10 @@ Bug Fixes to C++ Support
|
||||
(`#64172 <https://github.com/llvm/llvm-project/issues/64172>`_) and
|
||||
(`#64723 <https://github.com/llvm/llvm-project/issues/64723>`_).
|
||||
|
||||
+- Clang now defers the instantiation of explicit specifier until constraint checking
|
||||
+ completes (except deduction guides). Fixes:
|
||||
+ (`#59827 <https://github.com/llvm/llvm-project/issues/59827>`_)
|
||||
+
|
||||
Bug Fixes to AST Handling
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
|
||||
index 3752a23faa85..b2ab6d0f8445 100644
|
||||
--- a/clang/include/clang/Sema/Sema.h
|
||||
+++ b/clang/include/clang/Sema/Sema.h
|
||||
@@ -10293,6 +10293,9 @@ public:
|
||||
const CXXConstructorDecl *Tmpl,
|
||||
const MultiLevelTemplateArgumentList &TemplateArgs);
|
||||
|
||||
+ ExplicitSpecifier instantiateExplicitSpecifier(
|
||||
+ const MultiLevelTemplateArgumentList &TemplateArgs, ExplicitSpecifier ES);
|
||||
+
|
||||
NamedDecl *FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D,
|
||||
const MultiLevelTemplateArgumentList &TemplateArgs,
|
||||
bool FindingInstantiatedContext = false);
|
||||
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp
|
||||
index 31ea7be2975e..58dd1b783bac 100644
|
||||
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
|
||||
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
|
||||
@@ -3546,6 +3546,48 @@ static unsigned getPackIndexForParam(Sema &S,
|
||||
llvm_unreachable("parameter index would not be produced from template");
|
||||
}
|
||||
|
||||
+// if `Specialization` is a `CXXConstructorDecl` or `CXXConversionDecl`,
|
||||
+// we'll try to instantiate and update its explicit specifier after constraint
|
||||
+// checking.
|
||||
+static Sema::TemplateDeductionResult instantiateExplicitSpecifierDeferred(
|
||||
+ Sema &S, FunctionDecl *Specialization,
|
||||
+ const MultiLevelTemplateArgumentList &SubstArgs,
|
||||
+ TemplateDeductionInfo &Info, FunctionTemplateDecl *FunctionTemplate,
|
||||
+ ArrayRef<TemplateArgument> DeducedArgs) {
|
||||
+ auto GetExplicitSpecifier = [](FunctionDecl *D) {
|
||||
+ return isa<CXXConstructorDecl>(D)
|
||||
+ ? cast<CXXConstructorDecl>(D)->getExplicitSpecifier()
|
||||
+ : cast<CXXConversionDecl>(D)->getExplicitSpecifier();
|
||||
+ };
|
||||
+ auto SetExplicitSpecifier = [](FunctionDecl *D, ExplicitSpecifier ES) {
|
||||
+ isa<CXXConstructorDecl>(D)
|
||||
+ ? cast<CXXConstructorDecl>(D)->setExplicitSpecifier(ES)
|
||||
+ : cast<CXXConversionDecl>(D)->setExplicitSpecifier(ES);
|
||||
+ };
|
||||
+
|
||||
+ ExplicitSpecifier ES = GetExplicitSpecifier(Specialization);
|
||||
+ Expr *ExplicitExpr = ES.getExpr();
|
||||
+ if (!ExplicitExpr)
|
||||
+ return Sema::TDK_Success;
|
||||
+ if (!ExplicitExpr->isValueDependent())
|
||||
+ return Sema::TDK_Success;
|
||||
+
|
||||
+ Sema::InstantiatingTemplate Inst(
|
||||
+ S, Info.getLocation(), FunctionTemplate, DeducedArgs,
|
||||
+ Sema::CodeSynthesisContext::DeducedTemplateArgumentSubstitution, Info);
|
||||
+ if (Inst.isInvalid())
|
||||
+ return Sema::TDK_InstantiationDepth;
|
||||
+ Sema::SFINAETrap Trap(S);
|
||||
+ const ExplicitSpecifier InstantiatedES =
|
||||
+ S.instantiateExplicitSpecifier(SubstArgs, ES);
|
||||
+ if (InstantiatedES.isInvalid() || Trap.hasErrorOccurred()) {
|
||||
+ Specialization->setInvalidDecl(true);
|
||||
+ return Sema::TDK_SubstitutionFailure;
|
||||
+ }
|
||||
+ SetExplicitSpecifier(Specialization, InstantiatedES);
|
||||
+ return Sema::TDK_Success;
|
||||
+}
|
||||
+
|
||||
/// Finish template argument deduction for a function template,
|
||||
/// checking the deduced template arguments for completeness and forming
|
||||
/// the function template specialization.
|
||||
@@ -3675,6 +3717,17 @@ Sema::TemplateDeductionResult Sema::FinishTemplateArgumentDeduction(
|
||||
}
|
||||
}
|
||||
|
||||
+ // We skipped the instantiation of the explicit-specifier during the
|
||||
+ // substitution of `FD` before. So, we try to instantiate it back if
|
||||
+ // `Specialization` is either a constructor or a conversion function.
|
||||
+ if (isa<CXXConstructorDecl, CXXConversionDecl>(Specialization)) {
|
||||
+ if (TDK_Success != instantiateExplicitSpecifierDeferred(
|
||||
+ *this, Specialization, SubstArgs, Info,
|
||||
+ FunctionTemplate, DeducedArgs)) {
|
||||
+ return TDK_SubstitutionFailure;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (OriginalCallArgs) {
|
||||
// C++ [temp.deduct.call]p4:
|
||||
// In general, the deduction process attempts to find template argument
|
||||
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
|
||||
index f78d46f59503..a40510ce5f2c 100644
|
||||
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
|
||||
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
|
||||
@@ -555,18 +555,16 @@ static void instantiateDependentAMDGPUFlatWorkGroupSizeAttr(
|
||||
S.addAMDGPUFlatWorkGroupSizeAttr(New, Attr, MinExpr, MaxExpr);
|
||||
}
|
||||
|
||||
-static ExplicitSpecifier
|
||||
-instantiateExplicitSpecifier(Sema &S,
|
||||
- const MultiLevelTemplateArgumentList &TemplateArgs,
|
||||
- ExplicitSpecifier ES, FunctionDecl *New) {
|
||||
+ExplicitSpecifier Sema::instantiateExplicitSpecifier(
|
||||
+ const MultiLevelTemplateArgumentList &TemplateArgs, ExplicitSpecifier ES) {
|
||||
if (!ES.getExpr())
|
||||
return ES;
|
||||
Expr *OldCond = ES.getExpr();
|
||||
Expr *Cond = nullptr;
|
||||
{
|
||||
EnterExpressionEvaluationContext Unevaluated(
|
||||
- S, Sema::ExpressionEvaluationContext::ConstantEvaluated);
|
||||
- ExprResult SubstResult = S.SubstExpr(OldCond, TemplateArgs);
|
||||
+ *this, Sema::ExpressionEvaluationContext::ConstantEvaluated);
|
||||
+ ExprResult SubstResult = SubstExpr(OldCond, TemplateArgs);
|
||||
if (SubstResult.isInvalid()) {
|
||||
return ExplicitSpecifier::Invalid();
|
||||
}
|
||||
@@ -574,7 +572,7 @@ instantiateExplicitSpecifier(Sema &S,
|
||||
}
|
||||
ExplicitSpecifier Result(Cond, ES.getKind());
|
||||
if (!Cond->isTypeDependent())
|
||||
- S.tryResolveExplicitSpecifier(Result);
|
||||
+ tryResolveExplicitSpecifier(Result);
|
||||
return Result;
|
||||
}
|
||||
|
||||
@@ -2065,8 +2063,8 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(
|
||||
|
||||
ExplicitSpecifier InstantiatedExplicitSpecifier;
|
||||
if (auto *DGuide = dyn_cast<CXXDeductionGuideDecl>(D)) {
|
||||
- InstantiatedExplicitSpecifier = instantiateExplicitSpecifier(
|
||||
- SemaRef, TemplateArgs, DGuide->getExplicitSpecifier(), DGuide);
|
||||
+ InstantiatedExplicitSpecifier = SemaRef.instantiateExplicitSpecifier(
|
||||
+ TemplateArgs, DGuide->getExplicitSpecifier());
|
||||
if (InstantiatedExplicitSpecifier.isInvalid())
|
||||
return nullptr;
|
||||
}
|
||||
@@ -2440,11 +2438,25 @@ Decl *TemplateDeclInstantiator::VisitCXXMethodDecl(
|
||||
}
|
||||
}
|
||||
|
||||
- ExplicitSpecifier InstantiatedExplicitSpecifier =
|
||||
- instantiateExplicitSpecifier(SemaRef, TemplateArgs,
|
||||
- ExplicitSpecifier::getFromDecl(D), D);
|
||||
- if (InstantiatedExplicitSpecifier.isInvalid())
|
||||
- return nullptr;
|
||||
+ auto InstantiatedExplicitSpecifier = ExplicitSpecifier::getFromDecl(D);
|
||||
+ // deduction guides need this
|
||||
+ const bool CouldInstantiate =
|
||||
+ InstantiatedExplicitSpecifier.getExpr() == nullptr ||
|
||||
+ !InstantiatedExplicitSpecifier.getExpr()->isValueDependent();
|
||||
+
|
||||
+ // Delay the instantiation of the explicit-specifier until after the
|
||||
+ // constraints are checked during template argument deduction.
|
||||
+ if (CouldInstantiate ||
|
||||
+ SemaRef.CodeSynthesisContexts.back().Kind !=
|
||||
+ Sema::CodeSynthesisContext::DeducedTemplateArgumentSubstitution) {
|
||||
+ InstantiatedExplicitSpecifier = SemaRef.instantiateExplicitSpecifier(
|
||||
+ TemplateArgs, InstantiatedExplicitSpecifier);
|
||||
+
|
||||
+ if (InstantiatedExplicitSpecifier.isInvalid())
|
||||
+ return nullptr;
|
||||
+ } else {
|
||||
+ InstantiatedExplicitSpecifier.setKind(ExplicitSpecKind::Unresolved);
|
||||
+ }
|
||||
|
||||
// Implicit destructors/constructors created for local classes in
|
||||
// DeclareImplicit* (see SemaDeclCXX.cpp) might not have an associated TSI.
|
||||
diff --git a/clang/test/SemaCXX/cxx2a-explicit-bool-deferred.cpp b/clang/test/SemaCXX/cxx2a-explicit-bool-deferred.cpp
|
||||
new file mode 100644
|
||||
index 000000000000..4d667008f2e2
|
||||
--- /dev/null
|
||||
+++ b/clang/test/SemaCXX/cxx2a-explicit-bool-deferred.cpp
|
||||
@@ -0,0 +1,31 @@
|
||||
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++2a %s
|
||||
+
|
||||
+template <typename T1, typename T2> struct is_same {
|
||||
+ static constexpr bool value = false;
|
||||
+};
|
||||
+
|
||||
+template <typename T> struct is_same<T, T> {
|
||||
+ static constexpr bool value = true;
|
||||
+};
|
||||
+
|
||||
+template <class T, class U>
|
||||
+concept SameHelper = is_same<T, U>::value;
|
||||
+template <class T, class U>
|
||||
+concept same_as = SameHelper<T, U> && SameHelper<U, T>;
|
||||
+
|
||||
+namespace deferred_instantiation {
|
||||
+template <class X> constexpr X do_not_instantiate() { return nullptr; }
|
||||
+
|
||||
+struct T {
|
||||
+ template <same_as<float> X> explicit(do_not_instantiate<X>()) T(X) {}
|
||||
+
|
||||
+ T(int) {}
|
||||
+};
|
||||
+
|
||||
+T t(5);
|
||||
+// expected-error@17{{cannot initialize}}
|
||||
+// expected-note@20{{in instantiation of function template specialization}}
|
||||
+// expected-note@30{{while substituting deduced template arguments}}
|
||||
+// expected-note@30{{in instantiation of function template specialization}}
|
||||
+T t2(5.0f);
|
||||
+} // namespace deferred_instantiation
|
||||
--
|
||||
2.43.0
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
From bd2e848f15c0f25231126eb10cb0ab350717dfc0 Mon Sep 17 00:00:00 2001
|
||||
From: Nikita Popov <npopov@redhat.com>
|
||||
Date: Fri, 19 Jan 2024 12:09:13 +0100
|
||||
Subject: [PATCH] [Clang] Fix build with GCC 14 on ARM
|
||||
|
||||
GCC 14 defines `__arm_streaming` as a macro expanding to
|
||||
`[[arm::streaming]]`. Due to the nested macro use, this gets
|
||||
expanded prior to concatenation.
|
||||
|
||||
It doesn't look like C++ has a really clean way to prevent
|
||||
macro expansion. The best I have found is to use `EMPTY ## X` where
|
||||
`EMPTY` is an empty macro argument, so this is the hack I'm
|
||||
implementing here.
|
||||
|
||||
Fixes https://github.com/llvm/llvm-project/issues/78691.
|
||||
---
|
||||
clang/include/clang/Basic/TokenKinds.def | 3 ++-
|
||||
clang/include/clang/Basic/TokenKinds.h | 2 +-
|
||||
clang/utils/TableGen/ClangAttrEmitter.cpp | 2 +-
|
||||
3 files changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/clang/include/clang/Basic/TokenKinds.def b/clang/include/clang/Basic/TokenKinds.def
|
||||
index ef0dad0f2dcd..3add13c079f3 100644
|
||||
--- a/clang/include/clang/Basic/TokenKinds.def
|
||||
+++ b/clang/include/clang/Basic/TokenKinds.def
|
||||
@@ -752,8 +752,9 @@ KEYWORD(__builtin_available , KEYALL)
|
||||
KEYWORD(__builtin_sycl_unique_stable_name, KEYSYCL)
|
||||
|
||||
// Keywords defined by Attr.td.
|
||||
+// The "EMPTY ## X" is used to prevent early macro-expansion of the keyword.
|
||||
#ifndef KEYWORD_ATTRIBUTE
|
||||
-#define KEYWORD_ATTRIBUTE(X) KEYWORD(X, KEYALL)
|
||||
+#define KEYWORD_ATTRIBUTE(X, EMPTY) KEYWORD(EMPTY ## X, KEYALL)
|
||||
#endif
|
||||
#include "clang/Basic/AttrTokenKinds.inc"
|
||||
|
||||
diff --git a/clang/include/clang/Basic/TokenKinds.h b/clang/include/clang/Basic/TokenKinds.h
|
||||
index e4857405bc7f..ff117bd5afc5 100644
|
||||
--- a/clang/include/clang/Basic/TokenKinds.h
|
||||
+++ b/clang/include/clang/Basic/TokenKinds.h
|
||||
@@ -109,7 +109,7 @@ bool isPragmaAnnotation(TokenKind K);
|
||||
|
||||
inline constexpr bool isRegularKeywordAttribute(TokenKind K) {
|
||||
return (false
|
||||
-#define KEYWORD_ATTRIBUTE(X) || (K == tok::kw_##X)
|
||||
+#define KEYWORD_ATTRIBUTE(X, ...) || (K == tok::kw_##X)
|
||||
#include "clang/Basic/AttrTokenKinds.inc"
|
||||
);
|
||||
}
|
||||
diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
|
||||
index b5813c6abc2b..79db17501b64 100644
|
||||
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
|
||||
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
|
||||
@@ -3430,7 +3430,7 @@ void EmitClangAttrTokenKinds(RecordKeeper &Records, raw_ostream &OS) {
|
||||
"RegularKeyword attributes with arguments are not "
|
||||
"yet supported");
|
||||
OS << "KEYWORD_ATTRIBUTE("
|
||||
- << S.getSpellingRecord().getValueAsString("Name") << ")\n";
|
||||
+ << S.getSpellingRecord().getValueAsString("Name") << ", )\n";
|
||||
}
|
||||
OS << "#undef KEYWORD_ATTRIBUTE\n";
|
||||
}
|
||||
--
|
||||
2.43.0
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
From 03a4a6131a18c47a32a02a0c48f6d32358561920 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Stellard <tstellar@redhat.com>
|
||||
Date: Wed, 6 Oct 2021 05:32:44 +0000
|
||||
Subject: [PATCH] Driver: Add a gcc equivalent triple to the list of triples to
|
||||
search
|
||||
|
||||
There are some gcc triples, like x86_64-redhat-linux, that provide the
|
||||
same behavior as a clang triple with a similar name (e.g.
|
||||
x86_64-redhat-linux-gnu). When searching for a gcc install, also search
|
||||
for a gcc equivalent triple if one exists.
|
||||
|
||||
Differential Revision: https://reviews.llvm.org/D111207
|
||||
---
|
||||
clang/lib/Driver/ToolChains/Gnu.cpp | 22 ++++++++++++++++++++++
|
||||
1 file changed, 22 insertions(+)
|
||||
|
||||
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
|
||||
index 16cf57072272..49084bd2ce25 100644
|
||||
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
|
||||
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
|
||||
@@ -2078,6 +2078,18 @@ static llvm::StringRef getGCCToolchainDir(const ArgList &Args,
|
||||
return GCC_INSTALL_PREFIX;
|
||||
}
|
||||
|
||||
+/// This function takes a 'clang' triple and converts it to an equivalent gcc
|
||||
+/// triple.
|
||||
+static const char *ConvertToGccTriple(StringRef CandidateTriple) {
|
||||
+ return llvm::StringSwitch<const char *>(CandidateTriple)
|
||||
+ .Case("aarch64-redhat-linux-gnu", "aarch64-redhat-linux")
|
||||
+ .Case("i686-redhat-linux-gnu", "i686-redhat-linux")
|
||||
+ .Case("ppc64le-redhat-linux-gnu", "ppc64le-redhat-linux")
|
||||
+ .Case("s390x-redhat-linux-gnu", "s390x-redhat-linux")
|
||||
+ .Case("x86_64-redhat-linux-gnu", "x86_64-redhat-linux")
|
||||
+ .Default(NULL);
|
||||
+}
|
||||
+
|
||||
/// Initialize a GCCInstallationDetector from the driver.
|
||||
///
|
||||
/// This performs all of the autodetection and sets up the various paths.
|
||||
@@ -2097,6 +2109,16 @@ void Generic_GCC::GCCInstallationDetector::init(
|
||||
// The compatible GCC triples for this particular architecture.
|
||||
SmallVector<StringRef, 16> CandidateTripleAliases;
|
||||
SmallVector<StringRef, 16> CandidateBiarchTripleAliases;
|
||||
+
|
||||
+ // In some cases gcc uses a slightly different triple than clang for the
|
||||
+ // same target. Convert the clang triple to the gcc equivalent and use that
|
||||
+ // to search for the gcc install.
|
||||
+ const char *ConvertedTriple = ConvertToGccTriple(TargetTriple.str());
|
||||
+ if (ConvertedTriple) {
|
||||
+ CandidateTripleAliases.push_back(ConvertedTriple);
|
||||
+ CandidateBiarchTripleAliases.push_back(ConvertedTriple);
|
||||
+ }
|
||||
+
|
||||
// Add some triples that we want to check first.
|
||||
CandidateTripleAliases.push_back(TargetTriple.str());
|
||||
std::string TripleNoVendor = TargetTriple.getArchName().str() + "-" +
|
||||
--
|
||||
2.42.0
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
# Drop the following option after debugedit adds support to DWARF-5:
|
||||
# https://sourceware.org/bugzilla/show_bug.cgi?id=28728
|
||||
-gdwarf-4
|
50
clang.spec
50
clang.spec
|
@ -12,11 +12,19 @@
|
|||
|
||||
%bcond_with compat_build
|
||||
%bcond_without check
|
||||
# Use lld to workaround memory limits on i686 and to fix bootstrap
|
||||
# issue where clang uses the wrong gold plugin version when the
|
||||
# LLVM compat package is present.
|
||||
%ifnarch s390x
|
||||
%bcond_without linker_lld
|
||||
%else
|
||||
%bcond_with linker_lld
|
||||
%endif
|
||||
|
||||
%global maj_ver 17
|
||||
%global min_ver 0
|
||||
%global patch_ver 6
|
||||
#global rc_ver 4
|
||||
%global maj_ver 18
|
||||
%global min_ver 1
|
||||
%global patch_ver 0
|
||||
%global rc_ver 4
|
||||
|
||||
%if %{with snapshot_build}
|
||||
%undefine rc_ver
|
||||
|
@ -56,12 +64,17 @@
|
|||
%global _smp_mflags -j8
|
||||
%endif
|
||||
|
||||
# Try to limit memory use on i686.
|
||||
%ifarch %ix86
|
||||
%constrain_build -m 3072
|
||||
%endif
|
||||
|
||||
%global clang_srcdir clang-%{clang_version}%{?rc_ver:rc%{rc_ver}}.src
|
||||
%global clang_tools_srcdir clang-tools-extra-%{clang_version}%{?rc_ver:rc%{rc_ver}}.src
|
||||
|
||||
Name: %pkg_name
|
||||
Version: %{clang_version}%{?rc_ver:~rc%{rc_ver}}%{?llvm_snapshot_version_suffix:~%{llvm_snapshot_version_suffix}}
|
||||
Release: 6%{?dist}
|
||||
Release: 1%{?dist}
|
||||
Summary: A C language family front-end for LLVM
|
||||
|
||||
License: Apache-2.0 WITH LLVM-exception OR NCSA
|
||||
|
@ -81,17 +94,13 @@ Source4: release-keys.asc
|
|||
%if %{without compat_build}
|
||||
Source5: macros.%{name}
|
||||
%endif
|
||||
Source6: clang.cfg
|
||||
|
||||
# Patches for clang
|
||||
Patch1: 0001-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch
|
||||
Patch2: 0003-PATCH-clang-Don-t-install-static-libraries.patch
|
||||
Patch3: 0001-Driver-Add-a-gcc-equivalent-triple-to-the-list-of-tr.patch
|
||||
# Workaround a bug in ORC on ppc64le.
|
||||
# More info is available here: https://reviews.llvm.org/D159115#4641826
|
||||
Patch5: 0001-Workaround-a-bug-in-ORC-on-ppc64le.patch
|
||||
Patch8: 0001-Clang-Fix-build-with-GCC-14-on-ARM.patch
|
||||
Patch9: 0001-Clang-Defer-the-instantiation-of-explicit-specifier-.patch
|
||||
|
||||
# RHEL specific patches
|
||||
# Avoid unwanted dependency on python-myst-parser
|
||||
|
@ -102,6 +111,9 @@ Patch101: 0009-disable-myst-parser.patch
|
|||
Patch201: 0001-clang-tools-extra-Make-test-dependency-on-LLVMHello-.patch
|
||||
|
||||
BuildRequires: clang
|
||||
%if %{with linker_lld}
|
||||
BuildRequires: lld
|
||||
%endif
|
||||
BuildRequires: cmake
|
||||
BuildRequires: ninja-build
|
||||
|
||||
|
@ -314,7 +326,9 @@ rm test/CodeGen/profile-filter.c
|
|||
%build
|
||||
|
||||
# And disable LTO on AArch64 entirely.
|
||||
%ifarch aarch64
|
||||
# There is a miscompile with lto on x86_64 when using clang-17
|
||||
# Disable lto on i686 due to memory constraints.
|
||||
%ifarch aarch64 x86_64 %ix86
|
||||
%define _lto_cflags %{nil}
|
||||
%endif
|
||||
|
||||
|
@ -328,6 +342,12 @@ rm test/CodeGen/profile-filter.c
|
|||
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /')
|
||||
%endif
|
||||
|
||||
%if %{with linker_lld}
|
||||
# TODO: Use LLVM_USE_LLD cmake option, but this doesn't seem to work with
|
||||
# standalone builds.
|
||||
%global build_ldflags %(echo %{build_ldflags} -fuse-ld=lld)
|
||||
%endif
|
||||
|
||||
# Disable dwz on aarch64, because it takes a huge amount of time to decide not to optimize things.
|
||||
%ifarch aarch64
|
||||
%define _find_debuginfo_dwz_opts %{nil}
|
||||
|
@ -468,6 +488,12 @@ ln -s ../../%{install_bindir}/clang++ %{buildroot}%{install_bindir}/clang++-%{m
|
|||
|
||||
%endif
|
||||
|
||||
# Install config file for clang
|
||||
%if %{maj_ver} >=18
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/%{name}/
|
||||
echo "--gcc-triple=%{_arch}-redhat-linux" >> %{buildroot}%{_sysconfdir}/%{name}/clang.cfg
|
||||
%endif
|
||||
|
||||
# Fix permissions of scan-view scripts
|
||||
chmod a+x %{buildroot}%{install_datadir}/scan-view/{Reporter.py,startfile.py}
|
||||
|
||||
|
@ -516,6 +542,7 @@ LD_LIBRARY_PATH=%{buildroot}/%{install_libdir} %{__ninja} check-all -C %{__cmake
|
|||
%{install_bindir}/clang++-%{maj_ver}
|
||||
%{install_bindir}/clang-cl
|
||||
%{install_bindir}/clang-cpp
|
||||
%{_sysconfdir}/%{name}/clang.cfg
|
||||
%if %{without compat_build}
|
||||
%{_mandir}/man1/clang.1.gz
|
||||
%{_mandir}/man1/clang++.1.gz
|
||||
|
@ -679,6 +706,9 @@ LD_LIBRARY_PATH=%{buildroot}/%{install_libdir} %{__ninja} check-all -C %{__cmake
|
|||
|
||||
%endif
|
||||
%changelog
|
||||
* Tue Feb 27 2024 Tom Stellard <tstellar@redhat.com> - 18.1.0~rc4-1
|
||||
- 18.0.1-rc4 Release
|
||||
|
||||
* Fri Jan 26 2024 Kefu Chai <kefu.chai@scylladb.com> - 17.0.6-6
|
||||
- Fix the too-early instantiation of conditional "explict" by applying the patch
|
||||
of https://github.com/llvm/llvm-project/commit/128b3b61fe6768c724975fd1df2be0abec848cf6
|
||||
|
|
8
sources
8
sources
|
@ -1,4 +1,4 @@
|
|||
SHA512 (clang-17.0.6.src.tar.xz) = da6f670a52d60c46bbe6bfa2870106f6a6714c9566fab293b8c624a555308104a1a05cd065643091d7006ef4533a9a722dff1fccaf26f348a0c0a5c7b9331439
|
||||
SHA512 (clang-tools-extra-17.0.6.src.tar.xz) = 5110dd36ee1c966d22760000f0c28cf070fd00b05445d418d264dbd3b48426a203f934e402d408fab2602dbf39a29d66898cc7c69c1a52b5e0e6e7097f9db877
|
||||
SHA512 (clang-tools-extra-17.0.6.src.tar.xz.sig) = 17ed3072a402ffa9f723e5ae5257a68ea6f9c874bec50d91c88159d38d8c121d23974ff3983f6f0d3308b5ec07086ba5c2d4cabfe6cbefeb6613fc30b577f966
|
||||
SHA512 (clang-17.0.6.src.tar.xz.sig) = 091dca426d275f5a71836f2230e0f12f212527259cc4a941638104b8fcf42b4a122f9c140d07f8c663d38242d10ca5390de1f89d9d7bc0171b66c77a9aebbb3f
|
||||
SHA512 (clang-18.1.0rc4.src.tar.xz) = 3cb33cc09e2de38616be52ac2a99f46bcea0cb049b815924afc42e89231cf05c431cb2ad1d91082b38569e0d83ed1e8d3746dd3fbe04a229bd06c59ccca8078f
|
||||
SHA512 (clang-18.1.0rc4.src.tar.xz.sig) = d26ae4c4b90f1676c1fe358223493b47a422ea57f64ac3734e192022f997c06a95d8477dd88950d36134d91b24953a6fb44b1f5a3f1161d4754d1480c8567793
|
||||
SHA512 (clang-tools-extra-18.1.0rc4.src.tar.xz) = 7d992483a6598b957651bc9f764e6599f5f39ddd5c8722c6be53208d2bd3b878a6c142ffedaf658e82e8d23ae7e9339493aec703861cb53c8eda43ce986d5785
|
||||
SHA512 (clang-tools-extra-18.1.0rc4.src.tar.xz.sig) = da58cfca29c1b02203543942cd54eaaa6c1e8c2f59d0da4e8b1f9ee37c962ed4fb0cdddc16e4918eb3abf17c5495aafebe5428eceecd0b7c42062ae47a3064ab
|
||||
|
|
Loading…
Reference in New Issue