summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-06-03 11:30:59 +0200
committerMichał Górny <mgorny@gentoo.org>2017-06-03 12:27:50 +0200
commit213b03205a77eae33b0ce31a8b176775125f8ab4 (patch)
treec42ea2f33a84782773b6625b9229493f197cf362
parentsys-devel/llvm: Move 3.7.1 patchset to tarball (diff)
downloadgentoo-213b03205a77eae33b0ce31a8b176775125f8ab4.tar.gz
gentoo-213b03205a77eae33b0ce31a8b176775125f8ab4.tar.bz2
gentoo-213b03205a77eae33b0ce31a8b176775125f8ab4.zip
sys-devel/llvm: Move 3.8.1 patchset to tarball
-rw-r--r--sys-devel/llvm/Manifest1
-rw-r--r--sys-devel/llvm/files/3.8.1/0004-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch33
-rw-r--r--sys-devel/llvm/files/3.8.1/0005-cmake-Do-not-install-libgtest.patch30
-rw-r--r--sys-devel/llvm/files/3.8.1/0008-cmake-Restore-SOVERSIONs-on-shared-libraries.patch28
-rw-r--r--sys-devel/llvm/files/3.8.1/clang/abi-tag-support-mangler.patch1230
-rw-r--r--sys-devel/llvm/files/3.8.1/clang/abi-tag-support-sema.patch419
-rw-r--r--sys-devel/llvm/files/3.8.1/clang/default-libs.patch106
-rw-r--r--sys-devel/llvm/files/3.8.1/clang/gcc4.9-search-path.patch70
-rw-r--r--sys-devel/llvm/files/3.8.1/clang/gentoo-runtime-gcc-detection-v3.patch42
-rw-r--r--sys-devel/llvm/files/3.8.1/clang/musl-support.patch108
-rw-r--r--sys-devel/llvm/files/3.8.1/compiler-rt/0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch25
-rw-r--r--sys-devel/llvm/files/3.8.1/compiler-rt/arm_march_flags.patch17
-rw-r--r--sys-devel/llvm/files/3.8.1/compiler-rt/darwin-default-sysroot.patch14
-rw-r--r--sys-devel/llvm/files/3.8.1/compiler-rt/fbsd.patch20
-rw-r--r--sys-devel/llvm/files/3.8.1/llvm-config.patch114
-rw-r--r--sys-devel/llvm/files/3.8.1/musl-env-support.patch164
-rw-r--r--sys-devel/llvm/llvm-3.8.1-r2.ebuild51
17 files changed, 27 insertions, 2445 deletions
diff --git a/sys-devel/llvm/Manifest b/sys-devel/llvm/Manifest
index e91c605e22eb..88cc2b1dd230 100644
--- a/sys-devel/llvm/Manifest
+++ b/sys-devel/llvm/Manifest
@@ -29,6 +29,7 @@ DIST llvm-3.7.0-manpages.tar.bz2 38095 SHA256 8597fa532464c6336aefbbef0b1ce452aa
DIST llvm-3.7.1-patchset.tar.gz 17234 SHA256 3add3f23c0eae09f52ac055362234a116da4fc1e5a7772cd9a90519549e9f096 SHA512 030dc7f72d11fcd53307f707d5dde321054feb0f0977601c3e188a37f2be6c14bfd05482d1c1e5f435aaf32ca7c7e3701cf5f1375fbd0cf83cf8afbad7f4f6be WHIRLPOOL fa5d3464ac6315dabac895b753918b0dbe301ef6d8e45a75934ba6b0ba947e30763d0522bd95b79ae4a714b1234bb08e654c0a9987fd74e692eeb2afe16694e8
DIST llvm-3.7.1.src.tar.xz 14592544 SHA256 be7794ed0cec42d6c682ca8e3517535b54555a3defabec83554dbc74db545ad5 SHA512 ac521debc02f6deba96ef975d6a546b0c5c77299c1dbf5e1b87a7974ff5e7fd715bd7e384b92d9adf572ce47130bdbf6d3c648eb0d7f72f16f976292e4909e90 WHIRLPOOL 788ce0907b906ebee595c766713bec5067563c8aba7460211f5830e116df7c830de84704834c0df2f2f2c90354d75521e4a4aff57e769a2d8ab590778c1e4a70
DIST llvm-3.8.0-manpages.tar.bz2 37889 SHA256 4dda7f69f9412e0fb50d32631df34d6ea7f93c945c9a59cb050a99f1d2d0508b SHA512 a93ed7a25b75c237a0967ba7a501c71af3e7e9292ebabf69733bc637e9a4534dcaee539c6b1f6b2df7a87103c2371b1cf130fac05b88047100988c814e89ab0f WHIRLPOOL 9790a576fd4db798c2339bb4ea1dc973f1057177364770a104be7916998a1ad824e6b4eee296066ddd32eb5e6c57ffd5716457cecbd8ca9fe1b317d0d5ed2676
+DIST llvm-3.8.1-patchset.tar.xz 24260 SHA256 4a1677b5aff3a4ca8ccdbcc45e286e44d23867cbaa48a39cffc0fc2a8765ed6c SHA512 1e4ec68c56cc72a89afb573ad0c3cada10be7ec02e0af033a6c5cf8ce46ed7bf40389543c2f1b11e7080dba49962c57b4ea9f9bc971c4647eb3fd945c0cf0529 WHIRLPOOL 38c16b23f995818a6ca292e89d28f85ae6d19327bc0efe72270611077a7b76bca99b2e1f11b8653550bddee4123f2611621b86c4b81cdb8f96edc1cd4c5cfc4f
DIST llvm-3.8.1.src.tar.xz 16551472 SHA256 6e82ce4adb54ff3afc18053d6981b6aed1406751b8742582ed50f04b5ab475f9 SHA512 99bbb2cc5f337fd5edf1621f8028c8cb74011aa4af2531018dc05409b27f7b8d0c2f76a00115f677f7c013029d5d9f55d085a5b40433409aac4e9161d53bd366 WHIRLPOOL a99cef164a0e05e5237b840bee776d48fe0bde460cb4536f03a5e4eb0cc630deeb96f76bdd42f912a4b2dab08133bd9137ea16be1b9582d375f0f5841dd40234
DIST llvm-3.9.0_rc3-manpages.tar.bz2 80007 SHA256 991f5238d23c0aee2fd303d1adecd6045c42ed066f42f0d58f62c3a25c197140 SHA512 f96c340021de3f096ec3ad7d51a6af2c7a84974122d1df15729a39d4f9d65452f063a85ab38adb064288dc14220d9cc679b31ee19b48424d3d7cde621ff37597 WHIRLPOOL d3f24a2faaa5aa909519373532262c342acf517048ac543f303b6ddb539f5ece876a338c8efc445f4ada6f723a4e65e35bd5f2f9b4f52ef96ef832000259ab20
DIST llvm-3.9.1.src.tar.xz 18130436 SHA256 1fd90354b9cf19232e8f168faf2220e79be555df3aa743242700879e8fd329ee SHA512 50cbe8ee911080f586e77861c442348701bd02e2de0c090c54c34f82ac275ecfcd712af0f41e387c33b4a6057778a4258a27554292fe68ab4af3fd9dd6d90683 WHIRLPOOL 1cd1a25befcb178bec4a4aace4367167f3838d32edbe9db9de8c6e558c01c1fcf123f6d6f80b7ec9ff32b3d6dcf2de2f4eb4201d417c3d17a5c8a69934832903
diff --git a/sys-devel/llvm/files/3.8.1/0004-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch b/sys-devel/llvm/files/3.8.1/0004-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch
deleted file mode 100644
index 94a81574d6ee..000000000000
--- a/sys-devel/llvm/files/3.8.1/0004-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 2f798e87c10a93235a00e95c38e736f9ff7e991b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
-Date: Mon, 8 Jun 2015 14:29:03 +0200
-Subject: [PATCH 04/10] cmake: Add an ordering dep between HTML & man Sphinx
- targets
-
-Add a dependency between HTML & manpage Sphinx targets to prevent two
-instances of Sphinx from running in parallel, and therefore solves race
-conditions reusing the same doctree directory.
-
-Bug: https://llvm.org/bugs/show_bug.cgi?id=23781
-Patch: https://reviews.llvm.org/D23755
----
- docs/CMakeLists.txt | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
-index f2cd7e9..179a65b 100644
---- a/docs/CMakeLists.txt
-+++ b/docs/CMakeLists.txt
-@@ -109,6 +109,9 @@ if (LLVM_ENABLE_SPHINX)
-
- if (${SPHINX_OUTPUT_MAN})
- add_sphinx_target(man llvm)
-+ if (${SPHINX_OUTPUT_HTML})
-+ add_dependencies(docs-llvm-html docs-llvm-man)
-+ endif()
- endif()
-
- endif()
---
-2.9.3
-
diff --git a/sys-devel/llvm/files/3.8.1/0005-cmake-Do-not-install-libgtest.patch b/sys-devel/llvm/files/3.8.1/0005-cmake-Do-not-install-libgtest.patch
deleted file mode 100644
index a24977c03140..000000000000
--- a/sys-devel/llvm/files/3.8.1/0005-cmake-Do-not-install-libgtest.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 1303993b5b9a4195ebe4930a8cd345c875e7f25c Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
-Date: Tue, 9 Jun 2015 11:58:52 +0200
-Subject: [PATCH 05/10] cmake: Do not install libgtest
-
-libgtest is an internal test dependency, and should not be installed to
-the live system as a part of LLVM.
-
-Bug: http://llvm.org/bugs/show_bug.cgi?id=18341
----
- utils/unittest/CMakeLists.txt | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/utils/unittest/CMakeLists.txt b/utils/unittest/CMakeLists.txt
-index c9a2cdd..bb4f667 100644
---- a/utils/unittest/CMakeLists.txt
-+++ b/utils/unittest/CMakeLists.txt
-@@ -37,6 +37,9 @@ if (PTHREAD_LIBRARY_PATH)
- list(APPEND LIBS pthread)
- endif()
-
-+# Delay building until the tests pull it in, and avoid installing it
-+set(EXCLUDE_FROM_ALL ON)
-+
- add_llvm_library(gtest
- googletest/src/gtest-all.cc
-
---
-2.9.3
-
diff --git a/sys-devel/llvm/files/3.8.1/0008-cmake-Restore-SOVERSIONs-on-shared-libraries.patch b/sys-devel/llvm/files/3.8.1/0008-cmake-Restore-SOVERSIONs-on-shared-libraries.patch
deleted file mode 100644
index c333bc4b9627..000000000000
--- a/sys-devel/llvm/files/3.8.1/0008-cmake-Restore-SOVERSIONs-on-shared-libraries.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 597ebcc28580a8532f6634e2a723901c3448b9ff Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
-Date: Mon, 28 Mar 2016 22:21:19 +0200
-Subject: [PATCH 08/10] cmake: Restore SOVERSIONs on shared libraries
-
----
- cmake/modules/AddLLVM.cmake | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
-index 9590a1b..83a2359 100644
---- a/cmake/modules/AddLLVM.cmake
-+++ b/cmake/modules/AddLLVM.cmake
-@@ -445,6 +445,11 @@ function(llvm_add_library name)
- PREFIX ""
- )
- endif()
-+
-+ set_target_properties(${name}
-+ PROPERTIES
-+ SOVERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}
-+ VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX})
- endif()
-
- if(ARG_MODULE OR ARG_SHARED)
---
-2.9.3
-
diff --git a/sys-devel/llvm/files/3.8.1/clang/abi-tag-support-mangler.patch b/sys-devel/llvm/files/3.8.1/clang/abi-tag-support-mangler.patch
deleted file mode 100644
index d259757372f4..000000000000
--- a/sys-devel/llvm/files/3.8.1/clang/abi-tag-support-mangler.patch
+++ /dev/null
@@ -1,1230 +0,0 @@
-diff -Nuar llvm-3.8.0.src.orig/tools/clang/lib/AST/ItaniumMangle.cpp llvm-3.8.0.src/tools/clang/lib/AST/ItaniumMangle.cpp
---- llvm-3.8.0.src.orig/tools/clang/lib/AST/ItaniumMangle.cpp 2016-01-09 13:53:17.000000000 +0100
-+++ llvm-3.8.0.src/tools/clang/lib/AST/ItaniumMangle.cpp 2016-07-10 23:59:08.412719561 +0200
-@@ -212,6 +212,12 @@
- class CXXNameMangler {
- ItaniumMangleContextImpl &Context;
- raw_ostream &Out;
-+ bool NullOut = false;
-+ /// In the "DisableDerivedAbiTags" mode derived ABI tags are not calculated.
-+ /// This mode is used when mangler creates another mangler recursively to
-+ /// calculate ABI tags for the function return value or the variable type.
-+ /// Also it is required to avoid infinite recursion in some cases.
-+ bool DisableDerivedAbiTags = false;
-
- /// The "structor" is the top-level declaration being mangled, if
- /// that's not a template specialization; otherwise it's the pattern
-@@ -261,15 +267,131 @@
-
- } FunctionTypeDepth;
-
-+ // abi_tag is a gcc attribute, taking one or more strings called "tags".
-+ // The goal is to annotate against which version of a library an object was
-+ // built and to be able to provide backwards compatibility ("dual abi").
-+ // For more information see docs/ItaniumMangleAbiTags.rst.
-+ typedef SmallVector<StringRef, 4> AbiTagList;
-+ typedef llvm::SmallSetVector<StringRef, 4> AbiTagSet;
-+
-+ // State to gather all implicit and explicit tags used in a mangled name.
-+ // Must always have an instance of this while emitting any name to keep
-+ // track.
-+ class AbiTagState final {
-+ //! All abi tags used implicitly or explicitly
-+ AbiTagSet UsedAbiTags;
-+ //! All explicit abi tags (i.e. not from namespace)
-+ AbiTagSet EmittedAbiTags;
-+
-+ AbiTagState *&LinkHead;
-+ AbiTagState *Parent = nullptr;
-+
-+ bool LinkActive = false;
-+
-+ public:
-+ explicit AbiTagState(AbiTagState *&Head) : LinkHead(Head) {
-+ Parent = LinkHead;
-+ LinkHead = this;
-+ LinkActive = true;
-+ }
-+
-+ // no copy, no move
-+ AbiTagState(const AbiTagState &) = delete;
-+ AbiTagState &operator=(const AbiTagState &) = delete;
-+
-+ ~AbiTagState() { pop(); }
-+
-+ void pop() {
-+ if (!LinkActive)
-+ return;
-+
-+ assert(LinkHead == this &&
-+ "abi tag link head must point to us on destruction");
-+ LinkActive = false;
-+ if (Parent) {
-+ Parent->UsedAbiTags.insert(UsedAbiTags.begin(), UsedAbiTags.end());
-+ Parent->EmittedAbiTags.insert(EmittedAbiTags.begin(),
-+ EmittedAbiTags.end());
-+ }
-+ LinkHead = Parent;
-+ }
-+
-+ void write(raw_ostream &Out, const NamedDecl *ND,
-+ const AbiTagList *AdditionalAbiTags) {
-+ ND = cast<NamedDecl>(ND->getCanonicalDecl());
-+
-+ if (!isa<FunctionDecl>(ND) && !isa<VarDecl>(ND)) {
-+ assert(
-+ !AdditionalAbiTags &&
-+ "only function and variables need a list of additional abi tags");
-+ if (const auto *NS = dyn_cast<NamespaceDecl>(ND)) {
-+ if (const auto *AbiTag = NS->getAttr<AbiTagAttr>()) {
-+ for (const auto &Tag : AbiTag->tags()) {
-+ UsedAbiTags.insert(Tag);
-+ }
-+ }
-+ // Don't emit abi tags for namespaces.
-+ return;
-+ }
-+ }
-+
-+ AbiTagList TagList;
-+ if (const auto *AbiTag = ND->getAttr<AbiTagAttr>()) {
-+ for (const auto &Tag : AbiTag->tags()) {
-+ UsedAbiTags.insert(Tag);
-+ // AbiTag->tags() is sorted and has no duplicates
-+ TagList.push_back(Tag);
-+ }
-+ }
-+
-+ if (AdditionalAbiTags) {
-+ for (const auto &Tag : *AdditionalAbiTags) {
-+ UsedAbiTags.insert(Tag);
-+ if (std::find(TagList.begin(), TagList.end(), Tag) == TagList.end()) {
-+ // don't insert duplicates
-+ TagList.push_back(Tag);
-+ }
-+ }
-+ // AbiTag->tags() are already sorted; only add if we had additional tags
-+ std::sort(TagList.begin(), TagList.end());
-+ }
-+
-+ writeSortedUniqueAbiTags(Out, TagList);
-+ }
-+
-+ const AbiTagSet &getUsedAbiTags() const { return UsedAbiTags; }
-+ void setUsedAbiTags(const AbiTagSet &AbiTags) {
-+ UsedAbiTags = AbiTags;
-+ }
-+
-+ const AbiTagSet &getEmittedAbiTags() const {
-+ return EmittedAbiTags;
-+ }
-+
-+ private:
-+ template <typename TagList>
-+ void writeSortedUniqueAbiTags(raw_ostream &Out, TagList const &AbiTags) {
-+ for (const auto &Tag : AbiTags) {
-+ EmittedAbiTags.insert(Tag);
-+ Out << "B";
-+ Out << Tag.size();
-+ Out << Tag;
-+ }
-+ }
-+ };
-+
-+ AbiTagState *AbiTags = nullptr;
-+ AbiTagState AbiTagsRoot;
-+
- llvm::DenseMap<uintptr_t, unsigned> Substitutions;
-
- ASTContext &getASTContext() const { return Context.getASTContext(); }
-
- public:
- CXXNameMangler(ItaniumMangleContextImpl &C, raw_ostream &Out_,
-- const NamedDecl *D = nullptr)
-- : Context(C), Out(Out_), Structor(getStructor(D)), StructorType(0),
-- SeqID(0) {
-+ const NamedDecl *D = nullptr, bool NullOut_ = false)
-+ : Context(C), Out(Out_), NullOut(NullOut_), Structor(getStructor(D)),
-+ StructorType(0), SeqID(0), AbiTagsRoot(AbiTags) {
- // These can't be mangled without a ctor type or dtor type.
- assert(!D || (!isa<CXXDestructorDecl>(D) &&
- !isa<CXXConstructorDecl>(D)));
-@@ -277,11 +399,16 @@
- CXXNameMangler(ItaniumMangleContextImpl &C, raw_ostream &Out_,
- const CXXConstructorDecl *D, CXXCtorType Type)
- : Context(C), Out(Out_), Structor(getStructor(D)), StructorType(Type),
-- SeqID(0) { }
-+ SeqID(0), AbiTagsRoot(AbiTags) { }
- CXXNameMangler(ItaniumMangleContextImpl &C, raw_ostream &Out_,
- const CXXDestructorDecl *D, CXXDtorType Type)
- : Context(C), Out(Out_), Structor(getStructor(D)), StructorType(Type),
-- SeqID(0) { }
-+ SeqID(0), AbiTagsRoot(AbiTags) { }
-+
-+ CXXNameMangler(CXXNameMangler &Outer, llvm::raw_null_ostream &Out_)
-+ : Context(Outer.Context), Out(Out_), NullOut(true),
-+ Structor(Outer.Structor), StructorType(Outer.StructorType),
-+ SeqID(Outer.SeqID), AbiTagsRoot(AbiTags) {}
-
- #if MANGLE_CHECKER
- ~CXXNameMangler() {
-@@ -296,14 +423,18 @@
- #endif
- raw_ostream &getStream() { return Out; }
-
-+ void disableDerivedAbiTags() { DisableDerivedAbiTags = true; }
-+ static bool shouldHaveAbiTags(ItaniumMangleContextImpl &C, const VarDecl *VD);
-+
- void mangle(const NamedDecl *D);
- void mangleCallOffset(int64_t NonVirtual, int64_t Virtual);
- void mangleNumber(const llvm::APSInt &I);
- void mangleNumber(int64_t Number);
- void mangleFloat(const llvm::APFloat &F);
-- void mangleFunctionEncoding(const FunctionDecl *FD);
-+ void mangleFunctionEncoding(const FunctionDecl *FD,
-+ bool ExcludeUnqualifiedName = false);
- void mangleSeqID(unsigned SeqID);
-- void mangleName(const NamedDecl *ND);
-+ void mangleName(const NamedDecl *ND, bool ExcludeUnqualifiedName = false);
- void mangleType(QualType T);
- void mangleNameOrStandardSubstitution(const NamedDecl *ND);
-
-@@ -334,31 +465,53 @@
- DeclarationName name,
- unsigned KnownArity = UnknownArity);
-
-- void mangleName(const TemplateDecl *TD,
-- const TemplateArgument *TemplateArgs,
-- unsigned NumTemplateArgs);
-- void mangleUnqualifiedName(const NamedDecl *ND) {
-- mangleUnqualifiedName(ND, ND->getDeclName(), UnknownArity);
-+ void mangleFunctionEncodingBareType(const FunctionDecl *FD);
-+
-+ void mangleNameWithAbiTags(const NamedDecl *ND,
-+ const AbiTagList *AdditionalAbiTags,
-+ bool ExcludeUnqualifiedName);
-+ void mangleTemplateName(const TemplateDecl *TD,
-+ const AbiTagList *AdditionalAbiTags,
-+ bool ExcludeUnqualifiedName,
-+ const TemplateArgument *TemplateArgs,
-+ unsigned NumTemplateArgs);
-+ void mangleUnqualifiedName(const NamedDecl *ND,
-+ const AbiTagList *AdditionalAbiTags) {
-+ mangleUnqualifiedName(ND, ND->getDeclName(), UnknownArity,
-+ AdditionalAbiTags);
- }
- void mangleUnqualifiedName(const NamedDecl *ND, DeclarationName Name,
-- unsigned KnownArity);
-- void mangleUnscopedName(const NamedDecl *ND);
-- void mangleUnscopedTemplateName(const TemplateDecl *ND);
-- void mangleUnscopedTemplateName(TemplateName);
-+ unsigned KnownArity,
-+ const AbiTagList *AdditionalAbiTags);
-+ void mangleUnscopedName(const NamedDecl *ND,
-+ const AbiTagList *AdditionalAbiTags);
-+ void mangleUnscopedTemplateName(const TemplateDecl *ND,
-+ const AbiTagList *AdditionalAbiTags);
-+ void mangleUnscopedTemplateName(TemplateName,
-+ const AbiTagList *AdditionalAbiTags);
- void mangleSourceName(const IdentifierInfo *II);
-- void mangleLocalName(const Decl *D);
-+ void mangleLocalName(const Decl *D,
-+ const AbiTagList *AdditionalAbiTags,
-+ bool ExcludeUnqualifiedName);
- void mangleBlockForPrefix(const BlockDecl *Block);
- void mangleUnqualifiedBlock(const BlockDecl *Block);
- void mangleLambda(const CXXRecordDecl *Lambda);
- void mangleNestedName(const NamedDecl *ND, const DeclContext *DC,
-- bool NoFunction=false);
-+ const AbiTagList *AdditionalAbiTags,
-+ bool NoFunction,
-+ bool ExcludeUnqualifiedName);
- void mangleNestedName(const TemplateDecl *TD,
-+ const AbiTagList *AdditionalAbiTags,
-+ bool ExcludeUnqualifiedName,
- const TemplateArgument *TemplateArgs,
- unsigned NumTemplateArgs);
- void manglePrefix(NestedNameSpecifier *qualifier);
- void manglePrefix(const DeclContext *DC, bool NoFunction=false);
- void manglePrefix(QualType type);
-- void mangleTemplatePrefix(const TemplateDecl *ND, bool NoFunction=false);
-+ void mangleTemplatePrefix(const TemplateDecl *ND,
-+ const AbiTagList *AdditionalAbiTags,
-+ bool NoFunction = false,
-+ bool ExcludeUnqualifiedName = false);
- void mangleTemplatePrefix(TemplateName Template);
- bool mangleUnresolvedTypeOrSimpleId(QualType DestroyedType,
- StringRef Prefix = "");
-@@ -405,6 +558,13 @@
- void mangleTemplateParameter(unsigned Index);
-
- void mangleFunctionParam(const ParmVarDecl *parm);
-+
-+ void writeAbiTags(const NamedDecl *ND,
-+ const AbiTagList *AdditionalAbiTags = nullptr);
-+
-+ AbiTagSet getTagsFromPrefixAndTemplateArguments(const NamedDecl *ND);
-+ AbiTagList makeAdditionalTagsForFunction(const FunctionDecl *FD);
-+ AbiTagList makeAdditionalTagsForVariable(const VarDecl *VD);
- };
-
- }
-@@ -448,6 +608,7 @@
- while (!DC->isNamespace() && !DC->isTranslationUnit())
- DC = getEffectiveParentContext(DC);
- if (DC->isTranslationUnit() && D->getFormalLinkage() != InternalLinkage &&
-+ !CXXNameMangler::shouldHaveAbiTags(*this, VD) &&
- !isa<VarTemplateSpecializationDecl>(D))
- return false;
- }
-@@ -455,6 +616,12 @@
- return true;
- }
-
-+void CXXNameMangler::writeAbiTags(const NamedDecl *ND,
-+ const AbiTagList *AdditionalAbiTags) {
-+ assert(AbiTags && "require AbiTagState");
-+ AbiTags->write(Out, ND, DisableDerivedAbiTags ? nullptr : AdditionalAbiTags);
-+}
-+
- void CXXNameMangler::mangle(const NamedDecl *D) {
- // <mangled-name> ::= _Z <encoding>
- // ::= <data name>
-@@ -470,14 +637,31 @@
- mangleName(cast<FieldDecl>(D));
- }
-
--void CXXNameMangler::mangleFunctionEncoding(const FunctionDecl *FD) {
-- // <encoding> ::= <function name> <bare-function-type>
-- mangleName(FD);
--
-+void CXXNameMangler::mangleFunctionEncoding(const FunctionDecl *FD,
-+ bool ExcludeUnqualifiedName) {
- // Don't mangle in the type if this isn't a decl we should typically mangle.
-- if (!Context.shouldMangleDeclName(FD))
-+ if (!Context.shouldMangleDeclName(FD)) {
-+ mangleNameWithAbiTags(FD, /* AdditionalAbiTags */ nullptr,
-+ ExcludeUnqualifiedName);
- return;
-+ }
-+
-+ // <encoding> ::= <function name> <bare-function-type>
-+
-+ if (ExcludeUnqualifiedName) {
-+ // running makeAdditionalTagsForFunction would loop, don't need it here
-+ // anyway
-+ mangleNameWithAbiTags(FD, /* AdditionalAbiTags */ nullptr,
-+ ExcludeUnqualifiedName);
-+ } else {
-+ AbiTagList AdditionalAbiTags = makeAdditionalTagsForFunction(FD);
-+ mangleNameWithAbiTags(FD, &AdditionalAbiTags, ExcludeUnqualifiedName);
-+ }
-
-+ mangleFunctionEncodingBareType(FD);
-+}
-+
-+void CXXNameMangler::mangleFunctionEncodingBareType(const FunctionDecl *FD) {
- if (FD->hasAttr<EnableIfAttr>()) {
- FunctionTypeDepthState Saved = FunctionTypeDepth.push();
- Out << "Ua9enable_ifI";
-@@ -581,7 +765,24 @@
- return nullptr;
- }
-
--void CXXNameMangler::mangleName(const NamedDecl *ND) {
-+// Must not be run from mangleLocalName for the <entity name> as it would loop
-+// otherwise.
-+void CXXNameMangler::mangleName(const NamedDecl *ND,
-+ bool ExcludeUnqualifiedName) {
-+ if (!ExcludeUnqualifiedName) {
-+ if (const auto *VD = dyn_cast<VarDecl>(ND)) {
-+ AbiTagList VariableAdditionalAbiTags = makeAdditionalTagsForVariable(VD);
-+ mangleNameWithAbiTags(VD, &VariableAdditionalAbiTags,
-+ ExcludeUnqualifiedName);
-+ return;
-+ }
-+ }
-+ mangleNameWithAbiTags(ND, nullptr, ExcludeUnqualifiedName);
-+}
-+
-+void CXXNameMangler::mangleNameWithAbiTags(const NamedDecl *ND,
-+ const AbiTagList *AdditionalAbiTags,
-+ bool ExcludeUnqualifiedName) {
- // <name> ::= <nested-name>
- // ::= <unscoped-name>
- // ::= <unscoped-template-name> <template-args>
-@@ -597,7 +798,7 @@
- while (!DC->isNamespace() && !DC->isTranslationUnit())
- DC = getEffectiveParentContext(DC);
- else if (GetLocalClassDecl(ND)) {
-- mangleLocalName(ND);
-+ mangleLocalName(ND, AdditionalAbiTags, ExcludeUnqualifiedName);
- return;
- }
-
-@@ -607,76 +808,93 @@
- // Check if we have a template.
- const TemplateArgumentList *TemplateArgs = nullptr;
- if (const TemplateDecl *TD = isTemplate(ND, TemplateArgs)) {
-- mangleUnscopedTemplateName(TD);
-+ if (!ExcludeUnqualifiedName)
-+ mangleUnscopedTemplateName(TD, AdditionalAbiTags);
- mangleTemplateArgs(*TemplateArgs);
- return;
- }
-
-- mangleUnscopedName(ND);
-+ if (!ExcludeUnqualifiedName)
-+ mangleUnscopedName(ND, AdditionalAbiTags);
- return;
- }
-
- if (isLocalContainerContext(DC)) {
-- mangleLocalName(ND);
-+ mangleLocalName(ND, AdditionalAbiTags, ExcludeUnqualifiedName);
- return;
- }
-
-- mangleNestedName(ND, DC);
-+ mangleNestedName(ND, DC, AdditionalAbiTags, /* NoFunction */ false,
-+ ExcludeUnqualifiedName);
- }
--void CXXNameMangler::mangleName(const TemplateDecl *TD,
-- const TemplateArgument *TemplateArgs,
-- unsigned NumTemplateArgs) {
-+
-+void CXXNameMangler::mangleTemplateName(const TemplateDecl *TD,
-+ const AbiTagList *AdditionalAbiTags,
-+ bool ExcludeUnqualifiedName,
-+ const TemplateArgument *TemplateArgs,
-+ unsigned NumTemplateArgs) {
- const DeclContext *DC = IgnoreLinkageSpecDecls(getEffectiveDeclContext(TD));
-
- if (DC->isTranslationUnit() || isStdNamespace(DC)) {
-- mangleUnscopedTemplateName(TD);
-+ if (!ExcludeUnqualifiedName)
-+ mangleUnscopedTemplateName(TD, AdditionalAbiTags);
- mangleTemplateArgs(TemplateArgs, NumTemplateArgs);
- } else {
-- mangleNestedName(TD, TemplateArgs, NumTemplateArgs);
-+ mangleNestedName(TD, AdditionalAbiTags, ExcludeUnqualifiedName,
-+ TemplateArgs, NumTemplateArgs);
- }
- }
-
--void CXXNameMangler::mangleUnscopedName(const NamedDecl *ND) {
-+void CXXNameMangler::mangleUnscopedName(const NamedDecl *ND,
-+ const AbiTagList *AdditionalAbiTags) {
- // <unscoped-name> ::= <unqualified-name>
- // ::= St <unqualified-name> # ::std::
-
- if (isStdNamespace(IgnoreLinkageSpecDecls(getEffectiveDeclContext(ND))))
- Out << "St";
-
-- mangleUnqualifiedName(ND);
-+ mangleUnqualifiedName(ND, AdditionalAbiTags);
- }
-
--void CXXNameMangler::mangleUnscopedTemplateName(const TemplateDecl *ND) {
-+void CXXNameMangler::mangleUnscopedTemplateName(
-+ const TemplateDecl *ND, const AbiTagList *AdditionalAbiTags) {
- // <unscoped-template-name> ::= <unscoped-name>
- // ::= <substitution>
- if (mangleSubstitution(ND))
- return;
-
- // <template-template-param> ::= <template-param>
-- if (const auto *TTP = dyn_cast<TemplateTemplateParmDecl>(ND))
-+ if (const auto *TTP = dyn_cast<TemplateTemplateParmDecl>(ND)) {
-+ assert(!AdditionalAbiTags &&
-+ "template template param cannot have abi tags");
- mangleTemplateParameter(TTP->getIndex());
-- else
-- mangleUnscopedName(ND->getTemplatedDecl());
-+ } else {
-+ mangleUnscopedName(ND->getTemplatedDecl(), AdditionalAbiTags);
-+ }
-
- addSubstitution(ND);
- }
-
--void CXXNameMangler::mangleUnscopedTemplateName(TemplateName Template) {
-+void CXXNameMangler::mangleUnscopedTemplateName(
-+ TemplateName Template, const AbiTagList *AdditionalAbiTags) {
- // <unscoped-template-name> ::= <unscoped-name>
- // ::= <substitution>
- if (TemplateDecl *TD = Template.getAsTemplateDecl())
-- return mangleUnscopedTemplateName(TD);
-+ return mangleUnscopedTemplateName(TD, AdditionalAbiTags);
-
- if (mangleSubstitution(Template))
- return;
-
-+ assert(!AdditionalAbiTags &&
-+ "dependent template name cannot have abi tags");
-+
- DependentTemplateName *Dependent = Template.getAsDependentTemplateName();
- assert(Dependent && "Not a dependent template name?");
- if (const IdentifierInfo *Id = Dependent->getIdentifier())
- mangleSourceName(Id);
- else
- mangleOperatorName(Dependent->getOperator(), UnknownArity);
--
-+
- addSubstitution(Template);
- }
-
-@@ -835,6 +1053,7 @@
- else
- Out << "sr";
- mangleSourceName(qualifier->getAsNamespace()->getIdentifier());
-+ writeAbiTags(qualifier->getAsNamespace());
- break;
- case NestedNameSpecifier::NamespaceAlias:
- if (qualifier->getPrefix())
-@@ -843,6 +1062,7 @@
- else
- Out << "sr";
- mangleSourceName(qualifier->getAsNamespaceAlias()->getIdentifier());
-+ writeAbiTags(qualifier->getAsNamespaceAlias());
- break;
-
- case NestedNameSpecifier::TypeSpec:
-@@ -877,6 +1097,7 @@
- Out << "sr";
-
- mangleSourceName(qualifier->getAsIdentifier());
-+ // an Identifier has no type information, so we can't emit abi tags for it
- break;
- }
-
-@@ -922,7 +1143,8 @@
-
- void CXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND,
- DeclarationName Name,
-- unsigned KnownArity) {
-+ unsigned KnownArity,
-+ const AbiTagList *AdditionalAbiTags) {
- unsigned Arity = KnownArity;
- // <unqualified-name> ::= <operator-name>
- // ::= <ctor-dtor-name>
-@@ -941,6 +1163,7 @@
- Out << 'L';
-
- mangleSourceName(II);
-+ writeAbiTags(ND, AdditionalAbiTags);
- break;
- }
-
-@@ -980,6 +1203,7 @@
- assert(FD->getIdentifier() && "Data member name isn't an identifier!");
-
- mangleSourceName(FD->getIdentifier());
-+ // Not emitting abi tags: internal name anyway
- break;
- }
-
-@@ -1000,6 +1224,10 @@
- assert(D->getDeclName().getAsIdentifierInfo() &&
- "Typedef was not named!");
- mangleSourceName(D->getDeclName().getAsIdentifierInfo());
-+ assert(!AdditionalAbiTags && "Type cannot have additional abi tags");
-+ // explicit abi tags are still possible; take from underlying type, not
-+ // from typedef.
-+ writeAbiTags(TD, nullptr);
- break;
- }
-
-@@ -1009,6 +1237,8 @@
- // <lambda-sig> ::= <parameter-type>+ # Parameter types or 'v' for 'void'.
- if (const CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(TD)) {
- if (Record->isLambda() && Record->getLambdaManglingNumber()) {
-+ assert(!AdditionalAbiTags &&
-+ "Lambda type cannot have additional abi tags");
- mangleLambda(Record);
- break;
- }
-@@ -1020,11 +1250,13 @@
- if (UnnamedMangle > 1)
- Out << UnnamedMangle - 2;
- Out << '_';
-+ writeAbiTags(TD, AdditionalAbiTags);
- break;
- }
-
-- // Get a unique id for the anonymous struct.
-- unsigned AnonStructId = Context.getAnonymousStructId(TD);
-+ // Get a unique id for the anonymous struct. If it is not a real output
-+ // ID doesn't matter so use fake one.
-+ unsigned AnonStructId = NullOut ? 0 : Context.getAnonymousStructId(TD);
-
- // Mangle it as a source name in the form
- // [n] $_<id>
-@@ -1052,6 +1284,7 @@
- // Otherwise, use the complete constructor name. This is relevant if a
- // class with a constructor is declared within a constructor.
- mangleCXXCtorType(Ctor_Complete);
-+ writeAbiTags(ND, AdditionalAbiTags);
- break;
-
- case DeclarationName::CXXDestructorName:
-@@ -1063,6 +1296,7 @@
- // Otherwise, use the complete destructor name. This is relevant if a
- // class with a destructor is declared within a destructor.
- mangleCXXDtorType(Dtor_Complete);
-+ writeAbiTags(ND, AdditionalAbiTags);
- break;
-
- case DeclarationName::CXXOperatorName:
-@@ -1078,6 +1312,7 @@
- case DeclarationName::CXXConversionFunctionName:
- case DeclarationName::CXXLiteralOperatorName:
- mangleOperatorName(Name, Arity);
-+ writeAbiTags(ND, AdditionalAbiTags);
- break;
-
- case DeclarationName::CXXUsingDirective:
-@@ -1094,7 +1329,9 @@
-
- void CXXNameMangler::mangleNestedName(const NamedDecl *ND,
- const DeclContext *DC,
-- bool NoFunction) {
-+ const AbiTagList *AdditionalAbiTags,
-+ bool NoFunction,
-+ bool ExcludeUnqualifiedName) {
- // <nested-name>
- // ::= N [<CV-qualifiers>] [<ref-qualifier>] <prefix> <unqualified-name> E
- // ::= N [<CV-qualifiers>] [<ref-qualifier>] <template-prefix>
-@@ -1114,30 +1351,36 @@
- // Check if we have a template.
- const TemplateArgumentList *TemplateArgs = nullptr;
- if (const TemplateDecl *TD = isTemplate(ND, TemplateArgs)) {
-- mangleTemplatePrefix(TD, NoFunction);
-+ mangleTemplatePrefix(TD, AdditionalAbiTags, NoFunction,
-+ ExcludeUnqualifiedName);
- mangleTemplateArgs(*TemplateArgs);
- }
- else {
- manglePrefix(DC, NoFunction);
-- mangleUnqualifiedName(ND);
-+ if (!ExcludeUnqualifiedName)
-+ mangleUnqualifiedName(ND, AdditionalAbiTags);
- }
-
- Out << 'E';
- }
- void CXXNameMangler::mangleNestedName(const TemplateDecl *TD,
-+ const AbiTagList *AdditionalAbiTags,
-+ bool ExcludeUnqualifiedName,
- const TemplateArgument *TemplateArgs,
- unsigned NumTemplateArgs) {
- // <nested-name> ::= N [<CV-qualifiers>] <template-prefix> <template-args> E
-
- Out << 'N';
-
-- mangleTemplatePrefix(TD);
-+ mangleTemplatePrefix(TD, AdditionalAbiTags, ExcludeUnqualifiedName);
- mangleTemplateArgs(TemplateArgs, NumTemplateArgs);
-
- Out << 'E';
- }
-
--void CXXNameMangler::mangleLocalName(const Decl *D) {
-+void CXXNameMangler::mangleLocalName(const Decl *D,
-+ const AbiTagList *AdditionalAbiTags,
-+ bool ExcludeUnqualifiedName) {
- // <local-name> := Z <function encoding> E <entity name> [<discriminator>]
- // := Z <function encoding> E s [<discriminator>]
- // <local-name> := Z <function encoding> E d [ <parameter number> ]
-@@ -1149,15 +1392,26 @@
-
- Out << 'Z';
-
-- if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(DC))
-- mangleObjCMethodName(MD);
-- else if (const BlockDecl *BD = dyn_cast<BlockDecl>(DC))
-- mangleBlockForPrefix(BD);
-- else
-- mangleFunctionEncoding(cast<FunctionDecl>(DC));
-+ {
-+ AbiTagState LocalAbiTags(AbiTags);
-+
-+ if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(DC))
-+ mangleObjCMethodName(MD);
-+ else if (const BlockDecl *BD = dyn_cast<BlockDecl>(DC))
-+ mangleBlockForPrefix(BD);
-+ else
-+ mangleFunctionEncoding(cast<FunctionDecl>(DC));
-+
-+ // Implicit ABI tags (from namespace) are not available in the following
-+ // entity; reset to actually emitted tags, which are available.
-+ LocalAbiTags.setUsedAbiTags(LocalAbiTags.getEmittedAbiTags());
-+ }
-
- Out << 'E';
-
-+ // GCC 5.3.0 doesn't emit derived ABI tags for local names but that seems to
-+ // be a bug that is fixed in trunk.
-+
- if (RD) {
- // The parameter number is omitted for the last parameter, 0 for the
- // second-to-last parameter, 1 for the third-to-last parameter, etc. The
-@@ -1182,13 +1436,17 @@
- // Mangle the name relative to the closest enclosing function.
- // equality ok because RD derived from ND above
- if (D == RD) {
-- mangleUnqualifiedName(RD);
-+ if (!ExcludeUnqualifiedName)
-+ mangleUnqualifiedName(RD, AdditionalAbiTags);
- } else if (const BlockDecl *BD = dyn_cast<BlockDecl>(D)) {
- manglePrefix(getEffectiveDeclContext(BD), true /*NoFunction*/);
-- mangleUnqualifiedBlock(BD);
-+ assert(!AdditionalAbiTags && "Block cannot have additional abi tags");
-+ if (!ExcludeUnqualifiedName)
-+ mangleUnqualifiedBlock(BD);
- } else {
- const NamedDecl *ND = cast<NamedDecl>(D);
-- mangleNestedName(ND, getEffectiveDeclContext(ND), true /*NoFunction*/);
-+ mangleNestedName(ND, getEffectiveDeclContext(ND), AdditionalAbiTags,
-+ true /*NoFunction*/, ExcludeUnqualifiedName);
- }
- } else if (const BlockDecl *BD = dyn_cast<BlockDecl>(D)) {
- // Mangle a block in a default parameter; see above explanation for
-@@ -1205,30 +1463,37 @@
- }
- }
-
-- mangleUnqualifiedBlock(BD);
-+ assert(!AdditionalAbiTags && "Block cannot have additional abi tags");
-+ if (!ExcludeUnqualifiedName)
-+ mangleUnqualifiedBlock(BD);
- } else {
-- mangleUnqualifiedName(cast<NamedDecl>(D));
-+ if (!ExcludeUnqualifiedName)
-+ mangleUnqualifiedName(cast<NamedDecl>(D), AdditionalAbiTags);
- }
-
-- if (const NamedDecl *ND = dyn_cast<NamedDecl>(RD ? RD : D)) {
-- unsigned disc;
-- if (Context.getNextDiscriminator(ND, disc)) {
-- if (disc < 10)
-- Out << '_' << disc;
-- else
-- Out << "__" << disc << '_';
-+ if (!ExcludeUnqualifiedName) {
-+ if (const NamedDecl *ND = dyn_cast<NamedDecl>(RD ? RD : D)) {
-+ unsigned disc;
-+ if (Context.getNextDiscriminator(ND, disc)) {
-+ if (disc < 10)
-+ Out << '_' << disc;
-+ else
-+ Out << "__" << disc << '_';
-+ }
- }
- }
- }
-
- void CXXNameMangler::mangleBlockForPrefix(const BlockDecl *Block) {
- if (GetLocalClassDecl(Block)) {
-- mangleLocalName(Block);
-+ mangleLocalName(Block, /* AdditionalAbiTags */ nullptr,
-+ /* ExcludeUnqualifiedName */ false);
- return;
- }
- const DeclContext *DC = getEffectiveDeclContext(Block);
- if (isLocalContainerContext(DC)) {
-- mangleLocalName(Block);
-+ mangleLocalName(Block, /* AdditionalAbiTags */ nullptr,
-+ /* ExcludeUnqualifiedName */ false);
- return;
- }
- manglePrefix(getEffectiveDeclContext(Block));
-@@ -1239,10 +1504,11 @@
- if (Decl *Context = Block->getBlockManglingContextDecl()) {
- if ((isa<VarDecl>(Context) || isa<FieldDecl>(Context)) &&
- Context->getDeclContext()->isRecord()) {
-- if (const IdentifierInfo *Name
-- = cast<NamedDecl>(Context)->getIdentifier()) {
-+ const auto *ND = cast<NamedDecl>(Context);
-+ if (const IdentifierInfo *Name = ND->getIdentifier()) {
- mangleSourceName(Name);
-- Out << 'M';
-+ writeAbiTags(ND, /* AdditionalAbiTags */ nullptr);
-+ Out << 'M';
- }
- }
- }
-@@ -1275,7 +1541,7 @@
- if (const IdentifierInfo *Name
- = cast<NamedDecl>(Context)->getIdentifier()) {
- mangleSourceName(Name);
-- Out << 'M';
-+ Out << 'M';
- }
- }
- }
-@@ -1358,11 +1624,11 @@
- // Check if we have a template.
- const TemplateArgumentList *TemplateArgs = nullptr;
- if (const TemplateDecl *TD = isTemplate(ND, TemplateArgs)) {
-- mangleTemplatePrefix(TD);
-+ mangleTemplatePrefix(TD, /* AdditionalAbiTags */ nullptr);
- mangleTemplateArgs(*TemplateArgs);
- } else {
- manglePrefix(getEffectiveDeclContext(ND), NoFunction);
-- mangleUnqualifiedName(ND);
-+ mangleUnqualifiedName(ND, /* AdditionalAbiTags */ nullptr);
- }
-
- addSubstitution(ND);
-@@ -1373,27 +1639,30 @@
- // ::= <template-param>
- // ::= <substitution>
- if (TemplateDecl *TD = Template.getAsTemplateDecl())
-- return mangleTemplatePrefix(TD);
-+ return mangleTemplatePrefix(TD, /* AdditionalAbiTags */ nullptr);
-
- if (QualifiedTemplateName *Qualified = Template.getAsQualifiedTemplateName())
- manglePrefix(Qualified->getQualifier());
--
-+
- if (OverloadedTemplateStorage *Overloaded
- = Template.getAsOverloadedTemplate()) {
- mangleUnqualifiedName(nullptr, (*Overloaded->begin())->getDeclName(),
-- UnknownArity);
-+ UnknownArity,
-+ /* AdditionalAbiTags */ nullptr);
- return;
- }
--
-+
- DependentTemplateName *Dependent = Template.getAsDependentTemplateName();
- assert(Dependent && "Unknown template name kind?");
- if (NestedNameSpecifier *Qualifier = Dependent->getQualifier())
- manglePrefix(Qualifier);
-- mangleUnscopedTemplateName(Template);
-+ mangleUnscopedTemplateName(Template, /* AdditionalAbiTags */ nullptr);
- }
-
- void CXXNameMangler::mangleTemplatePrefix(const TemplateDecl *ND,
-- bool NoFunction) {
-+ const AbiTagList *AdditionalAbiTags,
-+ bool NoFunction,
-+ bool ExcludeUnqualifiedName) {
- // <template-prefix> ::= <prefix> <template unqualified-name>
- // ::= <template-param>
- // ::= <substitution>
-@@ -1408,7 +1677,8 @@
- mangleTemplateParameter(TTP->getIndex());
- } else {
- manglePrefix(getEffectiveDeclContext(ND), NoFunction);
-- mangleUnqualifiedName(ND->getTemplatedDecl());
-+ if (!ExcludeUnqualifiedName)
-+ mangleUnqualifiedName(ND->getTemplatedDecl(), AdditionalAbiTags);
- }
-
- addSubstitution(ND);
-@@ -1452,6 +1722,7 @@
- // <name> ::= <nested-name>
- mangleUnresolvedPrefix(Dependent->getQualifier());
- mangleSourceName(Dependent->getIdentifier());
-+ // writeAbiTags(Dependent);
- break;
- }
-
-@@ -1544,16 +1815,19 @@
-
- case Type::Typedef:
- mangleSourceName(cast<TypedefType>(Ty)->getDecl()->getIdentifier());
-+ writeAbiTags(cast<TypedefType>(Ty)->getDecl());
- break;
-
- case Type::UnresolvedUsing:
- mangleSourceName(
- cast<UnresolvedUsingType>(Ty)->getDecl()->getIdentifier());
-+ writeAbiTags(cast<UnresolvedUsingType>(Ty)->getDecl());
- break;
-
- case Type::Enum:
- case Type::Record:
- mangleSourceName(cast<TagType>(Ty)->getDecl()->getIdentifier());
-+ writeAbiTags(cast<TagType>(Ty)->getDecl());
- break;
-
- case Type::TemplateSpecialization: {
-@@ -1572,6 +1846,7 @@
- goto unresolvedType;
-
- mangleSourceName(TD->getIdentifier());
-+ writeAbiTags(TD);
- break;
- }
-
-@@ -1603,16 +1878,19 @@
- case Type::InjectedClassName:
- mangleSourceName(
- cast<InjectedClassNameType>(Ty)->getDecl()->getIdentifier());
-+ writeAbiTags(cast<InjectedClassNameType>(Ty)->getDecl());
- break;
-
- case Type::DependentName:
- mangleSourceName(cast<DependentNameType>(Ty)->getIdentifier());
-+ // writeAbiTags(cast<DependentNameType>(Ty));
- break;
-
- case Type::DependentTemplateSpecialization: {
- const DependentTemplateSpecializationType *DTST =
- cast<DependentTemplateSpecializationType>(Ty);
- mangleSourceName(DTST->getIdentifier());
-+ // writeAbiTags(DTST);
- mangleTemplateArgs(DTST->getArgs(), DTST->getNumArgs());
- break;
- }
-@@ -2070,7 +2348,9 @@
- case BuiltinType::Id:
- #include "clang/AST/BuiltinTypes.def"
- case BuiltinType::Dependent:
-- llvm_unreachable("mangling a placeholder type");
-+ if (!NullOut)
-+ llvm_unreachable("mangling a placeholder type");
-+ break;
- case BuiltinType::ObjCId:
- Out << "11objc_object";
- break;
-@@ -2546,7 +2826,11 @@
-
- void CXXNameMangler::mangleType(const TemplateSpecializationType *T) {
- if (TemplateDecl *TD = T->getTemplateName().getAsTemplateDecl()) {
-- mangleName(TD, T->getArgs(), T->getNumArgs());
-+ // types only have explicit abi tags, no addition tags
-+ mangleTemplateName(TD,
-+ /* AdditionalAbiTags */ nullptr,
-+ /* ExcludeUnqualifiedName */ false,
-+ T->getArgs(), T->getNumArgs());
- } else {
- if (mangleSubstitution(QualType(T, 0)))
- return;
-@@ -2872,12 +3156,14 @@
- case Expr::PseudoObjectExprClass:
- case Expr::AtomicExprClass:
- {
-- // As bad as this diagnostic is, it's better than crashing.
-- DiagnosticsEngine &Diags = Context.getDiags();
-- unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
-- "cannot yet mangle expression type %0");
-- Diags.Report(E->getExprLoc(), DiagID)
-- << E->getStmtClassName() << E->getSourceRange();
-+ if (!NullOut) {
-+ // As bad as this diagnostic is, it's better than crashing.
-+ DiagnosticsEngine &Diags = Context.getDiags();
-+ unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
-+ "cannot yet mangle expression type %0");
-+ Diags.Report(E->getExprLoc(), DiagID)
-+ << E->getStmtClassName() << E->getSourceRange();
-+ }
- break;
- }
-
-@@ -4020,6 +4306,97 @@
- Substitutions[Ptr] = SeqID++;
- }
-
-+CXXNameMangler::AbiTagSet
-+CXXNameMangler::getTagsFromPrefixAndTemplateArguments(const NamedDecl *ND) {
-+ llvm::raw_null_ostream NullOutStream;
-+ CXXNameMangler TrackPrefixAndTemplateArguments(*this, NullOutStream);
-+
-+ if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {
-+ TrackPrefixAndTemplateArguments.mangleFunctionEncoding(
-+ FD, /* ExcludeUnqualifiedName */ true);
-+ } else {
-+ TrackPrefixAndTemplateArguments.mangleName(
-+ ND, /* ExcludeUnqualifiedName */ true);
-+ }
-+
-+ return std::move(
-+ TrackPrefixAndTemplateArguments.AbiTagsRoot.getUsedAbiTags());
-+}
-+
-+CXXNameMangler::AbiTagList
-+CXXNameMangler::makeAdditionalTagsForFunction(const FunctionDecl *FD) {
-+ // when derived abi tags are disabled there is no need to make any list
-+ if (DisableDerivedAbiTags)
-+ return AbiTagList();
-+
-+ AbiTagSet ImplicitlyAvailableTags =
-+ getTagsFromPrefixAndTemplateArguments(FD);
-+ AbiTagSet ReturnTypeTags;
-+
-+ {
-+ llvm::raw_null_ostream NullOutStream;
-+ CXXNameMangler TrackReturnTypeTags(*this, NullOutStream);
-+ TrackReturnTypeTags.disableDerivedAbiTags();
-+
-+ const FunctionProtoType *Proto =
-+ cast<FunctionProtoType>(FD->getType()->getAs<FunctionType>());
-+ TrackReturnTypeTags.FunctionTypeDepth.enterResultType();
-+ TrackReturnTypeTags.mangleType(Proto->getReturnType());
-+ TrackReturnTypeTags.FunctionTypeDepth.leaveResultType();
-+
-+ ReturnTypeTags =
-+ std::move(TrackReturnTypeTags.AbiTagsRoot.getUsedAbiTags());
-+ }
-+
-+ AbiTagList AdditionalAbiTags;
-+
-+ for (const auto &Tag : ReturnTypeTags) {
-+ if (ImplicitlyAvailableTags.count(Tag) == 0)
-+ AdditionalAbiTags.push_back(Tag);
-+ }
-+
-+ return AdditionalAbiTags;
-+}
-+
-+CXXNameMangler::AbiTagList
-+CXXNameMangler::makeAdditionalTagsForVariable(const VarDecl *VD) {
-+ // when derived abi tags are disabled there is no need to make any list
-+ if (DisableDerivedAbiTags)
-+ return AbiTagList();
-+
-+ AbiTagSet ImplicitlyAvailableTags =
-+ getTagsFromPrefixAndTemplateArguments(VD);
-+ AbiTagSet VariableTypeTags;
-+
-+ {
-+ llvm::raw_null_ostream NullOutStream;
-+ CXXNameMangler TrackVariableType(*this, NullOutStream);
-+ TrackVariableType.disableDerivedAbiTags();
-+
-+ TrackVariableType.mangleType(VD->getType());
-+
-+ VariableTypeTags =
-+ std::move(TrackVariableType.AbiTagsRoot.getUsedAbiTags());
-+ }
-+
-+ AbiTagList AdditionalAbiTags;
-+
-+ for (const auto &Tag : VariableTypeTags) {
-+ if (ImplicitlyAvailableTags.count(Tag) == 0)
-+ AdditionalAbiTags.push_back(Tag);
-+ }
-+
-+ return AdditionalAbiTags;
-+}
-+
-+bool CXXNameMangler::shouldHaveAbiTags(ItaniumMangleContextImpl &C,
-+ const VarDecl *VD) {
-+ llvm::raw_null_ostream NullOutStream;
-+ CXXNameMangler TrackAbiTags(C, NullOutStream, nullptr, true);
-+ TrackAbiTags.mangle(VD);
-+ return TrackAbiTags.AbiTagsRoot.getUsedAbiTags().size();
-+}
-+
- //
-
- /// Mangles the name of the declaration D and emits that name to the given
-@@ -4121,6 +4498,8 @@
- // <special-name> ::= GV <object name> # Guard variable for one-time
- // # initialization
- CXXNameMangler Mangler(*this, Out);
-+ // GCC 5.3.0 doesn't emit derived ABI tags for local names but that seems to
-+ // be a bug that is fixed in trunk.
- Mangler.getStream() << "_ZGV";
- Mangler.mangleName(D);
- }
-diff -Nuar llvm-3.8.0.src.orig/tools/clang/lib/Sema/SemaDeclAttr.cpp llvm-3.8.0.src/tools/clang/lib/Sema/SemaDeclAttr.cpp
---- llvm-3.8.0.src.orig/tools/clang/lib/Sema/SemaDeclAttr.cpp 2016-07-10 23:56:02.412319038 +0200
-+++ llvm-3.8.0.src/tools/clang/lib/Sema/SemaDeclAttr.cpp 2016-07-10 23:59:08.413719568 +0200
-@@ -4476,10 +4476,6 @@
- D->addAttr(::new (S.Context)
- AbiTagAttr(Attr.getRange(), S.Context, Tags.data(), Tags.size(),
- Attr.getAttributeSpellingListIndex()));
--
-- // FIXME: remove this warning as soon as mangled part is ready.
-- S.Diag(Attr.getRange().getBegin(), diag::warn_attribute_ignored)
-- << Attr.getName();
- }
-
- static void handleARMInterruptAttr(Sema &S, Decl *D,
-diff -Nuar llvm-3.8.0.src.orig/tools/clang/test/CodeGenCXX/mangle-abi-tag.cpp llvm-3.8.0.src/tools/clang/test/CodeGenCXX/mangle-abi-tag.cpp
---- llvm-3.8.0.src.orig/tools/clang/test/CodeGenCXX/mangle-abi-tag.cpp 1970-01-01 01:00:00.000000000 +0100
-+++ llvm-3.8.0.src/tools/clang/test/CodeGenCXX/mangle-abi-tag.cpp 2016-07-10 23:59:08.413719568 +0200
-@@ -0,0 +1,146 @@
-+// RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -std=c++11 -o - | FileCheck %s
-+// RUN: %clang_cc1 %s -emit-llvm -triple i686-linux-gnu -std=c++11 -o - | FileCheck %s
-+// RUN: %clang_cc1 %s -emit-llvm -triple x86_64-linux-gnu -std=c++11 -o - | FileCheck %s
-+
-+struct __attribute__((abi_tag("A", "B"))) A { };
-+
-+struct B: A { };
-+
-+template<class T>
-+
-+struct C {
-+};
-+
-+struct D { A* p; };
-+
-+template<class T>
-+struct __attribute__((abi_tag("C", "D"))) E {
-+};
-+
-+struct __attribute__((abi_tag("A", "B"))) F { };
-+
-+A a1;
-+// CHECK: @_Z2a1B1AB1B =
-+
-+__attribute__((abi_tag("C", "D")))
-+A a2;
-+// CHECK: @_Z2a2B1AB1BB1CB1D =
-+
-+B a3;
-+// CHECK: @a3 =
-+
-+C<A> a4;
-+// CHECK: @_Z2a4B1AB1B =
-+
-+D a5;
-+// CHECK: @a5 =
-+
-+E<int> a6;
-+// CHECK: @_Z2a6B1CB1D =
-+
-+E<A> a7;
-+// CHECK: @_Z2a7B1AB1BB1CB1D =
-+
-+template<>
-+struct E<float> {
-+ static float a8;
-+};
-+float E<float>::a8;
-+// CHECK: @_ZN1EB1CB1DIfE2a8E =
-+
-+template<>
-+struct E<F> {
-+ static bool a9;
-+};
-+bool E<F>::a9;
-+// CHECK: @_ZN1EB1CB1DI1FB1AB1BE2a9E =
-+
-+struct __attribute__((abi_tag("A", "B"))) A10 {
-+ virtual ~A10() {}
-+} a10;
-+// vtable
-+// CHECK: @_ZTV3A10B1AB1B =
-+// typeinfo
-+// CHECK: @_ZTI3A10B1AB1B =
-+
-+// Local variables from f13.
-+// f13()::L::foo[abi:C][abi:D]()::a[abi:A][abi:B]
-+// CHECK-DAG: @_ZZZ3f13vEN1L3fooB1CB1DEvE1aB1AB1B =
-+// guard variable for f13()::L::foo[abi:C][abi:D]()::a[abi:A][abi:B]
-+// CHECK-DAG: @_ZGVZZ3f13vEN1L3fooB1CB1DEvE1aB1AB1B =
-+
-+__attribute__ ((abi_tag("C", "D")))
-+void* f1() {
-+ return 0;
-+}
-+// CHECK: define {{.*}} @_Z2f1B1CB1Dv(
-+
-+__attribute__ ((abi_tag("C", "D")))
-+A* f2() {
-+ return 0;
-+}
-+// CHECK: define {{.*}} @_Z2f2B1AB1BB1CB1Dv(
-+
-+B* f3() {
-+ return 0;
-+}
-+// CHECK: define {{.*}} @_Z2f3v(
-+
-+C<A>* f4() {
-+ return 0;
-+}
-+// CHECK: define {{.*}} @_Z2f4B1AB1Bv(
-+
-+D* f5() {
-+ return 0;
-+}
-+// CHECK: define {{.*}} @_Z2f5v(
-+
-+E<char>* f6() {
-+ return 0;
-+}
-+// CHECK: define {{.*}} @_Z2f6B1CB1Dv(
-+
-+E<A>* f7() {
-+ return 0;
-+}
-+// CHECK: define {{.*}} @_Z2f7B1AB1BB1CB1Dv(
-+
-+void f8(E<A>*) {
-+}
-+// CHECK: define {{.*}} @_Z2f8P1EB1CB1DI1AB1AB1BE(
-+
-+inline namespace Names1 __attribute__((__abi_tag__)) {
-+ class C1 {};
-+}
-+C1 f9() { return C1(); }
-+// CHECK: @_Z2f9B6Names1v(
-+
-+inline namespace Names2 __attribute__((__abi_tag__("Tag1", "Tag2"))) {
-+ class C2 {};
-+}
-+C2 f10() { return C2(); }
-+// CHECK: @_Z3f10B4Tag1B4Tag2v(
-+
-+void __attribute__((abi_tag("A"))) f11(A) {}
-+// f11[abi:A](A[abi:A][abi:B])
-+// CHECK: define {{.*}} @_Z3f11B1A1AB1AB1B(
-+
-+A f12(A) { return A(); }
-+// f12(A[abi:A][abi:B])
-+// CHECK: define {{.*}} @_Z3f121AB1AB1B(
-+
-+inline void f13() {
-+ struct L {
-+ static E<int>* foo() {
-+ static A10 a;
-+ return 0;
-+ }
-+ };
-+ L::foo();
-+}
-+void f11_test() {
-+ f13();
-+}
-+// f13()::L::foo[abi:C][abi:D]()
-+// CHECK: define linkonce_odr %struct.E* @_ZZ3f13vEN1L3fooB1CB1DEv(
-diff -Nuar llvm-3.8.0.src.orig/tools/clang/test/SemaCXX/attr-abi-tag-syntax.cpp llvm-3.8.0.src/tools/clang/test/SemaCXX/attr-abi-tag-syntax.cpp
---- llvm-3.8.0.src.orig/tools/clang/test/SemaCXX/attr-abi-tag-syntax.cpp 2016-07-10 23:56:02.415319061 +0200
-+++ llvm-3.8.0.src/tools/clang/test/SemaCXX/attr-abi-tag-syntax.cpp 2016-07-10 23:59:08.413719568 +0200
-@@ -16,28 +16,18 @@
- // expected-warning@-1 {{'abi_tag' attribute on anonymous namespace ignored}}
-
- inline namespace N __attribute__((__abi_tag__)) {}
--// FIXME: remove this warning as soon as attribute fully supported.
--// expected-warning@-2 {{'__abi_tag__' attribute ignored}}
-
- } // namespcace N2
-
- __attribute__((abi_tag("B", "A"))) extern int a1;
--// FIXME: remove this warning as soon as attribute fully supported.
--// expected-warning@-2 {{'abi_tag' attribute ignored}}
-
- __attribute__((abi_tag("A", "B"))) extern int a1;
- // expected-note@-1 {{previous declaration is here}}
--// FIXME: remove this warning as soon as attribute fully supported.
--// expected-warning@-3 {{'abi_tag' attribute ignored}}
-
- __attribute__((abi_tag("A", "C"))) extern int a1;
- // expected-error@-1 {{'abi_tag' C missing in original declaration}}
--// FIXME: remove this warning as soon as attribute fully supported.
--// expected-warning@-3 {{'abi_tag' attribute ignored}}
-
- extern int a2;
- // expected-note@-1 {{previous declaration is here}}
- __attribute__((abi_tag("A")))extern int a2;
- // expected-error@-1 {{cannot add 'abi_tag' attribute in a redeclaration}}
--// FIXME: remove this warning as soon as attribute fully supported.
--// expected-warning@-3 {{'abi_tag' attribute ignored}}
diff --git a/sys-devel/llvm/files/3.8.1/clang/abi-tag-support-sema.patch b/sys-devel/llvm/files/3.8.1/clang/abi-tag-support-sema.patch
deleted file mode 100644
index 079f685ff337..000000000000
--- a/sys-devel/llvm/files/3.8.1/clang/abi-tag-support-sema.patch
+++ /dev/null
@@ -1,419 +0,0 @@
-diff -Nuar llvm-3.8.0.src.orig/clang/docs/ItaniumMangleAbiTags.rst llvm-3.8.0.src/clang/docs/ItaniumMangleAbiTags.rst
---- llvm-3.8.0.src.orig/clang/docs/ItaniumMangleAbiTags.rst 1970-01-01 01:00:00.000000000 +0100
-+++ llvm-3.8.0.src/clang/docs/ItaniumMangleAbiTags.rst 2016-07-10 23:54:47.768756996 +0200
-@@ -0,0 +1,101 @@
-+========
-+ABI tags
-+========
-+
-+Introduction
-+============
-+
-+This text tries to describe gcc semantic for mangling "abi_tag" attributes
-+described in https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html
-+
-+There is no guarantee the following rules are correct, complete or make sense
-+in any way as they were determined empirically by experiments with gcc5.
-+
-+Declaration
-+===========
-+
-+ABI tags are declared in an abi_tag attribute and can be applied to a
-+function, variable, class or inline namespace declaration. The attribute takes
-+one or more strings (called tags); the order does not matter.
-+
-+See https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html for
-+details.
-+
-+Tags on an inline namespace are called "implicit tags", all other tags are
-+"explicit tags".
-+
-+Mangling
-+========
-+
-+All tags that are "active" on an <unqualified-name> are emitted after the
-+<unqualified-name>, before <template-args> or <discriminator>, and are part of
-+the same <substitution> the <unqualified-name> is.
-+
-+They are mangled as:
-+
-+ <abi-tags> ::= <abi-tag>* # sort by name
-+ <abi-tag> ::= B <tag source-name>
-+
-+Example:
-+
-+ __attribute__((abi_tag("test")))
-+ void Func();
-+
-+ gets mangled as: _Z4FuncB4testv (prettified as `Func[abi:test]()`)
-+
-+Active tags
-+===========
-+
-+A namespace does not have any active tags. For types (class / struct / union /
-+enum), the explicit tags are the active tags.
-+
-+For variables and functions, the active tags are the explicit tags plus any
-+"required tags" which are not in the "available tags" set:
-+
-+ derived-tags := (required-tags - available-tags)
-+ active-tags := explicit-tags + derived-tags
-+
-+Required tags for a function
-+============================
-+
-+If a function is used as a local scope for another name, and is part of
-+another function as local scope, it doesn't have any required tags.
-+
-+If a function is used as a local scope for a guard variable name, it doesn't
-+have any required tags.
-+
-+Otherwise the function requires any implicit or explicit tag used in the name
-+for the return type.
-+
-+Example:
-+ namespace A {
-+ inline namespace B __attribute__((abi_tag)) {
-+ struct C { int x; };
-+ }
-+ }
-+
-+ A::C foo();
-+
-+ gets mangled as: _Z3fooB1Bv (prettified as `foo[abi:B]()`)
-+
-+Required tags for a variable
-+============================
-+
-+A variable requires any implicit or explicit tag used in its type.
-+
-+Available tags
-+==============
-+
-+All tags used in the prefix and in the template arguments for a name are
-+available. Also, for functions, all tags from the <bare-function-type>
-+(which might include the return type for template functions) are available.
-+
-+For <local-name>s all active tags used in the local part (<function-
-+encoding>) are available, but not implicit tags which were not active.
-+
-+Implicit and explicit tags used in the <unqualified-name> for a function (as
-+in the type of a cast operator) are NOT available.
-+
-+Example: a cast operator to std::string (which is
-+std::__cxx11::basic_string<...>) will use 'cxx11' as an active tag, as it is
-+required from the return type `std::string` but not available.
-diff -Nuar llvm-3.8.0.src.orig/tools/clang/docs/ItaniumMangleAbiTags.rst llvm-3.8.0.src/tools/clang/docs/ItaniumMangleAbiTags.rst
---- llvm-3.8.0.src.orig/tools/clang/docs/ItaniumMangleAbiTags.rst 1970-01-01 01:00:00.000000000 +0100
-+++ llvm-3.8.0.src/tools/clang/docs/ItaniumMangleAbiTags.rst 2016-07-10 23:55:02.544868256 +0200
-@@ -0,0 +1,101 @@
-+========
-+ABI tags
-+========
-+
-+Introduction
-+============
-+
-+This text tries to describe gcc semantic for mangling "abi_tag" attributes
-+described in https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html
-+
-+There is no guarantee the following rules are correct, complete or make sense
-+in any way as they were determined empirically by experiments with gcc5.
-+
-+Declaration
-+===========
-+
-+ABI tags are declared in an abi_tag attribute and can be applied to a
-+function, variable, class or inline namespace declaration. The attribute takes
-+one or more strings (called tags); the order does not matter.
-+
-+See https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html for
-+details.
-+
-+Tags on an inline namespace are called "implicit tags", all other tags are
-+"explicit tags".
-+
-+Mangling
-+========
-+
-+All tags that are "active" on an <unqualified-name> are emitted after the
-+<unqualified-name>, before <template-args> or <discriminator>, and are part of
-+the same <substitution> the <unqualified-name> is.
-+
-+They are mangled as:
-+
-+ <abi-tags> ::= <abi-tag>* # sort by name
-+ <abi-tag> ::= B <tag source-name>
-+
-+Example:
-+
-+ __attribute__((abi_tag("test")))
-+ void Func();
-+
-+ gets mangled as: _Z4FuncB4testv (prettified as `Func[abi:test]()`)
-+
-+Active tags
-+===========
-+
-+A namespace does not have any active tags. For types (class / struct / union /
-+enum), the explicit tags are the active tags.
-+
-+For variables and functions, the active tags are the explicit tags plus any
-+"required tags" which are not in the "available tags" set:
-+
-+ derived-tags := (required-tags - available-tags)
-+ active-tags := explicit-tags + derived-tags
-+
-+Required tags for a function
-+============================
-+
-+If a function is used as a local scope for another name, and is part of
-+another function as local scope, it doesn't have any required tags.
-+
-+If a function is used as a local scope for a guard variable name, it doesn't
-+have any required tags.
-+
-+Otherwise the function requires any implicit or explicit tag used in the name
-+for the return type.
-+
-+Example:
-+ namespace A {
-+ inline namespace B __attribute__((abi_tag)) {
-+ struct C { int x; };
-+ }
-+ }
-+
-+ A::C foo();
-+
-+ gets mangled as: _Z3fooB1Bv (prettified as `foo[abi:B]()`)
-+
-+Required tags for a variable
-+============================
-+
-+A variable requires any implicit or explicit tag used in its type.
-+
-+Available tags
-+==============
-+
-+All tags used in the prefix and in the template arguments for a name are
-+available. Also, for functions, all tags from the <bare-function-type>
-+(which might include the return type for template functions) are available.
-+
-+For <local-name>s all active tags used in the local part (<function-
-+encoding>) are available, but not implicit tags which were not active.
-+
-+Implicit and explicit tags used in the <unqualified-name> for a function (as
-+in the type of a cast operator) are NOT available.
-+
-+Example: a cast operator to std::string (which is
-+std::__cxx11::basic_string<...>) will use 'cxx11' as an active tag, as it is
-+required from the return type `std::string` but not available.
-diff -Nuar llvm-3.8.0.src.orig/tools/clang/include/clang/Basic/AttrDocs.td llvm-3.8.0.src/tools/clang/include/clang/Basic/AttrDocs.td
---- llvm-3.8.0.src.orig/tools/clang/include/clang/Basic/AttrDocs.td 2015-12-02 22:58:08.000000000 +0100
-+++ llvm-3.8.0.src/tools/clang/include/clang/Basic/AttrDocs.td 2016-07-10 23:55:02.545868263 +0200
-@@ -1859,3 +1859,16 @@
-
- }];
- }
-+
-+def AbiTagsDocs : Documentation {
-+ let Content = [{
-+The ``abi_tag`` attribute can be applied to a function, variable, class or
-+inline namespace declaration to modify the mangled name of the entity. It gives
-+the ability to distinguish between different versions of the same entity but
-+with different ABI versions supported. For example, a newer version of a class
-+could have a different set of data members and thus have a different size. Using
-+the ``abi_tag`` attribute, it is possible to have different mangled names for
-+a global variable of the class type. Therefor, the old code could keep using
-+the old manged name and the new code will use the new mangled name with tags.
-+ }];
-+}
-diff -Nuar llvm-3.8.0.src.orig/tools/clang/include/clang/Basic/Attr.td llvm-3.8.0.src/tools/clang/include/clang/Basic/Attr.td
---- llvm-3.8.0.src.orig/tools/clang/include/clang/Basic/Attr.td 2015-12-02 22:58:08.000000000 +0100
-+++ llvm-3.8.0.src/tools/clang/include/clang/Basic/Attr.td 2016-07-10 23:55:02.544868256 +0200
-@@ -349,6 +349,14 @@
- // Attributes begin here
- //
-
-+def AbiTag : Attr {
-+ let Spellings = [GCC<"abi_tag">];
-+ let Args = [VariadicStringArgument<"Tags">];
-+ let Subjects = SubjectList<[Struct, Var, Function, Namespace], ErrorDiag,
-+ "ExpectedStructClassVariableFunctionOrInlineNamespace">;
-+ let Documentation = [AbiTagsDocs];
-+}
-+
- def AddressSpace : TypeAttr {
- let Spellings = [GNU<"address_space">];
- let Args = [IntArgument<"AddressSpace">];
-diff -Nuar llvm-3.8.0.src.orig/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td llvm-3.8.0.src/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
---- llvm-3.8.0.src.orig/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td 2016-01-09 13:53:17.000000000 +0100
-+++ llvm-3.8.0.src/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td 2016-07-10 23:55:02.547868278 +0200
-@@ -2434,7 +2434,8 @@
- "Objective-C instance methods|init methods of interface or class extension declarations|"
- "variables, functions and classes|Objective-C protocols|"
- "functions and global variables|structs, unions, and typedefs|structs and typedefs|"
-- "interface or protocol declarations|kernel functions|non-K&R-style functions}1">,
-+ "interface or protocol declarations|kernel functions|non-K&R-style functions|"
-+ "structs, classes, variables, functions, and inline namespaces}1">,
- InGroup<IgnoredAttributes>;
- def err_attribute_wrong_decl_type : Error<warn_attribute_wrong_decl_type.Text>;
- def warn_type_attribute_wrong_type : Warning<
-@@ -4144,6 +4145,13 @@
- def err_redefinition_extern_inline : Error<
- "redefinition of a 'extern inline' function %0 is not supported in "
- "%select{C99 mode|C++}1">;
-+def warn_attr_abi_tag_namespace : Warning<
-+ "'abi_tag' attribute on %select{non-inline|anonymous}0 namespace ignored">,
-+ InGroup<IgnoredAttributes>;
-+def err_abi_tag_on_redeclaration : Error<
-+ "cannot add 'abi_tag' attribute in a redeclaration">;
-+def err_new_abi_tag_on_redeclaration : Error<
-+ "'abi_tag' %0 missing in original declaration">;
-
- def note_deleted_dtor_no_operator_delete : Note<
- "virtual destructor requires an unambiguous, accessible 'operator delete'">;
-diff -Nuar llvm-3.8.0.src.orig/tools/clang/include/clang/Sema/AttributeList.h llvm-3.8.0.src/tools/clang/include/clang/Sema/AttributeList.h
---- llvm-3.8.0.src.orig/tools/clang/include/clang/Sema/AttributeList.h 2015-12-02 18:07:30.000000000 +0100
-+++ llvm-3.8.0.src/tools/clang/include/clang/Sema/AttributeList.h 2016-07-10 23:55:02.548868286 +0200
-@@ -855,7 +855,8 @@
- ExpectedStructOrTypedef,
- ExpectedObjectiveCInterfaceOrProtocol,
- ExpectedKernelFunction,
-- ExpectedFunctionWithProtoType
-+ ExpectedFunctionWithProtoType,
-+ ExpectedStructClassVariableFunctionOrInlineNamespace
- };
-
- } // end namespace clang
-diff -Nuar llvm-3.8.0.src.orig/tools/clang/lib/Sema/SemaDeclAttr.cpp llvm-3.8.0.src/tools/clang/lib/Sema/SemaDeclAttr.cpp
---- llvm-3.8.0.src.orig/tools/clang/lib/Sema/SemaDeclAttr.cpp 2016-01-13 02:07:35.000000000 +0100
-+++ llvm-3.8.0.src/tools/clang/lib/Sema/SemaDeclAttr.cpp 2016-07-10 23:55:02.552868316 +0200
-@@ -4446,6 +4446,42 @@
- Attr.getRange(), S.Context, Attr.getAttributeSpellingListIndex()));
- }
-
-+static void handleAbiTagAttr(Sema &S, Decl *D, const AttributeList &Attr) {
-+ SmallVector<std::string, 4> Tags;
-+ for (unsigned I = 0, E = Attr.getNumArgs(); I != E; ++I) {
-+ StringRef Tag;
-+ if (!S.checkStringLiteralArgumentAttr(Attr, I, Tag))
-+ return;
-+ Tags.push_back(Tag);
-+ }
-+
-+ if (const auto *NS = dyn_cast<NamespaceDecl>(D)) {
-+ if (!NS->isInline()) {
-+ S.Diag(Attr.getLoc(), diag::warn_attr_abi_tag_namespace) << 0;
-+ return;
-+ }
-+ if (NS->isAnonymousNamespace()) {
-+ S.Diag(Attr.getLoc(), diag::warn_attr_abi_tag_namespace) << 1;
-+ return;
-+ }
-+ if (Attr.getNumArgs() == 0)
-+ Tags.push_back(NS->getName());
-+ } else if (!checkAttributeAtLeastNumArgs(S, Attr, 1))
-+ return;
-+
-+ // Store tags sorted and without duplicates.
-+ std::sort(Tags.begin(), Tags.end());
-+ Tags.erase(std::unique(Tags.begin(), Tags.end()), Tags.end());
-+
-+ D->addAttr(::new (S.Context)
-+ AbiTagAttr(Attr.getRange(), S.Context, Tags.data(), Tags.size(),
-+ Attr.getAttributeSpellingListIndex()));
-+
-+ // FIXME: remove this warning as soon as mangled part is ready.
-+ S.Diag(Attr.getRange().getBegin(), diag::warn_attribute_ignored)
-+ << Attr.getName();
-+}
-+
- static void handleARMInterruptAttr(Sema &S, Decl *D,
- const AttributeList &Attr) {
- // Check the attribute arguments.
-@@ -5360,6 +5396,9 @@
- case AttributeList::AT_Thread:
- handleDeclspecThreadAttr(S, D, Attr);
- break;
-+ case AttributeList::AT_AbiTag:
-+ handleAbiTagAttr(S, D, Attr);
-+ break;
-
- // Thread safety attributes:
- case AttributeList::AT_AssertExclusiveLock:
-diff -Nuar llvm-3.8.0.src.orig/tools/clang/lib/Sema/SemaDecl.cpp llvm-3.8.0.src/tools/clang/lib/Sema/SemaDecl.cpp
---- llvm-3.8.0.src.orig/tools/clang/lib/Sema/SemaDecl.cpp 2016-01-11 23:41:53.000000000 +0100
-+++ llvm-3.8.0.src/tools/clang/lib/Sema/SemaDecl.cpp 2016-07-10 23:55:02.551868308 +0200
-@@ -2396,6 +2396,24 @@
- }
- }
-
-+ // Re-declaration cannot add abi_tag's.
-+ if (const auto *NewAbiTagAttr = New->getAttr<AbiTagAttr>()) {
-+ if (const auto *OldAbiTagAttr = Old->getAttr<AbiTagAttr>()) {
-+ for (const auto &NewTag : NewAbiTagAttr->tags()) {
-+ if (std::find(OldAbiTagAttr->tags_begin(), OldAbiTagAttr->tags_end(),
-+ NewTag) == OldAbiTagAttr->tags_end()) {
-+ Diag(NewAbiTagAttr->getLocation(),
-+ diag::err_new_abi_tag_on_redeclaration)
-+ << NewTag;
-+ Diag(OldAbiTagAttr->getLocation(), diag::note_previous_declaration);
-+ }
-+ }
-+ } else {
-+ Diag(NewAbiTagAttr->getLocation(), diag::err_abi_tag_on_redeclaration);
-+ Diag(Old->getLocation(), diag::note_previous_declaration);
-+ }
-+ }
-+
- if (!Old->hasAttrs())
- return;
-
-diff -Nuar llvm-3.8.0.src.orig/tools/clang/test/SemaCXX/attr-abi-tag-syntax.cpp llvm-3.8.0.src/tools/clang/test/SemaCXX/attr-abi-tag-syntax.cpp
---- llvm-3.8.0.src.orig/tools/clang/test/SemaCXX/attr-abi-tag-syntax.cpp 1970-01-01 01:00:00.000000000 +0100
-+++ llvm-3.8.0.src/tools/clang/test/SemaCXX/attr-abi-tag-syntax.cpp 2016-07-10 23:55:02.552868316 +0200
-@@ -0,0 +1,43 @@
-+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
-+
-+namespace N1 {
-+
-+namespace __attribute__((__abi_tag__)) {}
-+// expected-warning@-1 {{'abi_tag' attribute on non-inline namespace ignored}}
-+
-+namespace N __attribute__((__abi_tag__)) {}
-+// expected-warning@-1 {{'abi_tag' attribute on non-inline namespace ignored}}
-+
-+} // namespace N1
-+
-+namespace N2 {
-+
-+inline namespace __attribute__((__abi_tag__)) {}
-+// expected-warning@-1 {{'abi_tag' attribute on anonymous namespace ignored}}
-+
-+inline namespace N __attribute__((__abi_tag__)) {}
-+// FIXME: remove this warning as soon as attribute fully supported.
-+// expected-warning@-2 {{'__abi_tag__' attribute ignored}}
-+
-+} // namespcace N2
-+
-+__attribute__((abi_tag("B", "A"))) extern int a1;
-+// FIXME: remove this warning as soon as attribute fully supported.
-+// expected-warning@-2 {{'abi_tag' attribute ignored}}
-+
-+__attribute__((abi_tag("A", "B"))) extern int a1;
-+// expected-note@-1 {{previous declaration is here}}
-+// FIXME: remove this warning as soon as attribute fully supported.
-+// expected-warning@-3 {{'abi_tag' attribute ignored}}
-+
-+__attribute__((abi_tag("A", "C"))) extern int a1;
-+// expected-error@-1 {{'abi_tag' C missing in original declaration}}
-+// FIXME: remove this warning as soon as attribute fully supported.
-+// expected-warning@-3 {{'abi_tag' attribute ignored}}
-+
-+extern int a2;
-+// expected-note@-1 {{previous declaration is here}}
-+__attribute__((abi_tag("A")))extern int a2;
-+// expected-error@-1 {{cannot add 'abi_tag' attribute in a redeclaration}}
-+// FIXME: remove this warning as soon as attribute fully supported.
-+// expected-warning@-3 {{'abi_tag' attribute ignored}}
diff --git a/sys-devel/llvm/files/3.8.1/clang/default-libs.patch b/sys-devel/llvm/files/3.8.1/clang/default-libs.patch
deleted file mode 100644
index 8d172f746895..000000000000
--- a/sys-devel/llvm/files/3.8.1/clang/default-libs.patch
+++ /dev/null
@@ -1,106 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index ad2ac42..18dcfbe 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -196,6 +196,24 @@ set(GCC_INSTALL_PREFIX "" CACHE PATH "Directory where gcc is installed." )
- set(DEFAULT_SYSROOT "" CACHE PATH
- "Default <path> to all compiler invocations for --sysroot=<path>." )
-
-+set(CLANG_DEFAULT_CXX_STDLIB "" CACHE STRING
-+ "Default C++ stdlib to use (libstdc++ or libc++)")
-+if (NOT(CLANG_DEFAULT_CXX_STDLIB STREQUAL "" OR
-+ CLANG_DEFAULT_CXX_STDLIB STREQUAL "libstdc++" OR
-+ CLANG_DEFAULT_CXX_STDLIB STREQUAL "libc++"))
-+ message(WARNING "Resetting default C++ stdlib to use platform default")
-+ set(CLANG_DEFAULT_CXX_STDLIB "")
-+endif()
-+
-+set(CLANG_DEFAULT_RTLIB "" CACHE STRING
-+ "Default runtime library to use (libgcc or compiler-rt)")
-+if (NOT(CLANG_DEFAULT_RTLIB STREQUAL "" OR
-+ CLANG_DEFAULT_RTLIB STREQUAL "libgcc" OR
-+ CLANG_DEFAULT_RTLIB STREQUAL "compiler-rt"))
-+ message(WARNING "Resetting default rtlib to use platform default")
-+ set(CLANG_DEFAULT_RTLIB "")
-+endif()
-+
- set(CLANG_DEFAULT_OPENMP_RUNTIME "libomp" CACHE STRING
- "Default OpenMP runtime used by -fopenmp.")
-
-diff --git a/include/clang/Config/config.h.cmake b/include/clang/Config/config.h.cmake
-index b7486f3..eb8aa27 100644
---- a/include/clang/Config/config.h.cmake
-+++ b/include/clang/Config/config.h.cmake
-@@ -8,6 +8,12 @@
- /* Bug report URL. */
- #define BUG_REPORT_URL "${BUG_REPORT_URL}"
-
-+/* Default C++ stdlib to use. */
-+#define CLANG_DEFAULT_CXX_STDLIB "${CLANG_DEFAULT_CXX_STDLIB}"
-+
-+/* Default runtime library to use. */
-+#define CLANG_DEFAULT_RTLIB "${CLANG_DEFAULT_RTLIB}"
-+
- /* Default OpenMP runtime used by -fopenmp. */
- #define CLANG_DEFAULT_OPENMP_RUNTIME "${CLANG_DEFAULT_OPENMP_RUNTIME}"
-
-diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp
-index cbbd485..3af7f8a 100644
---- a/lib/Driver/ToolChain.cpp
-+++ b/lib/Driver/ToolChain.cpp
-@@ -9,6 +9,7 @@
-
- #include "Tools.h"
- #include "clang/Basic/ObjCRuntime.h"
-+#include "clang/Config/config.h"
- #include "clang/Driver/Action.h"
- #include "clang/Driver/Driver.h"
- #include "clang/Driver/DriverDiagnostic.h"
-@@ -520,29 +521,29 @@ void ToolChain::addProfileRTLibs(const llvm::opt::ArgList &Args,
-
- ToolChain::RuntimeLibType ToolChain::GetRuntimeLibType(
- const ArgList &Args) const {
-- if (Arg *A = Args.getLastArg(options::OPT_rtlib_EQ)) {
-- StringRef Value = A->getValue();
-- if (Value == "compiler-rt")
-- return ToolChain::RLT_CompilerRT;
-- if (Value == "libgcc")
-- return ToolChain::RLT_Libgcc;
-- getDriver().Diag(diag::err_drv_invalid_rtlib_name)
-- << A->getAsString(Args);
-- }
-+ const Arg* A = Args.getLastArg(options::OPT_rtlib_EQ);
-+ StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_RTLIB;
-+
-+ if (LibName == "compiler-rt")
-+ return ToolChain::RLT_CompilerRT;
-+ if (LibName == "libgcc")
-+ return ToolChain::RLT_Libgcc;
-+ if (A)
-+ getDriver().Diag(diag::err_drv_invalid_rtlib_name) << A->getAsString(Args);
-
- return GetDefaultRuntimeLibType();
- }
-
- ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{
-- if (Arg *A = Args.getLastArg(options::OPT_stdlib_EQ)) {
-- StringRef Value = A->getValue();
-- if (Value == "libc++")
-- return ToolChain::CST_Libcxx;
-- if (Value == "libstdc++")
-- return ToolChain::CST_Libstdcxx;
-- getDriver().Diag(diag::err_drv_invalid_stdlib_name)
-- << A->getAsString(Args);
-- }
-+ const Arg* A = Args.getLastArg(options::OPT_stdlib_EQ);
-+ StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_CXX_STDLIB;
-+
-+ if (LibName == "libc++")
-+ return ToolChain::CST_Libcxx;
-+ if (LibName == "libstdc++")
-+ return ToolChain::CST_Libstdcxx;
-+ if (A)
-+ getDriver().Diag(diag::err_drv_invalid_stdlib_name) << A->getAsString(Args);
-
- return ToolChain::CST_Libstdcxx;
- }
diff --git a/sys-devel/llvm/files/3.8.1/clang/gcc4.9-search-path.patch b/sys-devel/llvm/files/3.8.1/clang/gcc4.9-search-path.patch
deleted file mode 100644
index bafe218ceba6..000000000000
--- a/sys-devel/llvm/files/3.8.1/clang/gcc4.9-search-path.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From af4db76e059c1a3f4a7f437001051ccebc8a50fe Mon Sep 17 00:00:00 2001
-From: Chandler Carruth <chandlerc@gmail.com>
-Date: Sun, 8 May 2016 07:59:56 +0000
-Subject: [PATCH] Teach header search about GCC 4.9 header search paths in
- Gentoo, they now use the full GCC version in their weird suffix.
-
-git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268874 91177308-0d34-0410-b5e6-96231b3b80d8
----
- lib/Driver/ToolChains.cpp | 1 +
- .../Inputs/gentoo_linux_gcc_4.9.3_tree/usr/include/.keep | 0
- .../usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/crtbegin.o | 0
- .../x86_64-pc-linux-gnu/4.9.3/include/g++-v4.9.3/.keep | 0
- .../usr/x86_64-pc-linux-gnu/lib/.keep | 0
- test/Driver/linux-header-search.cpp | 15 +++++++++++++++
- 6 files changed, 16 insertions(+)
- create mode 100644 test/Driver/Inputs/gentoo_linux_gcc_4.9.3_tree/usr/include/.keep
- create mode 100644 test/Driver/Inputs/gentoo_linux_gcc_4.9.3_tree/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/crtbegin.o
- create mode 100644 test/Driver/Inputs/gentoo_linux_gcc_4.9.3_tree/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/g++-v4.9.3/.keep
- create mode 100644 test/Driver/Inputs/gentoo_linux_gcc_4.9.3_tree/usr/x86_64-pc-linux-gnu/lib/.keep
-
-diff --git a/tools/clang/lib/Driver/ToolChains.cpp b/tools/clang/lib/Driver/ToolChains.cpp
-index f905b5d..1bf17e4 100644
---- a/tools/clang/lib/Driver/ToolChains.cpp
-+++ b/tools/clang/lib/Driver/ToolChains.cpp
-@@ -4134,6 +4134,7 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
- const std::string LibStdCXXIncludePathCandidates[] = {
- // Gentoo is weird and places its headers inside the GCC install,
- // so if the first attempt to find the headers fails, try these patterns.
-+ InstallDir.str() + "/include/g++-v" + Version.Text,
- InstallDir.str() + "/include/g++-v" + Version.MajorStr + "." +
- Version.MinorStr,
- InstallDir.str() + "/include/g++-v" + Version.MajorStr,
-diff --git a/tools/clang/test/Driver/Inputs/gentoo_linux_gcc_4.9.3_tree/usr/include/.keep b/tools/clang/test/Driver/Inputs/gentoo_linux_gcc_4.9.3_tree/usr/include/.keep
-new file mode 100644
-index 0000000..e69de29
-diff --git a/tools/clang/test/Driver/Inputs/gentoo_linux_gcc_4.9.3_tree/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/crtbegin.o b/tools/clang/test/Driver/Inputs/gentoo_linux_gcc_4.9.3_tree/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/crtbegin.o
-new file mode 100644
-index 0000000..e69de29
-diff --git a/tools/clang/test/Driver/Inputs/gentoo_linux_gcc_4.9.3_tree/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/g++-v4.9.3/.keep b/tools/clang/test/Driver/Inputs/gentoo_linux_gcc_4.9.3_tree/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/g++-v4.9.3/.keep
-new file mode 100644
-index 0000000..e69de29
-diff --git a/tools/clang/test/Driver/Inputs/gentoo_linux_gcc_4.9.3_tree/usr/x86_64-pc-linux-gnu/lib/.keep b/tools/clang/test/Driver/Inputs/gentoo_linux_gcc_4.9.3_tree/usr/x86_64-pc-linux-gnu/lib/.keep
-new file mode 100644
-index 0000000..e69de29
-diff --git a/tools/clang/test/Driver/linux-header-search.cpp b/tools/clang/test/Driver/linux-header-search.cpp
-index 9568bde..5f6ac50 100644
---- a/tools/clang/test/Driver/linux-header-search.cpp
-+++ b/tools/clang/test/Driver/linux-header-search.cpp
-@@ -285,6 +285,21 @@
- // CHECK-GENTOO-4-6-4: "-internal-isystem" "[[RESOURCE_DIR]]{{/|\\\\}}include"
- // CHECK-GENTOO-4-6-4: "-internal-externc-isystem" "[[SYSROOT]]/include"
- // CHECK-GENTOO-4-6-4: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
-+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
-+// RUN: -target x86_64-unknown-linux-gnu -stdlib=libstdc++ \
-+// RUN: --sysroot=%S/Inputs/gentoo_linux_gcc_4.9.3_tree \
-+// RUN: --gcc-toolchain="" \
-+// RUN: | FileCheck --check-prefix=CHECK-GENTOO-4-9-3 %s
-+// CHECK-GENTOO-4-9-3: "{{.*}}clang{{.*}}" "-cc1"
-+// CHECK-GENTOO-4-9-3: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
-+// CHECK-GENTOO-4-9-3: "-isysroot" "[[SYSROOT:[^"]+]]"
-+// CHECK-GENTOO-4-9-3: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/g++-v4.9.3"
-+// CHECK-GENTOO-4-9-3: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/g++-v4.9.3/x86_64-pc-linux-gnu"
-+// CHECK-GENTOO-4-9-3: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/g++-v4.9.3/backward"
-+// CHECK-GENTOO-4-9-3: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
-+// CHECK-GENTOO-4-9-3: "-internal-isystem" "[[RESOURCE_DIR]]{{/|\\\\}}include"
-+// CHECK-GENTOO-4-9-3: "-internal-externc-isystem" "[[SYSROOT]]/include"
-+// CHECK-GENTOO-4-9-3: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
- //
- // Check header search on Debian 6 / MIPS64
- // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
diff --git a/sys-devel/llvm/files/3.8.1/clang/gentoo-runtime-gcc-detection-v3.patch b/sys-devel/llvm/files/3.8.1/clang/gentoo-runtime-gcc-detection-v3.patch
deleted file mode 100644
index 1f81af0b7ff0..000000000000
--- a/sys-devel/llvm/files/3.8.1/clang/gentoo-runtime-gcc-detection-v3.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 916572e1243633ddf913c8f32771a3a7f70fd853 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
-Date: Fri, 5 Sep 2014 16:49:35 +0200
-Subject: [PATCH] Support obtaining active toolchain from gcc-config.
-
----
- tools/clang/lib/Driver/ToolChains.cpp | 19 +++++++++++++++++++
- 1 file changed, 19 insertions(+)
-
-diff --git a/tools/clang/lib/Driver/ToolChains.cpp b/tools/clang/lib/Driver/ToolChains.cpp
-index b46f69d..2d4374d 100644
---- a/tools/clang/lib/Driver/ToolChains.cpp
-+++ b/tools/clang/lib/Driver/ToolChains.cpp
-@@ -1253,6 +1253,25 @@ Generic_GCC::GCCInstallationDetector::init(
- Prefixes.push_back("/usr");
- }
-
-+ for (unsigned k = 0, ke = CandidateTripleAliases.size(); k < ke; ++k) {
-+ llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> File =
-+ llvm::MemoryBuffer::getFile(D.SysRoot + "/etc/env.d/gcc/config-" + CandidateTripleAliases[k].str());
-+ if (File)
-+ {
-+ const std::string VersionText = File.get()->getBuffer().rsplit('-').second.substr(0,5).str();
-+ const std::string GentooPath = D.SysRoot + "/usr/lib/gcc/" + CandidateTripleAliases[k].str() + "/" + VersionText;
-+ if (llvm::sys::fs::exists(GentooPath + "/crtbegin.o"))
-+ {
-+ Version = GCCVersion::Parse(VersionText);
-+ GCCInstallPath = GentooPath;
-+ GCCParentLibPath = GCCInstallPath + "/../../..";
-+ GCCTriple.setTriple(CandidateTripleAliases[k]);
-+ IsValid = true;
-+ return;
-+ }
-+ }
-+ }
-+
- // Loop over the various components which exist and select the best GCC
- // installation available. GCC installs are ranked by version number.
- Version = GCCVersion::Parse("0.0.0");
---
-2.1.0
-
diff --git a/sys-devel/llvm/files/3.8.1/clang/musl-support.patch b/sys-devel/llvm/files/3.8.1/clang/musl-support.patch
deleted file mode 100644
index 8a234e6277ab..000000000000
--- a/sys-devel/llvm/files/3.8.1/clang/musl-support.patch
+++ /dev/null
@@ -1,108 +0,0 @@
-diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
-index 9c6eaff..92872ab 100644
---- a/lib/Basic/Targets.cpp
-+++ b/lib/Basic/Targets.cpp
-@@ -4513,6 +4513,8 @@ public:
- case llvm::Triple::Android:
- case llvm::Triple::GNUEABI:
- case llvm::Triple::GNUEABIHF:
-+ case llvm::Triple::MuslEABI:
-+ case llvm::Triple::MuslEABIHF:
- setABI("aapcs-linux");
- break;
- case llvm::Triple::EABIHF:
-diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp
-index 04edc0c..298b2cc 100644
---- a/lib/CodeGen/TargetInfo.cpp
-+++ b/lib/CodeGen/TargetInfo.cpp
-@@ -4811,6 +4811,8 @@ public:
- case llvm::Triple::EABIHF:
- case llvm::Triple::GNUEABI:
- case llvm::Triple::GNUEABIHF:
-+ case llvm::Triple::MuslEABI:
-+ case llvm::Triple::MuslEABIHF:
- return true;
- default:
- return false;
-@@ -4821,6 +4823,7 @@ public:
- switch (getTarget().getTriple().getEnvironment()) {
- case llvm::Triple::EABIHF:
- case llvm::Triple::GNUEABIHF:
-+ case llvm::Triple::MuslEABIHF:
- return true;
- default:
- return false;
-@@ -7548,7 +7551,8 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() {
- Kind = ARMABIInfo::AAPCS16_VFP;
- else if (CodeGenOpts.FloatABI == "hard" ||
- (CodeGenOpts.FloatABI != "soft" &&
-- Triple.getEnvironment() == llvm::Triple::GNUEABIHF))
-+ (Triple.getEnvironment() == llvm::Triple::GNUEABIHF ||
-+ Triple.getEnvironment() == llvm::Triple::MuslEABIHF)))
- Kind = ARMABIInfo::AAPCS_VFP;
-
- return *(TheTargetCodeGenInfo = new ARMTargetCodeGenInfo(Types, Kind));
-diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
-index b7ac24f..2a529fb 100644
---- a/lib/Driver/Tools.cpp
-+++ b/lib/Driver/Tools.cpp
-@@ -724,13 +724,19 @@ arm::FloatABI arm::getARMFloatABI(const ToolChain &TC, const ArgList &Args) {
- default:
- switch (Triple.getEnvironment()) {
- case llvm::Triple::GNUEABIHF:
-+ case llvm::Triple::MuslEABIHF:
- case llvm::Triple::EABIHF:
- ABI = FloatABI::Hard;
- break;
- case llvm::Triple::GNUEABI:
-+ case llvm::Triple::MuslEABI:
- case llvm::Triple::EABI:
- // EABI is always AAPCS, and if it was not marked 'hard', it's softfp
-- ABI = FloatABI::SoftFP;
-+ //
-+ // Also consider triples like armv7a-hardfloat-linux-eabi, where 'hard'
-+ // is marked in the vender field.
-+ ABI = (Triple.getVendorName() == "hardfloat") ?
-+ FloatABI::Hard : FloatABI::SoftFP;
- break;
- case llvm::Triple::Android:
- ABI = (SubArch == 7) ? FloatABI::SoftFP : FloatABI::Soft;
-@@ -968,6 +974,8 @@ void Clang::AddARMTargetArgs(const llvm::Triple &Triple, const ArgList &Args,
- case llvm::Triple::Android:
- case llvm::Triple::GNUEABI:
- case llvm::Triple::GNUEABIHF:
-+ case llvm::Triple::MuslEABI:
-+ case llvm::Triple::MuslEABIHF:
- ABIName = "aapcs-linux";
- break;
- case llvm::Triple::EABIHF:
-@@ -8632,6 +8640,29 @@ static std::string getLinuxDynamicLinker(const ArgList &Args,
- return "/system/bin/linker64";
- else
- return "/system/bin/linker";
-+ } else if (ToolChain.getTriple().isMusl()) {
-+ std::string ArchName;
-+ bool IsArm = false;
-+ switch (Arch) {
-+ case llvm::Triple::arm:
-+ case llvm::Triple::thumb:
-+ ArchName = "arm";
-+ IsArm = true;
-+ break;
-+ case llvm::Triple::armeb:
-+ case llvm::Triple::thumbeb:
-+ ArchName = "armeb";
-+ IsArm = true;
-+ break;
-+ default:
-+ ArchName = ToolChain.getTriple().getArchName().str();
-+ }
-+ if (IsArm &&
-+ (ToolChain.getTriple().getEnvironment() == llvm::Triple::MuslEABIHF ||
-+ arm::getARMFloatABI(ToolChain, Args) == arm::FloatABI::Hard))
-+ ArchName += "hf";
-+
-+ return "/lib/ld-musl-" + ArchName + ".so.1";
- } else if (Arch == llvm::Triple::x86 || Arch == llvm::Triple::sparc ||
- Arch == llvm::Triple::sparcel)
- return "/lib/ld-linux.so.2";
diff --git a/sys-devel/llvm/files/3.8.1/compiler-rt/0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch b/sys-devel/llvm/files/3.8.1/compiler-rt/0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch
deleted file mode 100644
index 93538009d291..000000000000
--- a/sys-devel/llvm/files/3.8.1/compiler-rt/0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 8bd62a681744d3c31a0837c0f84f99ea4987e017 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
-Date: Tue, 9 Jun 2015 12:17:57 +0200
-Subject: [PATCH] cmake: Install compiler-rt into /usr/lib (without suffix)
-
----
- CMakeLists.txt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 0d8a880..5ae98a9 100644
---- a/projects/compiler-rt/CMakeLists.txt
-+++ b/projects/compiler-rt/CMakeLists.txt
-@@ -52,7 +52,7 @@ if (NOT COMPILER_RT_STANDALONE_BUILD)
- # Setup the paths where compiler-rt runtimes and headers should be stored.
- set(COMPILER_RT_OUTPUT_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION})
- set(COMPILER_RT_EXEC_OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
-- set(COMPILER_RT_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION})
-+ set(COMPILER_RT_INSTALL_PATH lib/clang/${CLANG_VERSION})
- option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests."
- ${LLVM_INCLUDE_TESTS})
- option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered"
---
-2.4.3
-
diff --git a/sys-devel/llvm/files/3.8.1/compiler-rt/arm_march_flags.patch b/sys-devel/llvm/files/3.8.1/compiler-rt/arm_march_flags.patch
deleted file mode 100644
index d82236e85fe9..000000000000
--- a/sys-devel/llvm/files/3.8.1/compiler-rt/arm_march_flags.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-diff -Naur llvm-3.8.0rc1.src.orig/projects/compiler-rt/cmake/config-ix.cmake llvm-3.8.0rc1.src/projects/compiler-rt/cmake/config-ix.cmake
---- llvm-3.8.0rc1.src.orig/projects/compiler-rt/cmake/config-ix.cmake 2016-01-13 17:56:15.000000000 +0100
-+++ llvm-3.8.0rc1.src/projects/compiler-rt/cmake/config-ix.cmake 2016-01-27 19:43:21.265315207 +0100
-@@ -219,13 +219,6 @@
- elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "mips")
- test_target_arch(mips "" "-mips32r2" "--target=mips-linux-gnu")
- test_target_arch(mips64 "" "-mips64r2" "--target=mips64-linux-gnu" "-mabi=n64")
-- elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "arm")
-- test_target_arch(arm "" "-march=armv7-a" "-mfloat-abi=soft")
-- test_target_arch(armhf "" "-march=armv7-a" "-mfloat-abi=hard")
-- elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "aarch32")
-- test_target_arch(aarch32 "" "-march=armv8-a")
-- elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "aarch64")
-- test_target_arch(aarch64 "" "-march=armv8-a")
- elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "wasm32")
- test_target_arch(wasm32 "" "--target=wasm32-unknown-unknown")
- elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "wasm64")
diff --git a/sys-devel/llvm/files/3.8.1/compiler-rt/darwin-default-sysroot.patch b/sys-devel/llvm/files/3.8.1/compiler-rt/darwin-default-sysroot.patch
deleted file mode 100644
index 9122ce9bc79a..000000000000
--- a/sys-devel/llvm/files/3.8.1/compiler-rt/darwin-default-sysroot.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-find_darwin_sdk_dir: fall back to / for sysroot
-
---- a/projects/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
-+++ b/projects/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
-@@ -17,6 +17,9 @@
- ERROR_FILE /dev/null
- )
- endif()
-+ if("" STREQUAL "${var_internal}")
-+ set(var_internal "/")
-+ endif()
- set(${var} ${var_internal} PARENT_SCOPE)
- endfunction()
-
diff --git a/sys-devel/llvm/files/3.8.1/compiler-rt/fbsd.patch b/sys-devel/llvm/files/3.8.1/compiler-rt/fbsd.patch
deleted file mode 100644
index 297620bc775a..000000000000
--- a/sys-devel/llvm/files/3.8.1/compiler-rt/fbsd.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-https://llvm.org/bugs/show_bug.cgi?id=26651
-https://github.com/llvm-mirror/compiler-rt/commit/6606c7b50cbb4ec7eab4ecbebbbaaa049734bbd3
-
-diff --git a/projects/compiler-rt/lib/tsan/CMakeLists.txt b/projects/compiler-rt/lib/tsan/CMakeLists.txt
-index c185cfa..a151c6c 100644
---- a/projects/compiler-rt/lib/tsan/CMakeLists.txt
-+++ b/projects/compiler-rt/lib/tsan/CMakeLists.txt
-@@ -192,7 +192,11 @@ endif()
- add_dependencies(compiler-rt tsan)
-
- # Make sure that non-platform-specific files don't include any system headers.
--if(COMPILER_RT_HAS_SYSROOT_FLAG)
-+# FreeBSD does not install a number of Clang-provided headers for the compiler
-+# in the base system due to incompatibilities between FreeBSD's and Clang's
-+# versions. As a workaround do not use --sysroot=. on FreeBSD until this is
-+# addressed.
-+if(COMPILER_RT_HAS_SYSROOT_FLAG AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
- file(GLOB _tsan_generic_sources rtl/tsan*)
- file(GLOB _tsan_platform_sources rtl/tsan*posix* rtl/tsan*mac*
- rtl/tsan*linux*)
diff --git a/sys-devel/llvm/files/3.8.1/llvm-config.patch b/sys-devel/llvm/files/3.8.1/llvm-config.patch
deleted file mode 100644
index 3eace43f6ded..000000000000
--- a/sys-devel/llvm/files/3.8.1/llvm-config.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From 5ed05738769643b7c652f798fa6c3aa30c7f0b2b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
-Date: Wed, 2 Dec 2015 16:04:56 +0100
-Subject: [PATCH] llvm-config: Clean up exported values, update for shared
- linking
-
-Gentoo-specific fixup for llvm-config, including:
-- wiping build-specific CFLAGS, CXXFLAGS,
-- updating library suffixes for shared libs,
-- wiping --system-libs for shared linking,
-- banning --obj-root and --src-root due to no sources installed,
-- making --build-mode return "Release" rather than "Gentoo".
-
-Thanks to Steven Newbury for the initial patch.
-
-Bug: https://bugs.gentoo.org/565358
-Bug: https://bugs.gentoo.org/501684
----
- tools/llvm-config/CMakeLists.txt | 11 ++++++++---
- tools/llvm-config/llvm-config.cpp | 20 +++++++++++++++-----
- utils/llvm-build/llvmbuild/main.py | 4 +++-
- 3 files changed, 26 insertions(+), 9 deletions(-)
-
-diff --git a/tools/llvm-config/CMakeLists.txt b/tools/llvm-config/CMakeLists.txt
-index 83794bb..eba6f45 100644
---- a/tools/llvm-config/CMakeLists.txt
-+++ b/tools/llvm-config/CMakeLists.txt
-@@ -22,15 +22,20 @@ get_property(COMPILE_FLAGS TARGET llvm-config PROPERTY COMPILE_FLAGS)
- set(LLVM_SRC_ROOT ${LLVM_MAIN_SRC_DIR})
- set(LLVM_OBJ_ROOT ${LLVM_BINARY_DIR})
- set(LLVM_CPPFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_CPP_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
--set(LLVM_CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
--set(LLVM_CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${COMPILE_FLAGS} ${LLVM_DEFINITIONS}")
-+# Just use CMAKE_CPP_FLAGS for CFLAGS and CXXFLAGS, otherwise compiler
-+# specific flags will be set when we don't know what compiler will be used
-+# with external project utilising llvm-config. C++ Standard is required.
-+# TODO: figure out if we can remove -std=c++11 and move it to revdeps.
-+set(LLVM_CFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
-+set(LLVM_CXXFLAGS "${CMAKE_CPP_FLAGS} -std=c++11 ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
- set(LLVM_BUILD_SYSTEM cmake)
- set(LLVM_HAS_RTTI ${LLVM_CONFIG_HAS_RTTI})
-
- # Use the C++ link flags, since they should be a superset of C link flags.
- set(LLVM_LDFLAGS "${CMAKE_CXX_LINK_FLAGS}")
- set(LLVM_BUILDMODE ${CMAKE_BUILD_TYPE})
--set(LLVM_SYSTEM_LIBS ${SYSTEM_LIBS})
-+# We don't do static libs, so we don't need to supply any system-libs
-+set(LLVM_SYSTEM_LIBS "")
- if(BUILD_SHARED_LIBS)
- set(LLVM_ENABLE_SHARED ON)
- else()
-diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index 80f6279..5c65c57 100644
---- a/tools/llvm-config/llvm-config.cpp
-+++ b/tools/llvm-config/llvm-config.cpp
-@@ -484,7 +484,8 @@ int main(int argc, char **argv) {
- } else if (Arg == "--host-target") {
- OS << Triple::normalize(LLVM_DEFAULT_TARGET_TRIPLE) << '\n';
- } else if (Arg == "--build-mode") {
-- OS << build_mode << '\n';
-+ // force Release since we force non-standard Gentoo build mode
-+ OS << "Release" << '\n';
- } else if (Arg == "--assertion-mode") {
- #if defined(NDEBUG)
- OS << "OFF\n";
-@@ -497,10 +498,19 @@ int main(int argc, char **argv) {
- OS << LLVM_HAS_RTTI << '\n';
- } else if (Arg == "--shared-mode") {
- PrintSharedMode = true;
-- } else if (Arg == "--obj-root") {
-- OS << ActivePrefix << '\n';
-- } else if (Arg == "--src-root") {
-- OS << LLVM_SRC_ROOT << '\n';
-+ } else if (Arg == "--obj-root" || Arg == "--src-root") {
-+ if (IsInDevelopmentTree) {
-+ if (Arg == "--obj-root") {
-+ OS << ActivePrefix << '\n';
-+ } else {
-+ OS << LLVM_SRC_ROOT << '\n';
-+ }
-+ } else {
-+ // sources are not installed
-+ llvm::errs() << "llvm-config: sources not installed, "
-+ << Arg << " not available\n";
-+ exit(1);
-+ }
- } else {
- usage();
- }
-diff --git a/utils/llvm-build/llvmbuild/main.py b/utils/llvm-build/llvmbuild/main.py
-index f2472f6..c89c77a 100644
---- a/utils/llvm-build/llvmbuild/main.py
-+++ b/utils/llvm-build/llvmbuild/main.py
-@@ -393,6 +393,8 @@ subdirectories = %s
- //
- //===----------------------------------------------------------------------===//
-
-+#include "llvm/Config/config.h"
-+
- """)
- f.write('struct AvailableComponent {\n')
- f.write(' /// The name of the component.\n')
-@@ -413,7 +415,7 @@ subdirectories = %s
- if library_name is None:
- library_name_as_cstr = 'nullptr'
- else:
-- library_name_as_cstr = '"lib%s.a"' % library_name
-+ library_name_as_cstr = '"lib%s" LTDL_SHLIB_EXT' % library_name
- if is_installed:
- is_installed_as_cstr = 'true'
- else:
---
-2.7.4
-
diff --git a/sys-devel/llvm/files/3.8.1/musl-env-support.patch b/sys-devel/llvm/files/3.8.1/musl-env-support.patch
deleted file mode 100644
index 8de660d01cf8..000000000000
--- a/sys-devel/llvm/files/3.8.1/musl-env-support.patch
+++ /dev/null
@@ -1,164 +0,0 @@
-diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h
-index e01db0a..bf9361a 100644
---- a/include/llvm/ADT/Triple.h
-+++ b/include/llvm/ADT/Triple.h
-@@ -173,6 +173,9 @@ public:
- EABI,
- EABIHF,
- Android,
-+ Musl,
-+ MuslEABI,
-+ MuslEABIHF,
-
- MSVC,
- Itanium,
-@@ -544,6 +547,13 @@ public:
- /// Tests whether the target is Android
- bool isAndroid() const { return getEnvironment() == Triple::Android; }
-
-+ /// Tests whether the environment is musl-libc
-+ bool isMusl() const {
-+ return getEnvironment() == Triple::Musl ||
-+ getEnvironment() == Triple::MuslEABI ||
-+ getEnvironment() == Triple::MuslEABIHF;
-+ }
-+
- /// @}
- /// @name Mutators
- /// @{
-diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp
-index 11afcf7..ad9cffd 100644
---- a/lib/Support/Triple.cpp
-+++ b/lib/Support/Triple.cpp
-@@ -200,6 +200,9 @@ const char *Triple::getEnvironmentTypeName(EnvironmentType Kind) {
- case EABI: return "eabi";
- case EABIHF: return "eabihf";
- case Android: return "android";
-+ case Musl: return "musl";
-+ case MuslEABI: return "musleabi";
-+ case MuslEABIHF: return "musleabihf";
- case MSVC: return "msvc";
- case Itanium: return "itanium";
- case Cygnus: return "cygnus";
-@@ -454,6 +457,9 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
- .StartsWith("code16", Triple::CODE16)
- .StartsWith("gnu", Triple::GNU)
- .StartsWith("android", Triple::Android)
-+ .StartsWith("musleabihf", Triple::MuslEABIHF)
-+ .StartsWith("musleabi", Triple::MuslEABI)
-+ .StartsWith("musl", Triple::Musl)
- .StartsWith("msvc", Triple::MSVC)
- .StartsWith("itanium", Triple::Itanium)
- .StartsWith("cygnus", Triple::Cygnus)
-@@ -1431,6 +1437,7 @@ StringRef Triple::getARMCPUForArch(StringRef MArch) const {
- switch (getEnvironment()) {
- case llvm::Triple::EABIHF:
- case llvm::Triple::GNUEABIHF:
-+ case llvm::Triple::MuslEABIHF:
- return "arm1176jzf-s";
- default:
- return "arm7tdmi";
-diff --git a/lib/Target/ARM/ARMAsmPrinter.cpp b/lib/Target/ARM/ARMAsmPrinter.cpp
-index f3813c8..45e8c4a 100644
---- a/lib/Target/ARM/ARMAsmPrinter.cpp
-+++ b/lib/Target/ARM/ARMAsmPrinter.cpp
-@@ -541,7 +541,8 @@ void ARMAsmPrinter::EmitEndOfAsmFile(Module &M) {
- ARMTargetStreamer &ATS = static_cast<ARMTargetStreamer &>(TS);
-
- if (OptimizationGoals > 0 &&
-- (Subtarget->isTargetAEABI() || Subtarget->isTargetGNUAEABI()))
-+ (Subtarget->isTargetAEABI() || Subtarget->isTargetGNUAEABI() ||
-+ Subtarget->isTargetMuslAEABI()))
- ATS.emitAttribute(ARMBuildAttrs::ABI_optimization_goals, OptimizationGoals);
- OptimizationGoals = -1;
-
-diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp
-index a2daa89..3b2c0bb 100644
---- a/lib/Target/ARM/ARMISelLowering.cpp
-+++ b/lib/Target/ARM/ARMISelLowering.cpp
-@@ -254,7 +254,7 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
- // RTLIB
- if (Subtarget->isAAPCS_ABI() &&
- (Subtarget->isTargetAEABI() || Subtarget->isTargetGNUAEABI() ||
-- Subtarget->isTargetAndroid())) {
-+ Subtarget->isTargetMuslAEABI() || Subtarget->isTargetAndroid())) {
- static const struct {
- const RTLIB::Libcall Op;
- const char * const Name;
-@@ -787,7 +787,8 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
- setOperationAction(ISD::SREM, MVT::i32, Expand);
- setOperationAction(ISD::UREM, MVT::i32, Expand);
- // Register based DivRem for AEABI (RTABI 4.2)
-- if (Subtarget->isTargetAEABI() || Subtarget->isTargetAndroid()) {
-+ if (Subtarget->isTargetAEABI() || Subtarget->isTargetAndroid() ||
-+ Subtarget->isTargetMuslAEABI()) {
- setOperationAction(ISD::SREM, MVT::i64, Custom);
- setOperationAction(ISD::UREM, MVT::i64, Custom);
-
-@@ -11651,7 +11652,8 @@ static TargetLowering::ArgListTy getDivRemArgList(
- }
-
- SDValue ARMTargetLowering::LowerDivRem(SDValue Op, SelectionDAG &DAG) const {
-- assert((Subtarget->isTargetAEABI() || Subtarget->isTargetAndroid()) &&
-+ assert((Subtarget->isTargetAEABI() || Subtarget->isTargetAndroid() ||
-+ Subtarget->isTargetMuslAEABI()) &&
- "Register-based DivRem lowering only");
- unsigned Opcode = Op->getOpcode();
- assert((Opcode == ISD::SDIVREM || Opcode == ISD::UDIVREM) &&
-diff --git a/lib/Target/ARM/ARMSubtarget.h b/lib/Target/ARM/ARMSubtarget.h
-index 4d54e57..fa1c516 100644
---- a/lib/Target/ARM/ARMSubtarget.h
-+++ b/lib/Target/ARM/ARMSubtarget.h
-@@ -399,14 +399,21 @@ public:
- TargetTriple.getEnvironment() == Triple::GNUEABIHF) &&
- !isTargetDarwin() && !isTargetWindows();
- }
-+ bool isTargetMuslAEABI() const {
-+ return (TargetTriple.getEnvironment() == Triple::MuslEABI ||
-+ TargetTriple.getEnvironment() == Triple::MuslEABIHF) &&
-+ !isTargetDarwin() && !isTargetWindows();
-+ }
-
- // ARM Targets that support EHABI exception handling standard
- // Darwin uses SjLj. Other targets might need more checks.
- bool isTargetEHABICompatible() const {
- return (TargetTriple.getEnvironment() == Triple::EABI ||
- TargetTriple.getEnvironment() == Triple::GNUEABI ||
-+ TargetTriple.getEnvironment() == Triple::MuslEABI ||
- TargetTriple.getEnvironment() == Triple::EABIHF ||
- TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
-+ TargetTriple.getEnvironment() == Triple::MuslEABIHF ||
- isTargetAndroid()) &&
- !isTargetDarwin() && !isTargetWindows();
- }
-@@ -414,6 +421,7 @@ public:
- bool isTargetHardFloat() const {
- // FIXME: this is invalid for WindowsCE
- return TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
-+ TargetTriple.getEnvironment() == Triple::MuslEABIHF ||
- TargetTriple.getEnvironment() == Triple::EABIHF ||
- isTargetWindows() || isAAPCS16_ABI();
- }
-diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp
-index fca1901..a96b1f9 100644
---- a/lib/Target/ARM/ARMTargetMachine.cpp
-+++ b/lib/Target/ARM/ARMTargetMachine.cpp
-@@ -99,6 +99,8 @@ computeTargetABI(const Triple &TT, StringRef CPU,
- case llvm::Triple::Android:
- case llvm::Triple::GNUEABI:
- case llvm::Triple::GNUEABIHF:
-+ case llvm::Triple::MuslEABI:
-+ case llvm::Triple::MuslEABIHF:
- case llvm::Triple::EABIHF:
- case llvm::Triple::EABI:
- TargetABI = ARMBaseTargetMachine::ARM_ABI_AAPCS;
-@@ -192,7 +194,8 @@ ARMBaseTargetMachine::ARMBaseTargetMachine(const Target &T, const Triple &TT,
- // Default to triple-appropriate EABI
- if (Options.EABIVersion == EABI::Default ||
- Options.EABIVersion == EABI::Unknown) {
-- if (Subtarget.isTargetGNUAEABI())
-+ // musl is compatible with glibc with regard to EABI version
-+ if (Subtarget.isTargetGNUAEABI() || Subtarget.isTargetMuslAEABI())
- this->Options.EABIVersion = EABI::GNU;
- else
- this->Options.EABIVersion = EABI::EABI5;
diff --git a/sys-devel/llvm/llvm-3.8.1-r2.ebuild b/sys-devel/llvm/llvm-3.8.1-r2.ebuild
index 0c120d3c6cd1..e1df41fb8a4f 100644
--- a/sys-devel/llvm/llvm-3.8.1-r2.ebuild
+++ b/sys-devel/llvm/llvm-3.8.1-r2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
@@ -16,7 +16,8 @@ SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz
http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz
http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz )
lldb? ( http://llvm.org/releases/${PV}/lldb-${PV}.src.tar.xz )
- !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${PN}-3.8.0-manpages.tar.bz2 )"
+ !doc? ( https://dev.gentoo.org/~voyageur/distfiles/${PN}-3.8.0-manpages.tar.bz2 )
+ https://dev.gentoo.org/~mgorny/dist/llvm/${P}-patchset.tar.xz"
# Additional licenses:
# 1. OpenBSD regex: Henry Spencer's license ('rc' in Gentoo) + BSD.
@@ -156,38 +157,38 @@ src_prepare() {
# Make ocaml warnings non-fatal, bug #537308
sed -e "/RUN/s/-warn-error A//" -i test/Bindings/OCaml/*ml || die
# Fix libdir for ocaml bindings install, bug #559134
- eapply "${FILESDIR}"/3.9.1/0001-cmake-Install-OCaml-modules-into-correct-package-loc.patch
+ eapply "${WORKDIR}/${P}-patchset"/0001-cmake-Install-OCaml-modules-into-correct-package-loc.patch
# Do not build/install ocaml docs with USE=-doc, bug #562008
- eapply "${FILESDIR}"/3.9.1/0002-cmake-Make-OCaml-docs-dependent-on-LLVM_BUILD_DOCS.patch
+ eapply "${WORKDIR}/${P}-patchset"/0002-cmake-Make-OCaml-docs-dependent-on-LLVM_BUILD_DOCS.patch
# Make it possible to override Sphinx HTML install dirs
# https://llvm.org/bugs/show_bug.cgi?id=23780
- eapply "${FILESDIR}"/3.9.1/0003-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch
+ eapply "${WORKDIR}/${P}-patchset"/0003-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch
# Prevent race conditions with parallel Sphinx runs
# https://llvm.org/bugs/show_bug.cgi?id=23781
- eapply "${FILESDIR}"/3.8.1/0004-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch
+ eapply "${WORKDIR}/${P}-patchset"/0004-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch
# Prevent installing libgtest
# https://llvm.org/bugs/show_bug.cgi?id=18341
- eapply "${FILESDIR}"/3.8.1/0005-cmake-Do-not-install-libgtest.patch
+ eapply "${WORKDIR}/${P}-patchset"/0005-cmake-Do-not-install-libgtest.patch
# Allow custom cmake build types (like 'Gentoo')
- eapply "${FILESDIR}"/3.9.1/0006-cmake-Remove-the-CMAKE_BUILD_TYPE-assertion.patch
+ eapply "${WORKDIR}/${P}-patchset"/0006-cmake-Remove-the-CMAKE_BUILD_TYPE-assertion.patch
# Fix llvm-config for shared linking and sane flags
# https://bugs.gentoo.org/show_bug.cgi?id=565358
- eapply "${FILESDIR}"/3.9.1/llvm-config-r1.patch
+ eapply "${WORKDIR}/${P}-patchset"/llvm-config-r1.patch
# Restore SOVERSIONs for shared libraries
# https://bugs.gentoo.org/show_bug.cgi?id=578392
- eapply "${FILESDIR}"/3.8.1/0008-cmake-Restore-SOVERSIONs-on-shared-libraries.patch
+ eapply "${WORKDIR}/${P}-patchset"/0008-cmake-Restore-SOVERSIONs-on-shared-libraries.patch
# support building llvm against musl-libc
- use elibc_musl && eapply "${FILESDIR}"/9999/musl-fixes.patch
+ use elibc_musl && eapply "${WORKDIR}/${P}-patchset"/musl-fixes.patch
# support "musl" as a valid environment type in llvm
- eapply "${FILESDIR}"/3.8.1/musl-env-support.patch
+ eapply "${WORKDIR}/${P}-patchset"/musl-env-support.patch
# disable use of SDK on OSX, bug #568758
sed -i -e 's/xcrun/false/' utils/lit/lit/util.py || die
@@ -197,21 +198,21 @@ src_prepare() {
if use clang; then
# Automatically select active system GCC's libraries, bugs #406163 and #417913
- eapply "${FILESDIR}"/3.8.1/clang/gentoo-runtime-gcc-detection-v3.patch
+ eapply "${WORKDIR}/${P}-patchset"/clang/gentoo-runtime-gcc-detection-v3.patch
# Support gcc4.9 search paths
# https://github.com/llvm-mirror/clang/commit/af4db76e059c1a3
- eapply "${FILESDIR}"/3.8.1/clang/gcc4.9-search-path.patch
+ eapply "${WORKDIR}/${P}-patchset"/clang/gcc4.9-search-path.patch
- eapply "${FILESDIR}"/3.9.1/clang/darwin_prefix-include-paths.patch
+ eapply "${WORKDIR}/${P}-patchset"/clang/darwin_prefix-include-paths.patch
eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
pushd "${S}"/tools/clang >/dev/null || die
# be able to specify default values for -stdlib and -rtlib at build time
- eapply "${FILESDIR}"/3.8.1/clang/default-libs.patch
+ eapply "${WORKDIR}/${P}-patchset"/clang/default-libs.patch
# enable clang to recognize musl-libc
- eapply "${FILESDIR}"/3.8.1/clang/musl-support.patch
+ eapply "${WORKDIR}/${P}-patchset"/clang/musl-support.patch
popd >/dev/null || die
sed -i -e "s^@EPREFIX@^${EPREFIX}^" \
@@ -219,28 +220,28 @@ src_prepare() {
# Install clang runtime into /usr/lib/clang
# https://llvm.org/bugs/show_bug.cgi?id=23792
- eapply "${FILESDIR}"/3.9.1/clang/0001-Install-clang-runtime-into-usr-lib-without-suffix.patch
- eapply "${FILESDIR}"/3.8.1/compiler-rt/0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch
+ eapply "${WORKDIR}/${P}-patchset"/clang/0001-Install-clang-runtime-into-usr-lib-without-suffix.patch
+ eapply "${WORKDIR}/${P}-patchset"/compiler-rt/0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch
# Do not force -march flags on arm platforms
# https://bugs.gentoo.org/show_bug.cgi?id=562706
- eapply "${FILESDIR}"/3.8.1/compiler-rt/arm_march_flags.patch
+ eapply "${WORKDIR}/${P}-patchset"/compiler-rt/arm_march_flags.patch
# Make it possible to override CLANG_LIBDIR_SUFFIX
# (that is used only to find LLVMgold.so)
# https://llvm.org/bugs/show_bug.cgi?id=23793
- eapply "${FILESDIR}"/3.9.1/clang/0002-cmake-Make-CLANG_LIBDIR_SUFFIX-overridable.patch
+ eapply "${WORKDIR}/${P}-patchset"/clang/0002-cmake-Make-CLANG_LIBDIR_SUFFIX-overridable.patch
# Fix git-clang-format shebang, bug #562688
python_fix_shebang tools/clang/tools/clang-format/git-clang-format
# Fix 'stdarg.h' file not found on Gentoo/FreeBSD, bug #578064
# https://llvm.org/bugs/show_bug.cgi?id=26651
- eapply "${FILESDIR}"/3.8.1/compiler-rt/fbsd.patch
+ eapply "${WORKDIR}/${P}-patchset"/compiler-rt/fbsd.patch
# Backport abi-tag support, bug #571600
- eapply "${FILESDIR}"/3.8.1/clang/abi-tag-support-sema.patch
- eapply "${FILESDIR}"/3.8.1/clang/abi-tag-support-mangler.patch
+ eapply "${WORKDIR}/${P}-patchset"/clang/abi-tag-support-sema.patch
+ eapply "${WORKDIR}/${P}-patchset"/clang/abi-tag-support-mangler.patch
pushd projects/compiler-rt >/dev/null || die
@@ -258,7 +259,7 @@ src_prepare() {
sed -e 's/add_subdirectory(readline)/#&/' \
-i tools/lldb/scripts/Python/modules/CMakeLists.txt || die
# Do not install bundled six module
- eapply "${FILESDIR}"/3.9.1/lldb/six.patch
+ eapply "${WORKDIR}/${P}-patchset"/lldb/six.patch
fi
# User patches