<pre style='margin:0'>
Marcus Calhoun-Lopez (MarcusCalhoun-Lopez) pushed a commit to branch master
in repository macports-ports.

</pre>
<p><a href="https://github.com/macports/macports-ports/commit/1624fe05a9a4301b52b76ef157f4ec63378338d9">https://github.com/macports/macports-ports/commit/1624fe05a9a4301b52b76ef157f4ec63378338d9</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 1624fe05a9a4301b52b76ef157f4ec63378338d9
</span>Author: Marcus Calhoun-Lopez <mcalhoun@macports.org>
AuthorDate: Thu Apr 7 06:50:46 2022 -0700

<span style='display:block; white-space:pre;color:#404040;'>    clang-*: tweak -stdlib; allow low deployment target
</span><span style='display:block; white-space:pre;color:#404040;'>    
</span><span style='display:block; white-space:pre;color:#404040;'>    Building rust-bootstrap requires macosx_deployment_target < 10.7
</span><span style='display:block; white-space:pre;color:#404040;'>    on newer systems.
</span><span style='display:block; white-space:pre;color:#404040;'>    rust-bootstrap also requires full thread-local-support (TLS).
</span><span style='display:block; white-space:pre;color:#404040;'>    `-femulated-tls` does not seem to be sufficient.
</span><span style='display:block; white-space:pre;color:#404040;'>    This is an issue since the Clang compilers only turn on their full
</span><span style='display:block; white-space:pre;color:#404040;'>    support for emulated TLS on older systems.
</span><span style='display:block; white-space:pre;color:#404040;'>    Therefore, add support for emulated TLS when
</span><span style='display:block; white-space:pre;color:#404040;'>    when macosx_deployment_target < 10.7 on all systems.
</span><span style='display:block; white-space:pre;color:#404040;'>    See https://github.com/macports/macports-ports/pull/14277
</span><span style='display:block; white-space:pre;color:#404040;'>    
</span><span style='display:block; white-space:pre;color:#404040;'>    Simplify the patches that allow `-stdlib=macports-libstdc++`.
</span><span style='display:block; white-space:pre;color:#404040;'>    Allow `-stdlib=macports-libstdc++` to work on Apple Silicon systems.
</span><span style='display:block; white-space:pre;color:#404040;'>    Also alias `-stdlib=macports-libstdc++` to `-stdlib=libstdc++_macports`
</span><span style='display:block; white-space:pre;color:#404040;'>    since a Rust build package seems to assume
</span><span style='display:block; white-space:pre;color:#404040;'>    C++ standard libraries always begin with lib.
</span><span style='display:block; white-space:pre;color:#404040;'>    
</span><span style='display:block; white-space:pre;color:#404040;'>    The connection between these two changes is tenuous, so they really
</span><span style='display:block; white-space:pre;color:#404040;'>    should be split into two commits, but rebuilding such large ports
</span><span style='display:block; white-space:pre;color:#404040;'>    twice seems worse than a slightly muddled history.
</span>---
 lang/llvm-10/Portfile                              |  81 ++++----
 lang/llvm-10/files/9001-macports-libstdcxx.diff    | 213 ++++++++------------
 lang/llvm-11/Portfile                              |  81 ++++----
 lang/llvm-11/files/9001-macports-libstdcxx.diff    | 215 ++++++++-------------
 lang/llvm-12/Portfile                              |  69 +++----
 .../0005-clang-support-macports-libstdcxx.patch    | 145 +++-----------
 lang/llvm-13/Portfile                              |  69 +++----
 .../0005-clang-support-macports-libstdcxx.patch    | 150 +++-----------
 lang/llvm-14/Portfile                              |  69 +++----
 .../0005-clang-support-macports-libstdcxx.patch    | 154 +++------------
 lang/llvm-5.0/Portfile                             |  70 +++----
 lang/llvm-5.0/files/9001-macports-libstdcxx.diff   | 136 ++++++-------
 lang/llvm-6.0/Portfile                             |  69 +++----
 lang/llvm-6.0/files/9001-macports-libstdcxx.diff   | 136 ++++++-------
 lang/llvm-7.0/Portfile                             |  89 ++++-----
 lang/llvm-7.0/files/9001-macports-libstdcxx.diff   | 133 ++++++-------
 lang/llvm-8.0/Portfile                             |  96 ++++-----
 lang/llvm-8.0/files/9001-macports-libstdcxx.diff   | 137 ++++++-------
 lang/llvm-9.0/Portfile                             |  86 ++++-----
 lang/llvm-9.0/files/9001-macports-libstdcxx.diff   | 213 ++++++++------------
 lang/llvm-devel/Portfile                           |  71 +++----
 .../0005-clang-support-macports-libstdcxx.patch    | 156 +++------------
 22 files changed, 985 insertions(+), 1653 deletions(-)

<span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-10/Portfile b/lang/llvm-10/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index c19ab7ad373..f7cbe82cdc2 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-10/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-10/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -11,8 +11,8 @@ set llvm_version_no_dot 10
</span> set clang_executable_version 10
 set lldb_executable_version 10
 name                    llvm-${llvm_version}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-revision                2
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-subport                 clang-${llvm_version} { revision 5 }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+revision                3
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+subport                 clang-${llvm_version} { revision 6 }
</span> subport                 lldb-${llvm_version} { revision 1 }
 set suffix              mp-${llvm_version}
 set sub_prefix          ${prefix}/libexec/llvm-${llvm_version}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -478,16 +478,14 @@ post-destroot {
</span>     }
 }
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-if {${os.major} < 11} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    variant emulated_tls description { enable c11/c++11 thread_local_storage support on older systems using emulated-tls } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        # use emulated-tls to support thread_local on systems prior to 10.7
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        patchfiles-append      9000-patch-llvm-7.0-support-emulated-tls.diff
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        if {${subport} eq "clang-${llvm_version}"} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            patchfiles-append  9000-patch-clang-7.0-support-emulated-tls.diff
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+variant emulated_tls description { enable c11/c++11 thread_local_storage support on older systems using emulated-tls } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    # use emulated-tls to support thread_local on systems prior to 10.7
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    patchfiles-append      9000-patch-llvm-7.0-support-emulated-tls.diff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    if {${subport} eq "clang-${llvm_version}"} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        patchfiles-append  9000-patch-clang-7.0-support-emulated-tls.diff
</span>     }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    default_variants-append +emulated_tls
</span> }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+default_variants-append +emulated_tls
</span> 
 if {${subport} eq "llvm-${llvm_version}"} {
     variant polly description {Provide the polly polyhedral optimizer} {}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -544,65 +542,56 @@ if {${subport} eq "llvm-${llvm_version}"} {
</span>         default_variants-append +defaultlibcxx
     }
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    variant libstdcxx description {-stdlib=macports-libstdc++ searches for MacPorts libstdc++} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    variant libstdcxx description {-stdlib=libstdc++_macports searches for MacPorts libstdc++} {
</span> 
         patchfiles-append 9001-macports-libstdcxx.diff
 
         post-patch {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+            if { ${configure.build_arch} eq "arm64" } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                # see https://github.com/macports/macports-ports/commit/be1e11a368f672d927a7bdb381f2fa71a79ba483
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                set gcc_arch    aarch64
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                set gcc_arch    ${configure.build_arch}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span>             reinplace "s|@@MACPORTS_GCC_INCLUDE_DIR@@|${prefix}/include/gcc/c++|g" \
                 ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp \
                 ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_HOST_NAME@@|${build_arch}-apple-darwin${os.major}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            reinplace "s|@@MACPORTS_HOST_NAME@@|${gcc_arch}-apple-darwin${os.major}|g" \
</span>                 ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
             reinplace "s|@@MACPORTS_libstdc++@@|${prefix}/lib/libgcc/libstdc++.6.dylib|g" \
                 ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # GCC was built for ${build_arch}-apple-darwin${os.major}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # GCC was built for ${configure.build_arch}-apple-darwin${os.major}
</span>             # if GCC was also built universal, it has an extra include directory
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # MacPorts GCC can not compile across platforms
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            switch ${build_arch} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # MacPorts GCC cannot compile across platforms
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            switch ${configure.build_arch} {
</span>                 x86_64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   "i386"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::x86_64 ? "" : "i386"|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
                 i386 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::x86_64 ? "x86_64" : ""|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
                 ppc64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    "ppc"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::ppc64 ? "" : "ppc"|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
                 ppc {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::ppc64 ? "ppc64" : ""|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                arm64 {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|""|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
             }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@|${gcc_subdirectory_x86_64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_i386@@|${gcc_subdirectory_i386}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@|${gcc_subdirectory_ppc64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc@@|${gcc_subdirectory_ppc}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span>         }
     }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    # at present, only the non-arm archs can use this variant
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    if {${build_arch} in "x86_64 i386 ppc64 ppc"} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        default_variants-append +libstdcxx
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    default_variants-append +libstdcxx
</span> 
     post-patch {
         reinplace "s|@@PREFIX@@|${prefix}|" \
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-10/files/9001-macports-libstdcxx.diff b/lang/llvm-10/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;color:#808080;'>index 9d9154e8c81..0b93834bebf 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-10/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-10/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1,157 +1,108 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -184,6 +184,9 @@ public:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   /// Use libc++ instead of the default libstdc++.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   unsigned UseLibcxx : 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  /// Use MacPorts libstdc++ instead of default system libstdc++.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  unsigned UseMacPortsLibstdcxx : 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   /// Whether header search information should be output as for -v.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   unsigned Verbose : 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Frontend/CompilerInvocation.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Frontend/CompilerInvocation.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1967,8 +1967,10 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   Opts.UseBuiltinIncludes = !Args.hasArg(OPT_nobuiltininc);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   Opts.UseStandardSystemIncludes = !Args.hasArg(OPT_nostdsysteminc);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   Opts.UseStandardCXXIncludes = !Args.hasArg(OPT_nostdincxx);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--  if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ))
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ)) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    Opts.UseMacPortsLibstdcxx = (strcmp(A->getValue(), "macports-libstdc++") == 0);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   Opts.ResourceDir = Args.getLastArgValue(OPT_resource_dir);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   // Canonicalize -fmodules-cache-path before storing it.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -110,7 +110,7 @@ static bool CanPrefixSysroot(StringRef Path) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #if defined(_WIN32)
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #else
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--  return llvm::sys::path::is_absolute(Path);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  return llvm::sys::path::is_absolute(Path) && Path.find("@@MACPORTS_GCC_INCLUDE_DIR@@")!=0;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #endif
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/include/clang/Driver/ToolChain.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/include/clang/Driver/ToolChain.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -91,7 +91,8 @@ public:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+From 4e850191efa6659de85a4ff9be7c896cfb0bb1ec Mon Sep 17 00:00:00 2001
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Date: Mon, 17 May 2021 21:28:40 -0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Subject: [PATCH 05/24] clang: support macports-libstdcxx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+requires reinplace of search paths
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+---
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ clang/include/clang/Driver/ToolChain.h        |  3 +-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ clang/lib/Driver/ToolChain.cpp                |  3 ++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ clang/lib/Driver/ToolChains/Darwin.cpp        | 40 ++++++++++++++-----
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ clang/lib/Driver/ToolChains/Hexagon.cpp       |  2 +
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ clang/lib/Frontend/InitHeaderSearch.cpp       |  2 +-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 7 files changed, 63 insertions(+), 11 deletions(-)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ create mode 100644 clang/lib/Frontend/CompilerInvocation.cpp.rej
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index 28c37a44e1eb..78fcaec7bfb0 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- a/tools/clang/include/clang/Driver/ToolChain.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ b/tools//clang/include/clang/Driver/ToolChain.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -91,6 +91,7 @@ public:
</span>  
    enum CXXStdlibType {
      CST_Libcxx,
<span style='display:block; white-space:pre;background:#ffe0e0;'>--    CST_Libstdcxx
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_Libstdcxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_MacPortsLibstdcxx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    CST_MacPortsLibstdcxx,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CST_Libstdcxx
</span>    };
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   enum RuntimeLibType {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1921,8 +1921,9 @@ void DarwinClang::AddClangCXXStdlibInclu
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index b2ddef141a75..6160843b6885 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- a/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ b/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -807,6 +807,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     return ToolChain::CST_Libcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   else if (LibName == "libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     return ToolChain::CST_Libstdcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  else if (LibName == "macports-libstdc++" || LibName == "libstdc++_macports")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    return ToolChain::CST_MacPortsLibstdcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   else if (LibName == "platform")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     return GetDefaultCXXStdlibType();
</span>  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   llvm::StringRef Sysroot = GetHeaderSysroot(DriverArgs);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  CXXStdlibType Type = GetCXXStdlibType(DriverArgs);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -898,6 +900,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     break;
</span>  
<span style='display:block; white-space:pre;background:#ffe0e0;'>--  switch (GetCXXStdlibType(DriverArgs)) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  switch (Type) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   case ToolChain::CST_Libcxx: {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     // On Darwin, libc++ is installed alongside the compiler in
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     // include/c++/v1, so get from '<install>/bin' to '<install>/include/c++/v1'.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1943,6 +1944,7 @@ void DarwinClang::AddClangCXXStdlibInclu
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   case ToolChain::CST_Libstdcxx:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  case ToolChain::CST_MacPortsLibstdcxx:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CmdArgs.push_back("-lstdc++");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index eb7bd4aec898..daa8e520e404 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- a/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ b/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -2002,6 +2002,16 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     break;
</span>    }
  
<span style='display:block; white-space:pre;background:#e0ffe0;'>++  case ToolChain::CST_MacPortsLibstdcxx: {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    bool IsBaseFoundMacPorts = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, llvm::StringRef("@@MACPORTS_GCC_INCLUDE_DIR@@"),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                             "",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                             "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                             @@MACPORTS_TEST_32_64@@);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    if (!IsBaseFoundMacPorts) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++      getDriver().Diag(diag::warn_drv_libstdcxx_not_found);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    }}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span>    case ToolChain::CST_Libstdcxx:
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  case ToolChain::CST_MacPortsLibstdcxx:
</span>      llvm::SmallString<128> UsrIncludeCxx = Sysroot;
      llvm::sys::path::append(UsrIncludeCxx, "usr", "include", "c++");
<span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1953,10 +1955,17 @@ void DarwinClang::AddClangCXXStdlibInclu
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--      IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "powerpc-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                arch == llvm::Triple::ppc64 ? "ppc64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound = false;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (Type==ToolChain::CST_MacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, llvm::StringRef("@@MACPORTS_GCC_INCLUDE_DIR@@"),
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  arch == llvm::Triple::ppc64 ? "@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@" : "@@MACPORTS_GCC_SUBDIRECTORY_ppc@@");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "powerpc-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 arch == llvm::Triple::ppc64 ? "ppc64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                 "4.0.0", "powerpc-apple-darwin8",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                  arch == llvm::Triple::ppc64 ? "ppc64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1964,10 +1973,17 @@ void DarwinClang::AddClangCXXStdlibInclu
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86_64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--      IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "i686-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                arch == llvm::Triple::x86_64 ? "x86_64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound = false;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (Type==ToolChain::CST_MacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, llvm::StringRef("@@MACPORTS_GCC_INCLUDE_DIR@@"),
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  arch == llvm::Triple::x86_64 ? "@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@" : "@@MACPORTS_GCC_SUBDIRECTORY_i386@@");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "i686-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 arch == llvm::Triple::x86_64 ? "x86_64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                 "4.0.0", "i686-apple-darwin8",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                  arch == llvm::Triple::x86_64 ? "x86_64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2010,6 +2026,12 @@ void DarwinClang::AddCXXStdlibLibArgs(co
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -2069,6 +2079,10 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CmdArgs.push_back("-lc++");
</span>      break;
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   case ToolChain::CST_Libstdcxx:
</span> +  case ToolChain::CST_MacPortsLibstdcxx:
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+    if (Type==ToolChain::CST_MacPortsLibstdcxx && getVFS().exists("@@MACPORTS_libstdc++@@")) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      CmdArgs.push_back("@@MACPORTS_libstdc++@@");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      return;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    CmdArgs.push_back("@@MACPORTS_libstdc++@@");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    break;
</span> +
<span style='display:block; white-space:pre;background:#e0ffe0;'>+   case ToolChain::CST_Libstdcxx:
</span>      // Unfortunately, -lstdc++ doesn't always exist in the standard search path;
      // it was previously found in the gcc lib dir. However, for all the Darwin
<span style='display:block; white-space:pre;background:#ffe0e0;'>-     // platforms we care about it was -lstdc++.6, so we search for that
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Driver/ToolChains/Hexagon.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Driver/ToolChains/Hexagon.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -551,6 +551,8 @@ HexagonToolChain::GetCXXStdlibType(const ArgList &Args) const {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index fb54f73bcd4c..0260a32096af 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- a/tools/clang/lib/Driver/ToolChains/Hexagon.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ b/tools/clang/lib/Driver/ToolChains/Hexagon.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -556,6 +556,8 @@
</span>      return ToolChain::CST_Libstdcxx;
  
    StringRef Value = A->getValue();
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  if (Value == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  if (Value == "macports-libstdc++" || Value == "libstdc++_macports")
</span> +    return ToolChain::CST_MacPortsLibstdcxx;
    if (Value != "libstdc++")
      getDriver().Diag(diag::err_drv_invalid_stdlib_name) << A->getAsString(Args);
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -766,6 +766,8 @@ ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return ToolChain::CST_Libcxx;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   else if (LibName == "libstdc++")
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return ToolChain::CST_Libstdcxx;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  else if (LibName == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    return ToolChain::CST_MacPortsLibstdcxx;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   else if (LibName == "platform")
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return GetDefaultCXXStdlibType();
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -847,6 +849,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git a/clang/lib/Frontend/InitHeaderSearch.cpp b/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index bc31445d6d08..abc3750edec0 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- a/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ b/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -110,7 +110,7 @@ static bool CanPrefixSysroot(StringRef Path) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if defined(_WIN32)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-  return llvm::sys::path::is_absolute(Path);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  return llvm::sys::path::is_absolute(Path) && Path.find("@@MACPORTS_GCC_INCLUDE_DIR@@")!=0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span>  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   case ToolChain::CST_Libstdcxx:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  case ToolChain::CST_MacPortsLibstdcxx:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     CmdArgs.push_back("-lstdc++");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     break;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-- 
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+2.21.1 (Apple Git-122.3)
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-11/Portfile b/lang/llvm-11/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 89e65c8c5de..913fdc160fd 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-11/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-11/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -25,8 +25,8 @@ checksums               rmd160  f566b4b75c8f30418f19069a9a84864ead766401 \
</span>                         size    84065492
 
 name                    llvm-${llvm_version}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-revision                2
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-subport                 clang-${llvm_version} { revision 3 }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+revision                3
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+subport                 clang-${llvm_version} { revision 4 }
</span> subport                 flang-${llvm_version} { revision 1 }
 subport                 lldb-${llvm_version} { revision 1 }
 set suffix              mp-${llvm_version}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -478,16 +478,14 @@ post-destroot {
</span>     }
 }
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-if {${os.major} < 11} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    variant emulated_tls description { enable c11/c++11 thread_local_storage support on older systems using emulated-tls } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        # use emulated-tls to support thread_local on systems prior to 10.7
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        patchfiles-append      9000-patch-llvm-7.0-support-emulated-tls.diff
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        if {${subport} eq "clang-${llvm_version}"} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            patchfiles-append  9000-patch-clang-7.0-support-emulated-tls.diff
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+variant emulated_tls description { enable c11/c++11 thread_local_storage support on older systems using emulated-tls } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    # use emulated-tls to support thread_local on systems prior to 10.7
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    patchfiles-append      9000-patch-llvm-7.0-support-emulated-tls.diff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    if {${subport} eq "clang-${llvm_version}"} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        patchfiles-append  9000-patch-clang-7.0-support-emulated-tls.diff
</span>     }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    default_variants-append +emulated_tls
</span> }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+default_variants-append +emulated_tls
</span> 
 if {${subport} eq "llvm-${llvm_version}"} {
     variant polly description {Provide the polly polyhedral optimizer} {}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -544,65 +542,56 @@ if {${subport} eq "llvm-${llvm_version}"} {
</span>         default_variants-append +defaultlibcxx
     }
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    variant libstdcxx description {-stdlib=macports-libstdc++ searches for MacPorts libstdc++} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    variant libstdcxx description {-stdlib=libstdc++_macports searches for MacPorts libstdc++} {
</span> 
         patchfiles-append 9001-macports-libstdcxx.diff
 
         post-patch {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+            if { ${configure.build_arch} eq "arm64" } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                # see https://github.com/macports/macports-ports/commit/be1e11a368f672d927a7bdb381f2fa71a79ba483
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                set gcc_arch    aarch64
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                set gcc_arch    ${configure.build_arch}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span>             reinplace "s|@@MACPORTS_GCC_INCLUDE_DIR@@|${prefix}/include/gcc/c++|g" \
                 ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp \
                 ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_HOST_NAME@@|${build_arch}-apple-darwin${os.major}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            reinplace "s|@@MACPORTS_HOST_NAME@@|${gcc_arch}-apple-darwin${os.major}|g" \
</span>                 ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
             reinplace "s|@@MACPORTS_libstdc++@@|${prefix}/lib/libgcc/libstdc++.6.dylib|g" \
                 ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # GCC was built for ${build_arch}-apple-darwin${os.major}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # GCC was built for ${configure.build_arch}-apple-darwin${os.major}
</span>             # if GCC was also built universal, it has an extra include directory
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # MacPorts GCC can not compile across platforms
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            switch ${build_arch} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # MacPorts GCC cannot compile across platforms
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            switch ${configure.build_arch} {
</span>                 x86_64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   "i386"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::x86_64 ? "" : "i386"|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
                 i386 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::x86_64 ? "x86_64" : ""|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
                 ppc64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    "ppc"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::ppc64 ? "" : "ppc"|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
                 ppc {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::ppc64 ? "ppc64" : ""|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                arm64 {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|""|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
             }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@|${gcc_subdirectory_x86_64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_i386@@|${gcc_subdirectory_i386}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@|${gcc_subdirectory_ppc64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc@@|${gcc_subdirectory_ppc}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span>         }
     }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    # at present, only the non-arm archs can use this variant
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    if {${build_arch} in "x86_64 i386 ppc64 ppc"} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        default_variants-append +libstdcxx
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    default_variants-append +libstdcxx
</span> 
     post-patch {
         reinplace "s|@@PREFIX@@|${prefix}|" \
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-11/files/9001-macports-libstdcxx.diff b/lang/llvm-11/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;color:#808080;'>index dbff9c9da3b..f5ed851c9f4 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-11/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-11/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1,157 +1,108 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -184,6 +184,9 @@ public:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   /// Use libc++ instead of the default libstdc++.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   unsigned UseLibcxx : 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  /// Use MacPorts libstdc++ instead of default system libstdc++.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  unsigned UseMacPortsLibstdcxx : 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   /// Whether header search information should be output as for -v.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   unsigned Verbose : 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp.orig      2020-05-06 08:57:03.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp   2020-05-07 12:51:38.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2078,8 +2078,10 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   Opts.UseBuiltinIncludes = !Args.hasArg(OPT_nobuiltininc);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   Opts.UseStandardSystemIncludes = !Args.hasArg(OPT_nostdsysteminc);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   Opts.UseStandardCXXIncludes = !Args.hasArg(OPT_nostdincxx);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--  if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ))
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ)) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    Opts.UseMacPortsLibstdcxx = (strcmp(A->getValue(), "macports-libstdc++") == 0);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   Opts.ResourceDir = std::string(Args.getLastArgValue(OPT_resource_dir));
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   // Canonicalize -fmodules-cache-path before storing it.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -110,7 +110,7 @@ static bool CanPrefixSysroot(StringRef Path) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #if defined(_WIN32)
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #else
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--  return llvm::sys::path::is_absolute(Path);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  return llvm::sys::path::is_absolute(Path) && Path.find("@@MACPORTS_GCC_INCLUDE_DIR@@")!=0;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #endif
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/include/clang/Driver/ToolChain.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/include/clang/Driver/ToolChain.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -91,7 +91,8 @@ public:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+From 4e850191efa6659de85a4ff9be7c896cfb0bb1ec Mon Sep 17 00:00:00 2001
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Date: Mon, 17 May 2021 21:28:40 -0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Subject: [PATCH 05/24] clang: support macports-libstdcxx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+requires reinplace of search paths
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+---
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ clang/include/clang/Driver/ToolChain.h        |  3 +-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ clang/lib/Driver/ToolChain.cpp                |  3 ++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ clang/lib/Driver/ToolChains/Darwin.cpp        | 40 ++++++++++++++-----
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ clang/lib/Driver/ToolChains/Hexagon.cpp       |  2 +
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ clang/lib/Frontend/InitHeaderSearch.cpp       |  2 +-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 7 files changed, 63 insertions(+), 11 deletions(-)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ create mode 100644 clang/lib/Frontend/CompilerInvocation.cpp.rej
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index 28c37a44e1eb..78fcaec7bfb0 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- a/tools/clang/include/clang/Driver/ToolChain.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ b/tools//clang/include/clang/Driver/ToolChain.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -93,6 +93,7 @@ public:
</span>  
    enum CXXStdlibType {
      CST_Libcxx,
<span style='display:block; white-space:pre;background:#ffe0e0;'>--    CST_Libstdcxx
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_Libstdcxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_MacPortsLibstdcxx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    CST_MacPortsLibstdcxx,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CST_Libstdcxx
</span>    };
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   enum RuntimeLibType {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1921,8 +1921,9 @@ void DarwinClang::AddClangCXXStdlibInclu
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index b2ddef141a75..6160843b6885 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- a/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ b/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -846,6 +846,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     return ToolChain::CST_Libcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   else if (LibName == "libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     return ToolChain::CST_Libstdcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  else if (LibName == "macports-libstdc++" || LibName == "libstdc++_macports")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    return ToolChain::CST_MacPortsLibstdcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   else if (LibName == "platform")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     return GetDefaultCXXStdlibType();
</span>  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   llvm::StringRef Sysroot = GetHeaderSysroot(DriverArgs);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  CXXStdlibType Type = GetCXXStdlibType(DriverArgs);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -937,6 +939,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     break;
</span>  
<span style='display:block; white-space:pre;background:#ffe0e0;'>--  switch (GetCXXStdlibType(DriverArgs)) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  switch (Type) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   case ToolChain::CST_Libcxx: {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     // On Darwin, libc++ is installed alongside the compiler in
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     // include/c++/v1, so get from '<install>/bin' to '<install>/include/c++/v1'.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1943,6 +1944,7 @@ void DarwinClang::AddClangCXXStdlibInclu
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   case ToolChain::CST_Libstdcxx:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  case ToolChain::CST_MacPortsLibstdcxx:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CmdArgs.push_back("-lstdc++");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index eb7bd4aec898..daa8e520e404 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- a/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ b/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -2066,6 +2066,16 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     break;
</span>    }
  
<span style='display:block; white-space:pre;background:#e0ffe0;'>++  case ToolChain::CST_MacPortsLibstdcxx: {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    bool IsBaseFoundMacPorts = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, llvm::StringRef("@@MACPORTS_GCC_INCLUDE_DIR@@"),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                             "",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                             "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                             @@MACPORTS_TEST_32_64@@);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    if (!IsBaseFoundMacPorts) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++      getDriver().Diag(diag::warn_drv_libstdcxx_not_found);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    }}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span>    case ToolChain::CST_Libstdcxx:
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  case ToolChain::CST_MacPortsLibstdcxx:
</span>      llvm::SmallString<128> UsrIncludeCxx = Sysroot;
      llvm::sys::path::append(UsrIncludeCxx, "usr", "include", "c++");
<span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1953,10 +1955,17 @@ void DarwinClang::AddClangCXXStdlibInclu
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--      IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "powerpc-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                arch == llvm::Triple::ppc64 ? "ppc64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound = false;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (Type==ToolChain::CST_MacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, llvm::StringRef("@@MACPORTS_GCC_INCLUDE_DIR@@"),
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  arch == llvm::Triple::ppc64 ? "@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@" : "@@MACPORTS_GCC_SUBDIRECTORY_ppc@@");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "powerpc-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 arch == llvm::Triple::ppc64 ? "ppc64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                 "4.0.0", "powerpc-apple-darwin8",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                  arch == llvm::Triple::ppc64 ? "ppc64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1964,10 +1973,17 @@ void DarwinClang::AddClangCXXStdlibInclu
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86_64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--      IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "i686-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                arch == llvm::Triple::x86_64 ? "x86_64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound = false;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (Type==ToolChain::CST_MacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, llvm::StringRef("@@MACPORTS_GCC_INCLUDE_DIR@@"),
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  arch == llvm::Triple::x86_64 ? "@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@" : "@@MACPORTS_GCC_SUBDIRECTORY_i386@@");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "i686-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 arch == llvm::Triple::x86_64 ? "x86_64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                 "4.0.0", "i686-apple-darwin8",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                  arch == llvm::Triple::x86_64 ? "x86_64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2010,6 +2026,12 @@ void DarwinClang::AddCXXStdlibLibArgs(co
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -2133,6 +2143,10 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CmdArgs.push_back("-lc++");
</span>      break;
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   case ToolChain::CST_Libstdcxx:
</span> +  case ToolChain::CST_MacPortsLibstdcxx:
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+    if (Type==ToolChain::CST_MacPortsLibstdcxx && getVFS().exists("@@MACPORTS_libstdc++@@")) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      CmdArgs.push_back("@@MACPORTS_libstdc++@@");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      return;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    CmdArgs.push_back("@@MACPORTS_libstdc++@@");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    break;
</span> +
<span style='display:block; white-space:pre;background:#e0ffe0;'>+   case ToolChain::CST_Libstdcxx:
</span>      // Unfortunately, -lstdc++ doesn't always exist in the standard search path;
      // it was previously found in the gcc lib dir. However, for all the Darwin
<span style='display:block; white-space:pre;background:#ffe0e0;'>-     // platforms we care about it was -lstdc++.6, so we search for that
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Driver/ToolChains/Hexagon.cpp.orig        2020-05-06 08:57:03.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Driver/ToolChains/Hexagon.cpp      2020-05-07 12:43:10.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -639,6 +639,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index fb54f73bcd4c..0260a32096af 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- a/tools/clang/lib/Driver/ToolChains/Hexagon.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ b/tools/clang/lib/Driver/ToolChains/Hexagon.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -641,6 +641,8 @@ HexagonToolChain::GetCXXStdlibType(const ArgList &Args) const {
</span>        return ToolChain::CST_Libstdcxx;
    }
    StringRef Value = A->getValue();
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  if (Value == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  if (Value == "macports-libstdc++" || Value == "libstdc++_macports")
</span> +    return ToolChain::CST_MacPortsLibstdcxx;
    if (Value != "libstdc++" && Value != "libc++")
      getDriver().Diag(diag::err_drv_invalid_stdlib_name) << A->getAsString(Args);
<span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git a/clang/lib/Frontend/InitHeaderSearch.cpp b/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index bc31445d6d08..abc3750edec0 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- a/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ b/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -108,7 +108,7 @@ static bool CanPrefixSysroot(StringRef Path) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if defined(_WIN32)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-  return llvm::sys::path::is_absolute(Path);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  return llvm::sys::path::is_absolute(Path) && Path.find("@@MACPORTS_GCC_INCLUDE_DIR@@")!=0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span>  
<span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -766,6 +766,8 @@ ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return ToolChain::CST_Libcxx;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   else if (LibName == "libstdc++")
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return ToolChain::CST_Libstdcxx;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  else if (LibName == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    return ToolChain::CST_MacPortsLibstdcxx;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   else if (LibName == "platform")
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return GetDefaultCXXStdlibType();
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -847,6 +849,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     break;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   case ToolChain::CST_Libstdcxx:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  case ToolChain::CST_MacPortsLibstdcxx:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     CmdArgs.push_back("-lstdc++");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     break;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-- 
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+2.21.1 (Apple Git-122.3)
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-12/Portfile b/lang/llvm-12/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index b7de4b9a2b9..0fd08ef1069 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-12/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-12/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -32,8 +32,8 @@ distname                llvm-project-${version}.src
</span> use_xz                  yes
 
 name                    llvm-${llvm_version}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-revision                2
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-subport                 clang-${llvm_version} {revision 0}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+revision                3
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+subport                 clang-${llvm_version} {revision 1}
</span> subport                 lldb-${llvm_version}  {revision 1}
 dist_subdir             llvm
 set suffix              mp-${llvm_version}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -117,6 +117,7 @@ patchfiles-append \
</span>     0013-clang-add-back-runtime-libraries-used-on-10.4-and-10.patch \
     0014-Fix-float.h-to-work-on-Snow-Leopard-and-earlier.patch \
     0015-Fixup-libstdc-header-search-paths-for-older-versions.patch \
<span style='display:block; white-space:pre;background:#e0ffe0;'>+    0019-10.6-and-less-use-emulated-TLS-before-10.7.patch \
</span>     0025-lldb-add-defines-needed-for-older-SDKs.patch \
     0026-compiler-rt-parallel-D106305.patch
 
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -128,7 +129,6 @@ if {${os.platform} eq "darwin" && ${os.major} < 14} {
</span> if {${os.platform} eq "darwin" && ${os.major} < 11} {
     patchfiles-append \
         0017-10.6-and-less-libcxx-work-around-no-reexported_symbo.patch \
<span style='display:block; white-space:pre;background:#ffe0e0;'>-        0019-10.6-and-less-use-emulated-TLS-before-10.7.patch \
</span>         0020-10.6-and-less-work-around-no-directory-watcher-befor.patch \
         0021-10.6-and-less-libcxx-disable-Availability-tests.patch
 }
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -407,65 +407,56 @@ if {${subport} eq "clang-${llvm_version}"} {
</span>         default_variants-append +defaultlibcxx
     }
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    variant libstdcxx description {-stdlib=macports-libstdc++ searches for MacPorts libstdc++} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    variant libstdcxx description {-stdlib=libstdc++_macports searches for MacPorts libstdc++} {
</span> 
         patchfiles-append 0005-clang-support-macports-libstdcxx.patch
 
         post-patch {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+            if { ${configure.build_arch} eq "arm64" } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                # see https://github.com/macports/macports-ports/commit/be1e11a368f672d927a7bdb381f2fa71a79ba483
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                set gcc_arch    aarch64
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                set gcc_arch    ${configure.build_arch}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span>             reinplace "s|@@MACPORTS_GCC_INCLUDE_DIR@@|${prefix}/include/gcc/c++|g" \
                 ${patch.dir}/clang/lib/Frontend/InitHeaderSearch.cpp \
                 ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_HOST_NAME@@|${build_arch}-apple-darwin${os.major}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            reinplace "s|@@MACPORTS_HOST_NAME@@|${gcc_arch}-apple-darwin${os.major}|g" \
</span>                 ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
             reinplace "s|@@MACPORTS_libstdc++@@|${prefix}/lib/libgcc/libstdc++.6.dylib|g" \
                 ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # GCC was built for ${build_arch}-apple-darwin${os.major}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # GCC was built for ${configure.build_arch}-apple-darwin${os.major}
</span>             # if GCC was also built universal, it has an extra include directory
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # MacPorts GCC can not compile across platforms
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            switch ${build_arch} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # MacPorts GCC cannot compile across platforms
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            switch ${configure.build_arch} {
</span>                 x86_64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   "i386"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::x86_64 ? "" : "i386"|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
                 i386 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::x86_64 ? "x86_64" : ""|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
                 ppc64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    "ppc"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::ppc64 ? "" : "ppc"|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
                 ppc {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::ppc64 ? "ppc64" : ""|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                arm64 {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|""|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
             }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@|${gcc_subdirectory_x86_64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_i386@@|${gcc_subdirectory_i386}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@|${gcc_subdirectory_ppc64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc@@|${gcc_subdirectory_ppc}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span>         }
     }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    # at present, only the non-arm archs can use this variant
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    if {${build_arch} in "x86_64 i386 ppc64 ppc"} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        default_variants-append +libstdcxx
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    default_variants-append +libstdcxx
</span> }
 
 livecheck.type      regex
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-12/files/0005-clang-support-macports-libstdcxx.patch b/lang/llvm-12/files/0005-clang-support-macports-libstdcxx.patch
</span><span style='display:block; white-space:pre;color:#808080;'>index 96a3de0add7..c31359fdf87 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-12/files/0005-clang-support-macports-libstdcxx.patch
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-12/files/0005-clang-support-macports-libstdcxx.patch
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -5,11 +5,9 @@ Subject: [PATCH 05/24] clang: support macports-libstdcxx
</span> requires reinplace of search paths
 ---
  clang/include/clang/Driver/ToolChain.h        |  3 +-
<span style='display:block; white-space:pre;background:#ffe0e0;'>- clang/include/clang/Lex/HeaderSearchOptions.h |  3 ++
</span>  clang/lib/Driver/ToolChain.cpp                |  3 ++
  clang/lib/Driver/ToolChains/Darwin.cpp        | 40 ++++++++++++++-----
  clang/lib/Driver/ToolChains/Hexagon.cpp       |  2 +
<span style='display:block; white-space:pre;background:#ffe0e0;'>- clang/lib/Frontend/CompilerInvocation.cpp.rej | 21 ++++++++++
</span>  clang/lib/Frontend/InitHeaderSearch.cpp       |  2 +-
  7 files changed, 63 insertions(+), 11 deletions(-)
  create mode 100644 clang/lib/Frontend/CompilerInvocation.cpp.rej
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -18,44 +16,28 @@ diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver
</span> index 28c37a44e1eb..78fcaec7bfb0 100644
 --- a/clang/include/clang/Driver/ToolChain.h
 +++ b/clang/include/clang/Driver/ToolChain.h
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -94,7 +94,8 @@ public:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -94,6 +94,7 @@ public:
</span>  
    enum CXXStdlibType {
      CST_Libcxx,
<span style='display:block; white-space:pre;background:#ffe0e0;'>--    CST_Libstdcxx
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_Libstdcxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_MacPortsLibstdcxx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    CST_MacPortsLibstdcxx,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CST_Libstdcxx
</span>    };
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   enum RuntimeLibType {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-diff --git a/clang/include/clang/Lex/HeaderSearchOptions.h b/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-index 42f3cff8c57a..97a01793c12c 100644
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- a/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ b/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -189,6 +189,9 @@ public:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   /// Use libc++ instead of the default libstdc++.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   unsigned UseLibcxx : 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  /// Use MacPorts libstdc++ instead of default system libstdc++.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  unsigned UseMacPortsLibstdcxx : 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   /// Whether header search information should be output as for -v.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   unsigned Verbose : 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span> diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
 index b2ddef141a75..6160843b6885 100644
 --- a/clang/lib/Driver/ToolChain.cpp
 +++ b/clang/lib/Driver/ToolChain.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -926,6 +926,8 @@ ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -926,6 +926,8 @@
</span>      return ToolChain::CST_Libcxx;
    else if (LibName == "libstdc++")
      return ToolChain::CST_Libstdcxx;
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  else if (LibName == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  else if (LibName == "macports-libstdc++" || LibName == "libstdc++_macports")
</span> +    return ToolChain::CST_MacPortsLibstdcxx;
    else if (LibName == "platform")
      return GetDefaultCXXStdlibType();
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1017,6 +1019,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1017,6 +1019,7 @@
</span>      break;
  
    case ToolChain::CST_Libstdcxx:
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -67,82 +49,35 @@ diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChain
</span> index eb7bd4aec898..daa8e520e404 100644
 --- a/clang/lib/Driver/ToolChains/Darwin.cpp
 +++ b/clang/lib/Driver/ToolChains/Darwin.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2039,8 +2039,9 @@ void DarwinClang::AddClangCXXStdlibIncludeArgs(
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   llvm::StringRef Sysroot = GetHeaderSysroot(DriverArgs);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  CXXStdlibType Type = GetCXXStdlibType(DriverArgs);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--  switch (GetCXXStdlibType(DriverArgs)) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  switch (Type) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   case ToolChain::CST_Libcxx: {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     // On Darwin, libc++ can be installed in one of the following two places:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     // 1. Alongside the compiler in         <install>/include/c++/v1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2082,6 +2083,7 @@ void DarwinClang::AddClangCXXStdlibIncludeArgs(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -2087,6 +2087,16 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     break;
</span>    }
  
<span style='display:block; white-space:pre;background:#e0ffe0;'>++  case ToolChain::CST_MacPortsLibstdcxx: {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    bool IsBaseFoundMacPorts = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, llvm::StringRef("@@MACPORTS_GCC_INCLUDE_DIR@@"),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                             "",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                             "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                             @@MACPORTS_TEST_32_64@@);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    if (!IsBaseFoundMacPorts) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++      getDriver().Diag(diag::warn_drv_libstdcxx_not_found);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    }}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span>    case ToolChain::CST_Libstdcxx:
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  case ToolChain::CST_MacPortsLibstdcxx:
</span>      llvm::SmallString<128> UsrIncludeCxx = Sysroot;
      llvm::sys::path::append(UsrIncludeCxx, "usr", "include", "c++");
<span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2092,10 +2094,17 @@ void DarwinClang::AddClangCXXStdlibIncludeArgs(
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--      IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "powerpc-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                arch == llvm::Triple::ppc64 ? "ppc64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound = false;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (Type==ToolChain::CST_MacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, llvm::StringRef("@@MACPORTS_GCC_INCLUDE_DIR@@"),
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  arch == llvm::Triple::ppc64 ? "@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@" : "@@MACPORTS_GCC_SUBDIRECTORY_ppc@@");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "powerpc-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 arch == llvm::Triple::ppc64 ? "ppc64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                 "4.0.0", "powerpc-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                  arch == llvm::Triple::ppc64 ? "ppc64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2103,10 +2112,17 @@ void DarwinClang::AddClangCXXStdlibIncludeArgs(
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86_64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--      IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "i686-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                arch == llvm::Triple::x86_64 ? "x86_64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound = false;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (Type==ToolChain::CST_MacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, llvm::StringRef("@@MACPORTS_GCC_INCLUDE_DIR@@"),
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  arch == llvm::Triple::x86_64 ? "@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@" : "@@MACPORTS_GCC_SUBDIRECTORY_i386@@");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "i686-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 arch == llvm::Triple::x86_64 ? "x86_64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                 "4.0.0", "i686-apple-darwin8",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                  "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2149,6 +2165,12 @@ void DarwinClang::AddCXXStdlibLibArgs(const ArgList &Args,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -2154,6 +2164,10 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CmdArgs.push_back("-lc++");
</span>      break;
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   case ToolChain::CST_Libstdcxx:
</span> +  case ToolChain::CST_MacPortsLibstdcxx:
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+    if (Type==ToolChain::CST_MacPortsLibstdcxx && getVFS().exists("@@MACPORTS_libstdc++@@")) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      CmdArgs.push_back("@@MACPORTS_libstdc++@@");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      return;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    CmdArgs.push_back("@@MACPORTS_libstdc++@@");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    break;
</span> +
<span style='display:block; white-space:pre;background:#e0ffe0;'>+   case ToolChain::CST_Libstdcxx:
</span>      // Unfortunately, -lstdc++ doesn't always exist in the standard search path;
      // it was previously found in the gcc lib dir. However, for all the Darwin
<span style='display:block; white-space:pre;background:#ffe0e0;'>-     // platforms we care about it was -lstdc++.6, so we search for that
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp
 index fb54f73bcd4c..0260a32096af 100644
 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -151,38 +86,11 @@ index fb54f73bcd4c..0260a32096af 100644
</span>        return ToolChain::CST_Libstdcxx;
    }
    StringRef Value = A->getValue();
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  if (Value == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  if (Value == "macports-libstdc++" || Value == "libstdc++_macports")
</span> +    return ToolChain::CST_MacPortsLibstdcxx;
    if (Value != "libstdc++" && Value != "libc++")
      getDriver().Diag(diag::err_drv_invalid_stdlib_name) << A->getAsString(Args);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-diff --git a/clang/lib/Frontend/CompilerInvocation.cpp.rej b/clang/lib/Frontend/CompilerInvocation.cpp.rej
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-new file mode 100644
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-index 000000000000..227618c333c4
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- /dev/null
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ b/clang/lib/Frontend/CompilerInvocation.cpp.rej
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -0,0 +1,21 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+***************
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+*** 2939,2946 ****
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  #include "clang/Driver/Options.inc"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  #undef HEADER_SEARCH_OPTION_WITH_MARSHALLING
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+-   if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ))
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    // Canonicalize -fmodules-cache-path before storing it.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    SmallString<128> P(Args.getLastArgValue(OPT_fmodules_cache_path));
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+--- 2939,2948 ----
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  #include "clang/Driver/Options.inc"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  #undef HEADER_SEARCH_OPTION_WITH_MARSHALLING
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-++   if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ)) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-++     Opts.UseMacPortsLibstdcxx = (strcmp(A->getValue(), "macports-libstdc++") == 0);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-++   }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    // Canonicalize -fmodules-cache-path before storing it.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    SmallString<128> P(Args.getLastArgValue(OPT_fmodules_cache_path));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> diff --git a/clang/lib/Frontend/InitHeaderSearch.cpp b/clang/lib/Frontend/InitHeaderSearch.cpp
 index bc31445d6d08..abc3750edec0 100644
 --- a/clang/lib/Frontend/InitHeaderSearch.cpp
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -198,4 +106,3 @@ index bc31445d6d08..abc3750edec0 100644
</span>  
 -- 
 2.21.1 (Apple Git-122.3)
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-13/Portfile b/lang/llvm-13/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 20fdf7574a3..2ee5404e6fa 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-13/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-13/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -25,9 +25,9 @@ set llvm_version        13
</span> version                 ${llvm_version}.0.1
 
 name                    llvm-${llvm_version}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-revision                1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+revision                2
</span> subport                 mlir-${llvm_version}  { revision 0 }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-subport                 clang-${llvm_version} { revision 0 }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+subport                 clang-${llvm_version} { revision 1 }
</span> subport                 lldb-${llvm_version}  { revision 0 }
 subport                 flang-${llvm_version} { revision 0 }
 
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -127,6 +127,7 @@ patchfiles-append \
</span>     0013-clang-add-back-runtime-libraries-used-on-10.4-and-10.patch \
     0014-Fix-float.h-to-work-on-Snow-Leopard-and-earlier.patch \
     0015-Fixup-libstdc-header-search-paths-for-older-versions.patch \
<span style='display:block; white-space:pre;background:#e0ffe0;'>+    0019-10.6-and-less-use-emulated-TLS-before-10.7.patch \
</span>     0025-lldb-add-defines-needed-for-older-SDKs.patch
 
 if {${os.platform} eq "darwin" && ${os.major} < 14} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -137,7 +138,6 @@ if {${os.platform} eq "darwin" && ${os.major} < 14} {
</span> if {${os.platform} eq "darwin" && ${os.major} < 11} {
     patchfiles-append \
         0017-10.6-and-less-libcxx-work-around-no-reexported_symbo.patch \
<span style='display:block; white-space:pre;background:#ffe0e0;'>-        0019-10.6-and-less-use-emulated-TLS-before-10.7.patch \
</span>         0020-10.6-and-less-work-around-no-directory-watcher-befor.patch \
         0021-10.6-and-less-libcxx-disable-Availability-tests.patch
 }
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -477,65 +477,56 @@ if {${subport} eq "clang-${llvm_version}"} {
</span>         default_variants-append +defaultlibcxx
     }
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    variant libstdcxx description {-stdlib=macports-libstdc++ searches for MacPorts libstdc++} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    variant libstdcxx description {-stdlib=libstdc++_macports searches for MacPorts libstdc++} {
</span> 
         patchfiles-append 0005-clang-support-macports-libstdcxx.patch
 
         post-patch {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+            if { ${configure.build_arch} eq "arm64" } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                # see https://github.com/macports/macports-ports/commit/be1e11a368f672d927a7bdb381f2fa71a79ba483
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                set gcc_arch    aarch64
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                set gcc_arch    ${configure.build_arch}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span>             reinplace "s|@@MACPORTS_GCC_INCLUDE_DIR@@|${prefix}/include/gcc/c++|g" \
                 ${patch.dir}/clang/lib/Frontend/InitHeaderSearch.cpp \
                 ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_HOST_NAME@@|${build_arch}-apple-darwin${os.major}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            reinplace "s|@@MACPORTS_HOST_NAME@@|${gcc_arch}-apple-darwin${os.major}|g" \
</span>                 ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
             reinplace "s|@@MACPORTS_libstdc++@@|${prefix}/lib/libgcc/libstdc++.6.dylib|g" \
                 ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # GCC was built for ${build_arch}-apple-darwin${os.major}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # GCC was built for ${configure.build_arch}-apple-darwin${os.major}
</span>             # if GCC was also built universal, it has an extra include directory
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # MacPorts GCC can not compile across platforms
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            switch ${build_arch} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # MacPorts GCC cannot compile across platforms
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            switch ${configure.build_arch} {
</span>                 x86_64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   "i386"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::x86_64 ? "" : "i386"|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
                 i386 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::x86_64 ? "x86_64" : ""|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
                 ppc64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    "ppc"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::ppc64 ? "" : "ppc"|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
                 ppc {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::ppc64 ? "ppc64" : ""|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                arm64 {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|""|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
             }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@|${gcc_subdirectory_x86_64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_i386@@|${gcc_subdirectory_i386}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@|${gcc_subdirectory_ppc64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc@@|${gcc_subdirectory_ppc}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span>         }
     }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    # at present, only the non-arm archs can use this variant
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    if {${build_arch} in "x86_64 i386 ppc64 ppc"} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        default_variants-append +libstdcxx
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    default_variants-append +libstdcxx
</span> }
 
 livecheck.type      regex
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-13/files/0005-clang-support-macports-libstdcxx.patch b/lang/llvm-13/files/0005-clang-support-macports-libstdcxx.patch
</span><span style='display:block; white-space:pre;color:#808080;'>index af3794c4457..ddd92d8469f 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-13/files/0005-clang-support-macports-libstdcxx.patch
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-13/files/0005-clang-support-macports-libstdcxx.patch
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -5,11 +5,9 @@ Subject: [PATCH 05/24] clang: support macports-libstdcxx
</span> requires reinplace of search paths
 ---
  clang/include/clang/Driver/ToolChain.h        |  3 +-
<span style='display:block; white-space:pre;background:#ffe0e0;'>- clang/include/clang/Lex/HeaderSearchOptions.h |  3 ++
</span>  clang/lib/Driver/ToolChain.cpp                |  3 ++
  clang/lib/Driver/ToolChains/Darwin.cpp        | 40 ++++++++++++++-----
  clang/lib/Driver/ToolChains/Hexagon.cpp       |  2 +
<span style='display:block; white-space:pre;background:#ffe0e0;'>- clang/lib/Frontend/CompilerInvocation.cpp.rej | 21 ++++++++++
</span>  clang/lib/Frontend/InitHeaderSearch.cpp       |  2 +-
  7 files changed, 63 insertions(+), 11 deletions(-)
  create mode 100644 clang/lib/Frontend/CompilerInvocation.cpp.rej
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -18,45 +16,28 @@ diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver
</span> index 28c37a44e1eb..78fcaec7bfb0 100644
 --- a/clang/include/clang/Driver/ToolChain.h
 +++ b/clang/include/clang/Driver/ToolChain.h
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -94,7 +94,8 @@ public:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -94,6 +94,7 @@ public:
</span>  
    enum CXXStdlibType {
      CST_Libcxx,
<span style='display:block; white-space:pre;background:#ffe0e0;'>--    CST_Libstdcxx
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_Libstdcxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_MacPortsLibstdcxx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    CST_MacPortsLibstdcxx,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CST_Libstdcxx
</span>    };
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   enum RuntimeLibType {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-diff --git a/clang/include/clang/Lex/HeaderSearchOptions.h b/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-index 42f3cff8c57a..97a01793c12c 100644
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- a/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ b/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -189,6 +189,9 @@ public:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   /// Use libc++ instead of the default libstdc++.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   unsigned UseLibcxx : 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  /// Use MacPorts libstdc++ instead of default system libstdc++.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  unsigned UseMacPortsLibstdcxx : 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   /// Whether header search information should be output as for -v.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   unsigned Verbose : 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span> diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
 index b2ddef141a75..6160843b6885 100644
 --- a/clang/lib/Driver/ToolChain.cpp
 +++ b/clang/lib/Driver/ToolChain.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -826,7 +826,9 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -826,6 +826,8 @@
</span>      cxxStdlibType = ToolChain::CST_Libcxx;
    else if (LibName == "libstdc++")
      cxxStdlibType = ToolChain::CST_Libstdcxx;
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  else if (LibName == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  else if (LibName == "macports-libstdc++" || LibName == "libstdc++_macports")
</span> +    cxxStdlibType = ToolChain::CST_MacPortsLibstdcxx;
    else if (LibName == "platform")
      cxxStdlibType = GetDefaultCXXStdlibType();
    else {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1017,6 +1019,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -945,6 +947,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
</span>      break;
  
    case ToolChain::CST_Libstdcxx:
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -68,127 +49,53 @@ diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChain
</span> index eb7bd4aec898..daa8e520e404 100644
 --- a/clang/lib/Driver/ToolChains/Darwin.cpp
 +++ b/clang/lib/Driver/ToolChains/Darwin.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2039,8 +2039,9 @@ void DarwinClang::AddClangCXXStdlibIncludeArgs(
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   llvm::StringRef Sysroot = GetHeaderSysroot(DriverArgs);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  CXXStdlibType Type = GetCXXStdlibType(DriverArgs);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--  switch (GetCXXStdlibType(DriverArgs)) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  switch (Type) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   case ToolChain::CST_Libcxx: {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     // On Darwin, libc++ can be installed in one of the following two places:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     // 1. Alongside the compiler in         <install>/include/c++/v1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2082,6 +2083,7 @@ void DarwinClang::AddClangCXXStdlibIncludeArgs(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -2161,6 +2161,16 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     break;
</span>    }
  
<span style='display:block; white-space:pre;background:#e0ffe0;'>++  case ToolChain::CST_MacPortsLibstdcxx: {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    bool IsBaseFoundMacPorts = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, llvm::StringRef("@@MACPORTS_GCC_INCLUDE_DIR@@"),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                             "",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                             "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                             @@MACPORTS_TEST_32_64@@);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    if (!IsBaseFoundMacPorts) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++      getDriver().Diag(diag::warn_drv_libstdcxx_not_found);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    }}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span>    case ToolChain::CST_Libstdcxx:
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  case ToolChain::CST_MacPortsLibstdcxx:
</span>      llvm::SmallString<128> UsrIncludeCxx = Sysroot;
      llvm::sys::path::append(UsrIncludeCxx, "usr", "include", "c++");
<span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2092,10 +2094,17 @@ void DarwinClang::AddClangCXXStdlibIncludeArgs(
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--      IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "powerpc-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                arch == llvm::Triple::ppc64 ? "ppc64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound = false;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (Type==ToolChain::CST_MacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, llvm::StringRef("@@MACPORTS_GCC_INCLUDE_DIR@@"),
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  arch == llvm::Triple::ppc64 ? "@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@" : "@@MACPORTS_GCC_SUBDIRECTORY_ppc@@");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "powerpc-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 arch == llvm::Triple::ppc64 ? "ppc64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                 "4.0.0", "powerpc-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                  arch == llvm::Triple::ppc64 ? "ppc64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2103,10 +2112,17 @@ void DarwinClang::AddClangCXXStdlibIncludeArgs(
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86_64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--      IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "i686-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                arch == llvm::Triple::x86_64 ? "x86_64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound = false;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (Type==ToolChain::CST_MacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, llvm::StringRef("@@MACPORTS_GCC_INCLUDE_DIR@@"),
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  arch == llvm::Triple::x86_64 ? "@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@" : "@@MACPORTS_GCC_SUBDIRECTORY_i386@@");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "i686-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 arch == llvm::Triple::x86_64 ? "x86_64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                 "4.0.0", "i686-apple-darwin8",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                  "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2149,6 +2165,12 @@ void DarwinClang::AddCXXStdlibLibArgs(const ArgList &Args,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -2228,6 +2238,10 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CmdArgs.push_back("-lc++");
</span>      break;
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   case ToolChain::CST_Libstdcxx:
</span> +  case ToolChain::CST_MacPortsLibstdcxx:
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+    if (Type==ToolChain::CST_MacPortsLibstdcxx && getVFS().exists("@@MACPORTS_libstdc++@@")) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      CmdArgs.push_back("@@MACPORTS_libstdc++@@");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      return;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    CmdArgs.push_back("@@MACPORTS_libstdc++@@");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    break;
</span> +
<span style='display:block; white-space:pre;background:#e0ffe0;'>+   case ToolChain::CST_Libstdcxx:
</span>      // Unfortunately, -lstdc++ doesn't always exist in the standard search path;
      // it was previously found in the gcc lib dir. However, for all the Darwin
<span style='display:block; white-space:pre;background:#ffe0e0;'>-     // platforms we care about it was -lstdc++.6, so we search for that
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp
 index fb54f73bcd4c..0260a32096af 100644
 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp
 +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -643,6 +643,8 @@ HexagonToolChain::GetCXXStdlibType(const ArgList &Args) const {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -665,6 +665,8 @@ HexagonToolChain::GetCXXStdlibType(const ArgList &Args) const {
</span>        return ToolChain::CST_Libstdcxx;
    }
    StringRef Value = A->getValue();
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  if (Value == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  if (Value == "macports-libstdc++" || Value == "libstdc++_macports")
</span> +    return ToolChain::CST_MacPortsLibstdcxx;
    if (Value != "libstdc++" && Value != "libc++")
      getDriver().Diag(diag::err_drv_invalid_stdlib_name) << A->getAsString(Args);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-diff --git a/clang/lib/Frontend/CompilerInvocation.cpp.rej b/clang/lib/Frontend/CompilerInvocation.cpp.rej
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-new file mode 100644
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-index 000000000000..227618c333c4
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- /dev/null
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ b/clang/lib/Frontend/CompilerInvocation.cpp.rej
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -0,0 +1,21 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+***************
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+*** 2939,2946 ****
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  #include "clang/Driver/Options.inc"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  #undef HEADER_SEARCH_OPTION_WITH_MARSHALLING
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+-   if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ))
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    // Canonicalize -fmodules-cache-path before storing it.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    SmallString<128> P(Args.getLastArgValue(OPT_fmodules_cache_path));
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+--- 2939,2948 ----
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  #include "clang/Driver/Options.inc"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  #undef HEADER_SEARCH_OPTION_WITH_MARSHALLING
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-++   if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ)) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-++     Opts.UseMacPortsLibstdcxx = (strcmp(A->getValue(), "macports-libstdc++") == 0);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-++   }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    // Canonicalize -fmodules-cache-path before storing it.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    SmallString<128> P(Args.getLastArgValue(OPT_fmodules_cache_path));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> diff --git a/clang/lib/Frontend/InitHeaderSearch.cpp b/clang/lib/Frontend/InitHeaderSearch.cpp
 index bc31445d6d08..abc3750edec0 100644
 --- a/clang/lib/Frontend/InitHeaderSearch.cpp
 +++ b/clang/lib/Frontend/InitHeaderSearch.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -108,7 +108,7 @@ static bool CanPrefixSysroot(StringRef Path) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -114,7 +114,7 @@ static bool CanPrefixSysroot(StringRef Path) {
</span>  #if defined(_WIN32)
    return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
  #else
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -199,4 +106,3 @@ index bc31445d6d08..abc3750edec0 100644
</span>  
 -- 
 2.21.1 (Apple Git-122.3)
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-14/Portfile b/lang/llvm-14/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 23cc9dc877c..045a0c11877 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-14/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-14/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -25,9 +25,9 @@ set llvm_version        14
</span> version                 ${llvm_version}.0.1
 
 name                    llvm-${llvm_version}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-revision                0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+revision                1
</span> subport                 mlir-${llvm_version}  { revision 0 }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-subport                 clang-${llvm_version} { revision 0 }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+subport                 clang-${llvm_version} { revision 1 }
</span> subport                 lldb-${llvm_version}  { revision 0 }
 subport                 flang-${llvm_version} { revision 0 }
 
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -133,6 +133,7 @@ patchfiles-append \
</span>     0013-clang-add-back-runtime-libraries-used-on-10.4-and-10.patch \
     0014-Fix-float.h-to-work-on-Snow-Leopard-and-earlier.patch \
     0015-Fixup-libstdc-header-search-paths-for-older-versions.patch \
<span style='display:block; white-space:pre;background:#e0ffe0;'>+    0019-10.6-and-less-use-emulated-TLS-before-10.7.patch \
</span>     0025-lldb-add-defines-needed-for-older-SDKs.patch
 
 if {${os.platform} eq "darwin" && ${os.major} < 14} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -143,7 +144,6 @@ if {${os.platform} eq "darwin" && ${os.major} < 14} {
</span> if {${os.platform} eq "darwin" && ${os.major} < 11} {
     patchfiles-append \
         0017-10.6-and-less-libcxx-work-around-no-reexported_symbo.patch \
<span style='display:block; white-space:pre;background:#ffe0e0;'>-        0019-10.6-and-less-use-emulated-TLS-before-10.7.patch \
</span>         0020-10.6-and-less-work-around-no-directory-watcher-befor.patch \
         0021-10.6-and-less-libcxx-disable-Availability-tests.patch
 }
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -492,65 +492,56 @@ if {${subport} eq "clang-${llvm_version}"} {
</span>         default_variants-append +defaultlibcxx
     }
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    variant libstdcxx description {-stdlib=macports-libstdc++ searches for MacPorts libstdc++} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    variant libstdcxx description {-stdlib=libstdc++_macports searches for MacPorts libstdc++} {
</span> 
         patchfiles-append 0005-clang-support-macports-libstdcxx.patch
 
         post-patch {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+            if { ${configure.build_arch} eq "arm64" } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                # see https://github.com/macports/macports-ports/commit/be1e11a368f672d927a7bdb381f2fa71a79ba483
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                set gcc_arch    aarch64
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                set gcc_arch    ${configure.build_arch}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span>             reinplace "s|@@MACPORTS_GCC_INCLUDE_DIR@@|${prefix}/include/gcc/c++|g" \
                 ${patch.dir}/clang/lib/Lex/InitHeaderSearch.cpp \
                 ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_HOST_NAME@@|${build_arch}-apple-darwin${os.major}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            reinplace "s|@@MACPORTS_HOST_NAME@@|${gcc_arch}-apple-darwin${os.major}|g" \
</span>                 ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
             reinplace "s|@@MACPORTS_libstdc++@@|${prefix}/lib/libgcc/libstdc++.6.dylib|g" \
                 ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # GCC was built for ${build_arch}-apple-darwin${os.major}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # GCC was built for ${configure.build_arch}-apple-darwin${os.major}
</span>             # if GCC was also built universal, it has an extra include directory
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # MacPorts GCC can not compile across platforms
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            switch ${build_arch} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # MacPorts GCC cannot compile across platforms
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            switch ${configure.build_arch} {
</span>                 x86_64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   "i386"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::x86_64 ? "" : "i386"|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
                 i386 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::x86_64 ? "x86_64" : ""|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
                 ppc64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    "ppc"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::ppc64 ? "" : "ppc"|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
                 ppc {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::ppc64 ? "ppc64" : ""|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                arm64 {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|""|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
             }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@|${gcc_subdirectory_x86_64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_i386@@|${gcc_subdirectory_i386}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@|${gcc_subdirectory_ppc64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc@@|${gcc_subdirectory_ppc}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span>         }
     }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    # at present, only the non-arm archs can use this variant
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    if {${build_arch} in "x86_64 i386 ppc64 ppc"} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        default_variants-append +libstdcxx
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    default_variants-append +libstdcxx
</span> }
 
 livecheck.type      regex
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-14/files/0005-clang-support-macports-libstdcxx.patch b/lang/llvm-14/files/0005-clang-support-macports-libstdcxx.patch
</span><span style='display:block; white-space:pre;color:#808080;'>index 4b581642180..cd5cee0c407 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-14/files/0005-clang-support-macports-libstdcxx.patch
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-14/files/0005-clang-support-macports-libstdcxx.patch
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -5,12 +5,10 @@ Subject: [PATCH 05/24] clang: support macports-libstdcxx
</span> requires reinplace of search paths
 ---
  clang/include/clang/Driver/ToolChain.h        |  3 +-
<span style='display:block; white-space:pre;background:#ffe0e0;'>- clang/include/clang/Lex/HeaderSearchOptions.h |  3 ++
</span>  clang/lib/Driver/ToolChain.cpp                |  3 ++
  clang/lib/Driver/ToolChains/Darwin.cpp        | 40 ++++++++++++++-----
  clang/lib/Driver/ToolChains/Hexagon.cpp       |  2 +
<span style='display:block; white-space:pre;background:#ffe0e0;'>- clang/lib/Frontend/CompilerInvocation.cpp.rej | 21 ++++++++++
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- clang/lib/Frontend/InitHeaderSearch.cpp       |  2 +-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ clang/lib/Lex/InitHeaderSearch.cpp       |  2 +-
</span>  7 files changed, 63 insertions(+), 11 deletions(-)
  create mode 100644 clang/lib/Frontend/CompilerInvocation.cpp.rej
 
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -18,45 +16,28 @@ diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver
</span> index 28c37a44e1eb..78fcaec7bfb0 100644
 --- a/clang/include/clang/Driver/ToolChain.h
 +++ b/clang/include/clang/Driver/ToolChain.h
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -94,7 +94,8 @@ public:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -94,6 +94,7 @@ public:
</span>  
    enum CXXStdlibType {
      CST_Libcxx,
<span style='display:block; white-space:pre;background:#ffe0e0;'>--    CST_Libstdcxx
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_Libstdcxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_MacPortsLibstdcxx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    CST_MacPortsLibstdcxx,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CST_Libstdcxx
</span>    };
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   enum RuntimeLibType {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-diff --git a/clang/include/clang/Lex/HeaderSearchOptions.h b/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-index 42f3cff8c57a..97a01793c12c 100644
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- a/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ b/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -189,6 +189,9 @@ public:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   /// Use libc++ instead of the default libstdc++.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   unsigned UseLibcxx : 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  /// Use MacPorts libstdc++ instead of default system libstdc++.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  unsigned UseMacPortsLibstdcxx : 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   /// Whether header search information should be output as for -v.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   unsigned Verbose : 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span> diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
 index b2ddef141a75..6160843b6885 100644
 --- a/clang/lib/Driver/ToolChain.cpp
 +++ b/clang/lib/Driver/ToolChain.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -826,7 +826,9 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -850,6 +850,8 @@
</span>      cxxStdlibType = ToolChain::CST_Libcxx;
    else if (LibName == "libstdc++")
      cxxStdlibType = ToolChain::CST_Libstdcxx;
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  else if (LibName == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  else if (LibName == "macports-libstdc++" || LibName == "libstdc++_macports")
</span> +    cxxStdlibType = ToolChain::CST_MacPortsLibstdcxx;
    else if (LibName == "platform")
      cxxStdlibType = GetDefaultCXXStdlibType();
    else {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1017,6 +1019,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -969,6 +971,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
</span>      break;
  
    case ToolChain::CST_Libstdcxx:
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -68,127 +49,53 @@ diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChain
</span> index eb7bd4aec898..daa8e520e404 100644
 --- a/clang/lib/Driver/ToolChains/Darwin.cpp
 +++ b/clang/lib/Driver/ToolChains/Darwin.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2039,8 +2039,9 @@ void DarwinClang::AddClangCXXStdlibIncludeArgs(
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   llvm::StringRef Sysroot = GetHeaderSysroot(DriverArgs);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  CXXStdlibType Type = GetCXXStdlibType(DriverArgs);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--  switch (GetCXXStdlibType(DriverArgs)) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  switch (Type) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   case ToolChain::CST_Libcxx: {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     // On Darwin, libc++ can be installed in one of the following two places:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     // 1. Alongside the compiler in         <install>/include/c++/v1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2082,6 +2083,7 @@ void DarwinClang::AddClangCXXStdlibIncludeArgs(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -2282,6 +2282,16 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     break;
</span>    }
  
<span style='display:block; white-space:pre;background:#e0ffe0;'>++  case ToolChain::CST_MacPortsLibstdcxx: {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    bool IsBaseFoundMacPorts = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, llvm::StringRef("@@MACPORTS_GCC_INCLUDE_DIR@@"),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                             "",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                             "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                             @@MACPORTS_TEST_32_64@@);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    if (!IsBaseFoundMacPorts) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++      getDriver().Diag(diag::warn_drv_libstdcxx_not_found);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    }}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span>    case ToolChain::CST_Libstdcxx:
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  case ToolChain::CST_MacPortsLibstdcxx:
</span>      llvm::SmallString<128> UsrIncludeCxx = Sysroot;
      llvm::sys::path::append(UsrIncludeCxx, "usr", "include", "c++");
<span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2092,10 +2094,17 @@ void DarwinClang::AddClangCXXStdlibIncludeArgs(
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--      IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "powerpc-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                arch == llvm::Triple::ppc64 ? "ppc64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound = false;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (Type==ToolChain::CST_MacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, llvm::StringRef("@@MACPORTS_GCC_INCLUDE_DIR@@"),
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  arch == llvm::Triple::ppc64 ? "@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@" : "@@MACPORTS_GCC_SUBDIRECTORY_ppc@@");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "powerpc-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 arch == llvm::Triple::ppc64 ? "ppc64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                 "4.0.0", "powerpc-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                  arch == llvm::Triple::ppc64 ? "ppc64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2103,10 +2112,17 @@ void DarwinClang::AddClangCXXStdlibIncludeArgs(
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86_64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--      IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "i686-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                arch == llvm::Triple::x86_64 ? "x86_64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound = false;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (Type==ToolChain::CST_MacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, llvm::StringRef("@@MACPORTS_GCC_INCLUDE_DIR@@"),
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  arch == llvm::Triple::x86_64 ? "@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@" : "@@MACPORTS_GCC_SUBDIRECTORY_i386@@");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "i686-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 arch == llvm::Triple::x86_64 ? "x86_64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                 "4.0.0", "i686-apple-darwin8",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                  "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2149,6 +2165,12 @@ void DarwinClang::AddCXXStdlibLibArgs(const ArgList &Args,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -2349,6 +2360,10 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CmdArgs.push_back("-lc++");
</span>      break;
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   case ToolChain::CST_Libstdcxx:
</span> +  case ToolChain::CST_MacPortsLibstdcxx:
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+    if (Type==ToolChain::CST_MacPortsLibstdcxx && getVFS().exists("@@MACPORTS_libstdc++@@")) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      CmdArgs.push_back("@@MACPORTS_libstdc++@@");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      return;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    CmdArgs.push_back("@@MACPORTS_libstdc++@@");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    break;
</span> +
<span style='display:block; white-space:pre;background:#e0ffe0;'>+   case ToolChain::CST_Libstdcxx:
</span>      // Unfortunately, -lstdc++ doesn't always exist in the standard search path;
      // it was previously found in the gcc lib dir. However, for all the Darwin
<span style='display:block; white-space:pre;background:#ffe0e0;'>-     // platforms we care about it was -lstdc++.6, so we search for that
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp
 index fb54f73bcd4c..0260a32096af 100644
 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp
 +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -643,6 +643,8 @@ HexagonToolChain::GetCXXStdlibType(const ArgList &Args) const {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -758,6 +758,8 @@ HexagonToolChain::GetCXXStdlibType(const ArgList &Args) const {
</span>        return ToolChain::CST_Libstdcxx;
    }
    StringRef Value = A->getValue();
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  if (Value == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  if (Value == "macports-libstdc++" || Value == "libstdc++_macports")
</span> +    return ToolChain::CST_MacPortsLibstdcxx;
    if (Value != "libstdc++" && Value != "libc++")
      getDriver().Diag(diag::err_drv_invalid_stdlib_name) << A->getAsString(Args);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-diff --git a/clang/lib/Frontend/CompilerInvocation.cpp.rej b/clang/lib/Frontend/CompilerInvocation.cpp.rej
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-new file mode 100644
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-index 000000000000..227618c333c4
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- /dev/null
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ b/clang/lib/Frontend/CompilerInvocation.cpp.rej
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -0,0 +1,21 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+***************
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+*** 2939,2946 ****
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  #include "clang/Driver/Options.inc"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  #undef HEADER_SEARCH_OPTION_WITH_MARSHALLING
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+-   if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ))
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    // Canonicalize -fmodules-cache-path before storing it.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    SmallString<128> P(Args.getLastArgValue(OPT_fmodules_cache_path));
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+--- 2939,2948 ----
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  #include "clang/Driver/Options.inc"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  #undef HEADER_SEARCH_OPTION_WITH_MARSHALLING
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-++   if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ)) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-++     Opts.UseMacPortsLibstdcxx = (strcmp(A->getValue(), "macports-libstdc++") == 0);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-++   }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    // Canonicalize -fmodules-cache-path before storing it.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    SmallString<128> P(Args.getLastArgValue(OPT_fmodules_cache_path));
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-diff --git a/clang/lib/Lex/InitHeaderSearch.cpp b/clang/lib/Lex/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git a/clang/lib/Frontend/InitHeaderSearch.cpp b/clang/lib/Frontend/InitHeaderSearch.cpp
</span> index bc31445d6d08..abc3750edec0 100644
 --- a/clang/lib/Lex/InitHeaderSearch.cpp
 +++ b/clang/lib/Lex/InitHeaderSearch.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -108,7 +108,7 @@ static bool CanPrefixSysroot(StringRef Path) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -117,7 +117,7 @@ static bool CanPrefixSysroot(StringRef Path) {
</span>  #if defined(_WIN32)
    return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
  #else
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -199,4 +106,3 @@ index bc31445d6d08..abc3750edec0 100644
</span>  
 -- 
 2.21.1 (Apple Git-122.3)
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-5.0/Portfile b/lang/llvm-5.0/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 4a6a9e1fc0b..5eb9b670c3b 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-5.0/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-5.0/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -10,8 +10,8 @@ set llvm_version        5.0
</span> set clang_executable_version 5.0
 set lldb_executable_version 5.0.2
 name                    llvm-${llvm_version}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-revision                3
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-subport                 clang-${llvm_version} { revision 4 }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+revision                4
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+subport                 clang-${llvm_version} { revision 5 }
</span> subport                 lldb-${llvm_version} { revision 2 }
 set suffix              mp-${llvm_version}
 set sub_prefix          ${prefix}/libexec/llvm-${llvm_version}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -537,10 +537,7 @@ if {${subport} eq "llvm-${llvm_version}"} {
</span>         patchfiles-append \
             9000-patch-clang-support-emulated-tls.diff
     }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    if {${os.major} < 11} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        default_variants-append +emulated_tls
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    default_variants-append +emulated_tls
</span> 
     variant defaultlibcxx description {default to -stdlib=libc++ on all systems}  {
         #patch clang to always default to -stdlib=libc++ if not otherwise specified
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -553,58 +550,55 @@ if {${subport} eq "llvm-${llvm_version}"} {
</span>         default_variants-append +defaultlibcxx
     }
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    variant libstdcxx description {-stdlib=macports-libstdc++ searches for MacPorts libstdc++} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    variant libstdcxx description {-stdlib=libstdc++_macports searches for MacPorts libstdc++} {
</span> 
         patchfiles-append 9001-macports-libstdcxx.diff
 
         post-patch {
             reinplace "s|@@MACPORTS_GCC_INCLUDE_DIR@@|${prefix}/include/gcc/c++|g" \
                 ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_HOST_NAME@@|${build_arch}-apple-darwin${os.major}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            reinplace "s|@@MACPORTS_HOST_NAME@@|${configure.build_arch}-apple-darwin${os.major}|g" \
</span>                 ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
             reinplace "s|@@MACPORTS_libstdc++@@|${prefix}/lib/libgcc/libstdc++.6.dylib|g" \
                 ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # GCC was built for ${build_arch}-apple-darwin${os.major}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # GCC was built for ${configure.build_arch}-apple-darwin${os.major}
</span>             # if GCC was also built universal, it has an extra include directory
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # MacPorts GCC can not compile across platforms
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            switch ${build_arch} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # MacPorts GCC cannot compile across platforms
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            switch ${configure.build_arch} {
</span>                 x86_64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   "i386"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_32bit_DIR@@|i386|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_64bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span>                 }
                 i386 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_32bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_64bit_DIR@@|x86_64|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span>                 }
                 ppc64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    "ppc"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_32bit_DIR@@|ppc|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_64bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span>                 }
                 ppc {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_32bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_64bit_DIR@@|ppc64|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                arm64 {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_32bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_64bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span>                 }
             }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@|${gcc_subdirectory_x86_64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_i386@@|${gcc_subdirectory_i386}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@|${gcc_subdirectory_ppc64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc@@|${gcc_subdirectory_ppc}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span>         }
     }
     default_variants-append +libstdcxx
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-5.0/files/9001-macports-libstdcxx.diff b/lang/llvm-5.0/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;color:#808080;'>index d4c3482d03b..43d2ef79146 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-5.0/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-5.0/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1,6 +1,6 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/include/clang/Lex/HeaderSearchOptions.h       2015-11-17 23:54:13.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/include/clang/Lex/HeaderSearchOptions.h        2017-01-04 17:50:27.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -162,6 +162,9 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -162,6 +162,9 @@ public:
</span>    /// Use libc++ instead of the default libstdc++.
    unsigned UseLibcxx : 1;
  
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -10,69 +10,52 @@
</span>    /// Whether header search information should be output as for -v.
    unsigned Verbose : 1;
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Frontend/CompilerInvocation.cpp        2016-07-13 15:32:15.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Frontend/CompilerInvocation.cpp    2017-01-04 17:52:18.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1522,8 +1522,10 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/lib/Frontend/CompilerInvocation.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/lib/Frontend/CompilerInvocation.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1522,8 +1522,10 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args,
</span>    Opts.UseBuiltinIncludes = !Args.hasArg(OPT_nobuiltininc);
    Opts.UseStandardSystemIncludes = !Args.hasArg(OPT_nostdsysteminc);
    Opts.UseStandardCXXIncludes = !Args.hasArg(OPT_nostdincxx);
 -  if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ))
 +  if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ)) {
      Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0);
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+    Opts.UseMacPortsLibstdcxx = (strcmp(A->getValue(), "macports-libstdc++") == 0);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    Opts.UseMacPortsLibstdcxx = (strcmp(A->getValue(), "macports-libstdc++") == 0 || strcmp(A->getValue(), "libstdc++_macports") == 0);
</span> +  }
    Opts.ResourceDir = Args.getLastArgValue(OPT_resource_dir);
  
    // Canonicalize -fmodules-cache-path before storing it.
<span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Frontend/InitHeaderSearch.cpp  2016-05-16 10:22:25.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Frontend/InitHeaderSearch.cpp      2017-01-04 18:04:43.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -108,7 +108,7 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #if defined(LLVM_ON_WIN32)
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #else
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--  return llvm::sys::path::is_absolute(Path);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  return llvm::sys::path::is_absolute(Path) && Path.find("@@MACPORTS_GCC_INCLUDE_DIR@@")!=0;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #endif
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -363,6 +363,11 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (HSOpts.UseMacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        AddGnuCPlusPlusIncludePaths("@@MACPORTS_GCC_INCLUDE_DIR@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                    "@@MACPORTS_HOST_NAME@@", "@@MACPORTS_GCC_SUBDIRECTORY_ppc@@", "@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                    triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                   "powerpc-apple-darwin10", "", "ppc64",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                   triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -373,6 +378,10 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86_64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (HSOpts.UseMacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        AddGnuCPlusPlusIncludePaths("@@MACPORTS_GCC_INCLUDE_DIR@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                    "@@MACPORTS_HOST_NAME@@", "@@MACPORTS_GCC_SUBDIRECTORY_i386@@", "@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@", triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                   "i686-apple-darwin10", "", "x86_64", triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/include/clang/Driver/ToolChain.h      2016-06-16 03:36:09.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/include/clang/Driver/ToolChain.h       2017-01-04 18:08:42.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -53,7 +53,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/include/clang/Driver/ToolChain.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/include/clang/Driver/ToolChain.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -53,6 +53,7 @@ public:
</span>  
    enum CXXStdlibType {
      CST_Libcxx,
<span style='display:block; white-space:pre;background:#ffe0e0;'>--    CST_Libstdcxx
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_Libstdcxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_MacPortsLibstdcxx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    CST_MacPortsLibstdcxx,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CST_Libstdcxx
</span>    };
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   enum RuntimeLibType {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Driver/ToolChains/Darwin.cpp      2016-11-23 14:25:50.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Driver/ToolChains/Darwin.cpp       2017-09-23 20:52:46.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1452,6 +1452,12 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -580,6 +580,8 @@ ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     return ToolChain::CST_Libcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   else if (LibName == "libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     return ToolChain::CST_Libstdcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  else if (LibName == "macports-libstdc++" || LibName == "libstdc++_macports")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    return ToolChain::CST_MacPortsLibstdcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   else if (LibName == "platform")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     return GetDefaultCXXStdlibType();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -653,6 +655,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   case ToolChain::CST_Libstdcxx:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  case ToolChain::CST_MacPortsLibstdcxx:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CmdArgs.push_back("-lstdc++");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1452,6 +1452,12 @@ void DarwinClang::AddCXXStdlibLibArgs(const ArgList &Args,
</span>      break;
  
    case ToolChain::CST_Libstdcxx:
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -80,38 +63,45 @@
</span> +    if (Type==ToolChain::CST_MacPortsLibstdcxx && getVFS().exists("@@MACPORTS_libstdc++@@")) {
 +      CmdArgs.push_back("@@MACPORTS_libstdc++@@");
 +      return;
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    }
</span> +
      // Unfortunately, -lstdc++ doesn't always exist in the standard search path;
      // it was previously found in the gcc lib dir. However, for all the Darwin
      // platforms we care about it was -lstdc++.6, so we search for that
<span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Driver/ToolChains/Hexagon.cpp.orig     2017-09-24 13:38:59.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Driver/ToolChains/Hexagon.cpp      2017-09-24 14:15:41.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -466,6 +466,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/lib/Driver/ToolChains/Hexagon.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/lib/Driver/ToolChains/Hexagon.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -466,6 +466,8 @@ HexagonToolChain::GetCXXStdlibType(const ArgList &Args) const {
</span>      return ToolChain::CST_Libstdcxx;
  
    StringRef Value = A->getValue();
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  if (Value == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  if (Value == "macports-libstdc++" || Value == "libstdc++_macports")
</span> +    return ToolChain::CST_MacPortsLibstdcxx;
    if (Value != "libstdc++")
      getDriver().Diag(diag::err_drv_invalid_stdlib_name) << A->getAsString(Args);
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Driver/ToolChain.cpp   2016-07-15 16:13:27.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Driver/ToolChain.cpp       2017-01-05 08:14:23.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -585,6 +585,8 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return ToolChain::CST_Libcxx;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   else if (LibName == "libstdc++")
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return ToolChain::CST_Libstdcxx;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  else if (LibName == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    return ToolChain::CST_MacPortsLibstdcxx;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   else if (LibName == "platform")
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return GetDefaultCXXStdlibType();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -108,7 +108,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if defined(LLVM_ON_WIN32)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-  return llvm::sys::path::is_absolute(Path);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  return llvm::sys::path::is_absolute(Path) && Path.find("@@MACPORTS_GCC_INCLUDE_DIR@@")!=0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span>  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -658,6 +660,7 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -358,6 +358,14 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   // FIXME: temporary hack: hard-coded paths.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   if (triple.isOSDarwin()) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    if (HSOpts.UseMacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++      AddGnuCPlusPlusIncludePaths("@@MACPORTS_GCC_INCLUDE_DIR@@",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                            "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                            "@@MACPORTS_32bit_DIR@@", "@@MACPORTS_64bit_DIR@@",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                            triple);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++      return;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     switch (triple.getArch()) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     default: break;
</span>  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   case ToolChain::CST_Libstdcxx:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  case ToolChain::CST_MacPortsLibstdcxx:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     CmdArgs.push_back("-lstdc++");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     break;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   }
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-6.0/Portfile b/lang/llvm-6.0/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 12c9242bbd6..9650e5a4fb5 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-6.0/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-6.0/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -14,8 +14,8 @@ set llvm_version_no_dot 60
</span> set clang_executable_version 6.0
 set lldb_executable_version 6.0.1
 name                    llvm-${llvm_version}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-revision                3
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-subport                 clang-${llvm_version} { revision 3 }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+revision                4
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+subport                 clang-${llvm_version} { revision 4 }
</span> subport                 lldb-${llvm_version} { revision 2 }
 set suffix              mp-${llvm_version}
 set sub_prefix          ${prefix}/libexec/llvm-${llvm_version}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -614,9 +614,7 @@ if {${subport} eq "llvm-${llvm_version}"} {
</span>         patchfiles-append \
             9000-patch-clang-6.0-support-emulated-tls.diff
     }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    if {${os.major} < 11} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        default_variants-append +emulated_tls
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    default_variants-append +emulated_tls
</span> 
     variant defaultlibcxx description {default to -stdlib=libc++ on all systems}  {
         #patch clang to always default to -stdlib=libc++ if not otherwise specified
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -629,58 +627,55 @@ if {${subport} eq "llvm-${llvm_version}"} {
</span>         default_variants-append +defaultlibcxx
     }
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    variant libstdcxx description {-stdlib=macports-libstdc++ searches for MacPorts libstdc++} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    variant libstdcxx description {-stdlib=libstdc++_macports searches for MacPorts libstdc++} {
</span> 
         patchfiles-append 9001-macports-libstdcxx.diff
 
         post-patch {
             reinplace "s|@@MACPORTS_GCC_INCLUDE_DIR@@|${prefix}/include/gcc/c++|g" \
                 ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_HOST_NAME@@|${build_arch}-apple-darwin${os.major}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            reinplace "s|@@MACPORTS_HOST_NAME@@|${configure.build_arch}-apple-darwin${os.major}|g" \
</span>                 ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
             reinplace "s|@@MACPORTS_libstdc++@@|${prefix}/lib/libgcc/libstdc++.6.dylib|g" \
                 ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # GCC was built for ${build_arch}-apple-darwin${os.major}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # GCC was built for ${configure.build_arch}-apple-darwin${os.major}
</span>             # if GCC was also built universal, it has an extra include directory
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # MacPorts GCC can not compile across platforms
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            switch ${build_arch} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # MacPorts GCC cannot compile across platforms
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            switch ${configure.build_arch} {
</span>                 x86_64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   "i386"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_32bit_DIR@@|i386|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_64bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span>                 }
                 i386 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_32bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_64bit_DIR@@|x86_64|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span>                 }
                 ppc64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    "ppc"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_32bit_DIR@@|ppc|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_64bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span>                 }
                 ppc {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_32bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_64bit_DIR@@|ppc64|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                arm64 {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_32bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_64bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span>                 }
             }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@|${gcc_subdirectory_x86_64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_i386@@|${gcc_subdirectory_i386}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@|${gcc_subdirectory_ppc64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc@@|${gcc_subdirectory_ppc}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span>         }
     }
     default_variants-append +libstdcxx
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-6.0/files/9001-macports-libstdcxx.diff b/lang/llvm-6.0/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;color:#808080;'>index c85d383101f..d7cbccb2ad7 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-6.0/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-6.0/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1,6 +1,6 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/include/clang/Lex/HeaderSearchOptions.h       2015-11-17 23:54:13.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/include/clang/Lex/HeaderSearchOptions.h        2017-01-04 17:50:27.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -166,6 +166,9 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -185,6 +185,9 @@ public:
</span>    /// Use libc++ instead of the default libstdc++.
    unsigned UseLibcxx : 1;
  
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -10,69 +10,52 @@
</span>    /// Whether header search information should be output as for -v.
    unsigned Verbose : 1;
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Frontend/CompilerInvocation.cpp        2016-07-13 15:32:15.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Frontend/CompilerInvocation.cpp    2017-01-04 17:52:18.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1539,8 +1539,10 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/lib/Frontend/CompilerInvocation.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/lib/Frontend/CompilerInvocation.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1591,8 +1591,10 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args,
</span>    Opts.UseBuiltinIncludes = !Args.hasArg(OPT_nobuiltininc);
    Opts.UseStandardSystemIncludes = !Args.hasArg(OPT_nostdsysteminc);
    Opts.UseStandardCXXIncludes = !Args.hasArg(OPT_nostdincxx);
 -  if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ))
 +  if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ)) {
      Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0);
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+    Opts.UseMacPortsLibstdcxx = (strcmp(A->getValue(), "macports-libstdc++") == 0);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    Opts.UseMacPortsLibstdcxx = (strcmp(A->getValue(), "macports-libstdc++") == 0 || strcmp(A->getValue(), "libstdc++_macports") == 0);
</span> +  }
    Opts.ResourceDir = Args.getLastArgValue(OPT_resource_dir);
  
    // Canonicalize -fmodules-cache-path before storing it.
<span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Frontend/InitHeaderSearch.cpp  2016-05-16 10:22:25.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Frontend/InitHeaderSearch.cpp      2017-01-04 18:04:43.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -108,7 +108,7 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #if defined(LLVM_ON_WIN32)
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #else
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--  return llvm::sys::path::is_absolute(Path);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  return llvm::sys::path::is_absolute(Path) && Path.find("@@MACPORTS_GCC_INCLUDE_DIR@@")!=0;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #endif
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -362,6 +362,11 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (HSOpts.UseMacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        AddGnuCPlusPlusIncludePaths("@@MACPORTS_GCC_INCLUDE_DIR@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                    "@@MACPORTS_HOST_NAME@@", "@@MACPORTS_GCC_SUBDIRECTORY_ppc@@", "@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                    triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                   "powerpc-apple-darwin10", "", "ppc64",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                   triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -372,6 +377,10 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86_64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (HSOpts.UseMacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        AddGnuCPlusPlusIncludePaths("@@MACPORTS_GCC_INCLUDE_DIR@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                    "@@MACPORTS_HOST_NAME@@", "@@MACPORTS_GCC_SUBDIRECTORY_i386@@", "@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@", triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                   "i686-apple-darwin10", "", "x86_64", triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/include/clang/Driver/ToolChain.h      2016-06-16 03:36:09.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/include/clang/Driver/ToolChain.h       2017-01-04 18:08:42.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -75,7 +75,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/include/clang/Driver/ToolChain.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/include/clang/Driver/ToolChain.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -76,6 +76,7 @@ public:
</span>  
    enum CXXStdlibType {
      CST_Libcxx,
<span style='display:block; white-space:pre;background:#ffe0e0;'>--    CST_Libstdcxx
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_Libstdcxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_MacPortsLibstdcxx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    CST_MacPortsLibstdcxx,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CST_Libstdcxx
</span>    };
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   enum RuntimeLibType {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Driver/ToolChains/Darwin.cpp      2016-11-23 14:25:50.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Driver/ToolChains/Darwin.cpp       2017-09-23 20:52:46.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1455,6 +1455,12 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -651,6 +651,8 @@ ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     return ToolChain::CST_Libcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   else if (LibName == "libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     return ToolChain::CST_Libstdcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  else if (LibName == "macports-libstdc++" || LibName == "libstdc++_macports")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    return ToolChain::CST_MacPortsLibstdcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   else if (LibName == "platform")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     return GetDefaultCXXStdlibType();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -732,6 +734,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   case ToolChain::CST_Libstdcxx:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  case ToolChain::CST_MacPortsLibstdcxx:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CmdArgs.push_back("-lstdc++");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1664,6 +1664,12 @@ void DarwinClang::AddCXXStdlibLibArgs(const ArgList &Args,
</span>      break;
  
    case ToolChain::CST_Libstdcxx:
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -80,38 +63,45 @@
</span> +    if (Type==ToolChain::CST_MacPortsLibstdcxx && getVFS().exists("@@MACPORTS_libstdc++@@")) {
 +      CmdArgs.push_back("@@MACPORTS_libstdc++@@");
 +      return;
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    }
</span> +
      // Unfortunately, -lstdc++ doesn't always exist in the standard search path;
      // it was previously found in the gcc lib dir. However, for all the Darwin
      // platforms we care about it was -lstdc++.6, so we search for that
<span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Driver/ToolChains/Hexagon.cpp.orig     2017-09-24 13:38:59.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Driver/ToolChains/Hexagon.cpp      2017-09-24 14:15:41.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -467,6 +467,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/lib/Driver/ToolChains/Hexagon.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/lib/Driver/ToolChains/Hexagon.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -557,6 +557,8 @@ HexagonToolChain::GetCXXStdlibType(const ArgList &Args) const {
</span>      return ToolChain::CST_Libstdcxx;
  
    StringRef Value = A->getValue();
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  if (Value == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  if (Value == "macports-libstdc++" || Value == "libstdc++_macports")
</span> +    return ToolChain::CST_MacPortsLibstdcxx;
    if (Value != "libstdc++")
      getDriver().Diag(diag::err_drv_invalid_stdlib_name) << A->getAsString(Args);
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Driver/ToolChain.cpp   2016-07-15 16:13:27.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Driver/ToolChain.cpp       2017-01-05 08:14:23.000000000 -0700
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -601,6 +601,8 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return ToolChain::CST_Libcxx;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   else if (LibName == "libstdc++")
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return ToolChain::CST_Libstdcxx;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  else if (LibName == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    return ToolChain::CST_MacPortsLibstdcxx;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   else if (LibName == "platform")
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return GetDefaultCXXStdlibType();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -108,7 +108,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if defined(LLVM_ON_WIN32)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-  return llvm::sys::path::is_absolute(Path);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  return llvm::sys::path::is_absolute(Path) && Path.find("@@MACPORTS_GCC_INCLUDE_DIR@@")!=0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span>  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -682,6 +684,7 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -357,6 +357,14 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   // FIXME: temporary hack: hard-coded paths.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   if (triple.isOSDarwin()) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    if (HSOpts.UseMacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++      AddGnuCPlusPlusIncludePaths("@@MACPORTS_GCC_INCLUDE_DIR@@",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                            "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                            "@@MACPORTS_32bit_DIR@@", "@@MACPORTS_64bit_DIR@@",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                            triple);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++      return;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     switch (triple.getArch()) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     default: break;
</span>  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   case ToolChain::CST_Libstdcxx:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  case ToolChain::CST_MacPortsLibstdcxx:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     CmdArgs.push_back("-lstdc++");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     break;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   }
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-7.0/Portfile b/lang/llvm-7.0/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index cb019c7c1e7..3738be75d2e 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-7.0/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-7.0/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -15,8 +15,8 @@ set llvm_version_no_dot 70
</span> set clang_executable_version 7
 set lldb_executable_version 7.1.0
 name                    llvm-${llvm_version}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-revision                2
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-subport                 clang-${llvm_version} { revision 1 }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+revision                3
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+subport                 clang-${llvm_version} { revision 2 }
</span> subport                 lldb-${llvm_version} { revision 1 }
 set suffix              mp-${llvm_version}
 set sub_prefix          ${prefix}/libexec/llvm-${llvm_version}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -590,23 +590,21 @@ post-destroot {
</span>     }
 }
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-if {${os.major} < 11} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    variant emulated_tls description { enable c11/c++11 thread support on older systems using emulated-tls } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        # use emulated-tls to support thread_local on systems prior to 10.7
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        # requires linking against macports-libstdc++ or libc++ / libc++abi with cxa_thread_atexit
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        # the test for default emulated-tls has been moved into the backend
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+variant emulated_tls description { enable c11/c++11 thread support on older systems using emulated-tls } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    # use emulated-tls to support thread_local on systems prior to 10.7
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    # requires linking against macports-libstdc++ or libc++ / libc++abi with cxa_thread_atexit
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    # the test for default emulated-tls has been moved into the backend
</span> 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-        # this patch is needed for llvm and clang builds
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        patchfiles-append \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            9000-patch-llvm-7.0-support-emulated-tls.diff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    # this patch is needed for llvm and clang builds
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    patchfiles-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        9000-patch-llvm-7.0-support-emulated-tls.diff
</span> 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-        if {${subport} eq "clang-${llvm_version}"} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            patchfiles-append \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                9000-patch-clang-7.0-support-emulated-tls.diff
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    if {${subport} eq "clang-${llvm_version}"} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        patchfiles-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            9000-patch-clang-7.0-support-emulated-tls.diff
</span>     }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    default_variants-append +emulated_tls
</span> }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+default_variants-append +emulated_tls
</span> 
 if {${subport} eq "llvm-${llvm_version}"} {
     variant polly description {Provide the polly polyhedral optimizer} {}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -659,58 +657,55 @@ if {${subport} eq "llvm-${llvm_version}"} {
</span>         default_variants-append +defaultlibcxx
     }
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    variant libstdcxx description {-stdlib=macports-libstdc++ searches for MacPorts libstdc++} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    variant libstdcxx description {-stdlib=libstdc++_macports searches for MacPorts libstdc++} {
</span> 
         patchfiles-append 9001-macports-libstdcxx.diff
 
         post-patch {
             reinplace "s|@@MACPORTS_GCC_INCLUDE_DIR@@|${prefix}/include/gcc/c++|g" \
                 ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_HOST_NAME@@|${build_arch}-apple-darwin${os.major}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            reinplace "s|@@MACPORTS_HOST_NAME@@|${configure.build_arch}-apple-darwin${os.major}|g" \
</span>                 ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
             reinplace "s|@@MACPORTS_libstdc++@@|${prefix}/lib/libgcc/libstdc++.6.dylib|g" \
                 ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # GCC was built for ${build_arch}-apple-darwin${os.major}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # GCC was built for ${configure.build_arch}-apple-darwin${os.major}
</span>             # if GCC was also built universal, it has an extra include directory
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # MacPorts GCC can not compile across platforms
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            switch ${build_arch} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # MacPorts GCC cannot compile across platforms
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            switch ${configure.build_arch} {
</span>                 x86_64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   "i386"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_32bit_DIR@@|i386|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_64bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span>                 }
                 i386 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_32bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_64bit_DIR@@|x86_64|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span>                 }
                 ppc64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    "ppc"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_32bit_DIR@@|ppc|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_64bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span>                 }
                 ppc {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_32bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_64bit_DIR@@|ppc64|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                arm64 {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_32bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_64bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span>                 }
             }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@|${gcc_subdirectory_x86_64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_i386@@|${gcc_subdirectory_i386}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@|${gcc_subdirectory_ppc64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc@@|${gcc_subdirectory_ppc}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span>         }
     }
     default_variants-append +libstdcxx
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-7.0/files/9001-macports-libstdcxx.diff b/lang/llvm-7.0/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;color:#808080;'>index c73a7b240c5..52f9e89473f 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-7.0/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-7.0/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -19,78 +19,43 @@
</span> -  if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ))
 +  if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ)) {
      Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0);
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+    Opts.UseMacPortsLibstdcxx = (strcmp(A->getValue(), "macports-libstdc++") == 0);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    Opts.UseMacPortsLibstdcxx = (strcmp(A->getValue(), "macports-libstdc++") == 0 || strcmp(A->getValue(), "libstdc++_macports") == 0);
</span> +  }
    Opts.ResourceDir = Args.getLastArgValue(OPT_resource_dir);
  
    // Canonicalize -fmodules-cache-path before storing it.
<span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -111,7 +111,7 @@ static bool CanPrefixSysroot(StringRef Path) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #if defined(_WIN32)
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #else
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--  return llvm::sys::path::is_absolute(Path);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  return llvm::sys::path::is_absolute(Path) && Path.find("@@MACPORTS_GCC_INCLUDE_DIR@@")!=0;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #endif
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -371,9 +371,17 @@ void InitHeaderSearch::AddDefaultCPlusPlusIncludePaths(
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--      IsBaseFound = AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "powerpc-apple-darwin10", "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "ppc64", triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound = false;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (HSOpts.UseMacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        IsBaseFound = AddGnuCPlusPlusIncludePaths("@@MACPORTS_GCC_INCLUDE_DIR@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "@@MACPORTS_HOST_NAME@@", "@@MACPORTS_GCC_SUBDIRECTORY_ppc@@", "@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound |= AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "powerpc-apple-darwin10", "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "ppc64", triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       IsBaseFound |= AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                  "powerpc-apple-darwin8", "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                  "ppc64", triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -381,9 +389,16 @@ void InitHeaderSearch::AddDefaultCPlusPlusIncludePaths(
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86_64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--      IsBaseFound = AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "i686-apple-darwin10", "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "x86_64", triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound = false;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (HSOpts.UseMacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        IsBaseFound = AddGnuCPlusPlusIncludePaths("@@MACPORTS_GCC_INCLUDE_DIR@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "@@MACPORTS_HOST_NAME@@", "@@MACPORTS_GCC_SUBDIRECTORY_i386@@", "@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@", triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound |= AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "i686-apple-darwin10", "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "x86_64", triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       IsBaseFound |= AddGnuCPlusPlusIncludePaths(
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-           "/usr/include/c++/4.0.0", "i686-apple-darwin8", "", "x86_64", triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       break;
</span> --- orig/tools/clang/include/clang/Driver/ToolChain.h
 +++ new/tools/clang/include/clang/Driver/ToolChain.h
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -91,7 +91,8 @@ public:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -91,6 +91,7 @@ public:
</span>  
    enum CXXStdlibType {
      CST_Libcxx,
<span style='display:block; white-space:pre;background:#ffe0e0;'>--    CST_Libstdcxx
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_Libstdcxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_MacPortsLibstdcxx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    CST_MacPortsLibstdcxx,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CST_Libstdcxx
</span>    };
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   enum RuntimeLibType {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -674,6 +674,8 @@ ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     return ToolChain::CST_Libcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   else if (LibName == "libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     return ToolChain::CST_Libstdcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  else if (LibName == "macports-libstdc++" || LibName == "libstdc++_macports")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    return ToolChain::CST_MacPortsLibstdcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   else if (LibName == "platform")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     return GetDefaultCXXStdlibType();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -755,6 +757,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   case ToolChain::CST_Libstdcxx:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  case ToolChain::CST_MacPortsLibstdcxx:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CmdArgs.push_back("-lstdc++");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   }
</span> --- orig/tools/clang/lib/Driver/ToolChains/Darwin.cpp
 +++ new/tools/clang/lib/Driver/ToolChains/Darwin.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1729,6 +1729,12 @@ void DarwinClang::AddCXXStdlibLibArgs(const ArgList &Args,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1719,6 +1719,12 @@ void DarwinClang::AddCXXStdlibLibArgs(const ArgList &Args,
</span>      break;
  
    case ToolChain::CST_Libstdcxx:
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -98,7 +63,7 @@
</span> +    if (Type==ToolChain::CST_MacPortsLibstdcxx && getVFS().exists("@@MACPORTS_libstdc++@@")) {
 +      CmdArgs.push_back("@@MACPORTS_libstdc++@@");
 +      return;
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    }
</span> +
      // Unfortunately, -lstdc++ doesn't always exist in the standard search path;
      // it was previously found in the gcc lib dir. However, for all the Darwin
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -109,27 +74,39 @@
</span>      return ToolChain::CST_Libstdcxx;
  
    StringRef Value = A->getValue();
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  if (Value == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  if (Value == "macports-libstdc++" || Value == "libstdc++_macports")
</span> +    return ToolChain::CST_MacPortsLibstdcxx;
    if (Value != "libstdc++")
      getDriver().Diag(diag::err_drv_invalid_stdlib_name) << A->getAsString(Args);
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -674,6 +674,8 @@ ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return ToolChain::CST_Libcxx;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   else if (LibName == "libstdc++")
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return ToolChain::CST_Libstdcxx;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  else if (LibName == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    return ToolChain::CST_MacPortsLibstdcxx;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   else if (LibName == "platform")
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return GetDefaultCXXStdlibType();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -111,7 +111,7 @@ static bool CanPrefixSysroot(StringRef Path) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if defined(_WIN32)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-  return llvm::sys::path::is_absolute(Path);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  return llvm::sys::path::is_absolute(Path) && Path.find("@@MACPORTS_GCC_INCLUDE_DIR@@")!=0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span>  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -755,6 +757,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -365,6 +365,19 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   // FIXME: temporary hack: hard-coded paths.
</span>  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   case ToolChain::CST_Libstdcxx:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  case ToolChain::CST_MacPortsLibstdcxx:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     CmdArgs.push_back("-lstdc++");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     break;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   if (triple.isOSDarwin()) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    if (HSOpts.UseMacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  bool IsBaseFoundMacPorts = AddGnuCPlusPlusIncludePaths("@@MACPORTS_GCC_INCLUDE_DIR@@",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                                 "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                                 "@@MACPORTS_32bit_DIR@@", "@@MACPORTS_64bit_DIR@@",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                                 triple);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  if (!IsBaseFoundMacPorts &&
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++      !(LangOpts.CUDA || LangOpts.OpenCL || LangOpts.RenderScript)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++      Headers.getDiags().Report(SourceLocation(),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                diag::warn_stdlibcxx_not_found);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  return;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     bool IsBaseFound = true;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     switch (triple.getArch()) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     default: break;
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-8.0/Portfile b/lang/llvm-8.0/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 6f353105553..bab94eaba8b 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-8.0/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-8.0/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -15,8 +15,8 @@ set clang_executable_version 8
</span> set llvm_patch_revision 1
 set lldb_executable_version 8.0.${llvm_patch_revision}
 name                    llvm-${llvm_version}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-revision                2
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-subport                 clang-${llvm_version} { revision 1 }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+revision                3
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+subport                 clang-${llvm_version} { revision 2 }
</span> subport                 lldb-${llvm_version} { revision 1 }
 set suffix              mp-${llvm_version}
 set sub_prefix          ${prefix}/libexec/llvm-${llvm_version}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -597,23 +597,21 @@ post-destroot {
</span>     }
 }
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-if {${os.major} < 11} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    variant emulated_tls description { enable c11/c++11 thread support on older systems using emulated-tls } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        # use emulated-tls to support thread_local on systems prior to 10.7
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        # requires linking against macports-libstdc++ or libc++ / libc++abi with cxa_thread_atexit
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        # the test for default emulated-tls has been moved into the backend
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+variant emulated_tls description { enable c11/c++11 thread support on older systems using emulated-tls } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    # use emulated-tls to support thread_local on systems prior to 10.7
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    # requires linking against macports-libstdc++ or libc++ / libc++abi with cxa_thread_atexit
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    # the test for default emulated-tls has been moved into the backend
</span> 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-        # this patch is needed for llvm and clang builds
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        patchfiles-append \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            9000-patch-llvm-7.0-support-emulated-tls.diff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    # this patch is needed for llvm and clang builds
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    patchfiles-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        9000-patch-llvm-7.0-support-emulated-tls.diff
</span> 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-        if {${subport} eq "clang-${llvm_version}"} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            patchfiles-append \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                9000-patch-clang-7.0-support-emulated-tls.diff
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    if {${subport} eq "clang-${llvm_version}"} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        patchfiles-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            9000-patch-clang-7.0-support-emulated-tls.diff
</span>     }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    default_variants-append +emulated_tls
</span> }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+default_variants-append +emulated_tls
</span> 
 if {${subport} eq "llvm-${llvm_version}"} {
     variant polly description {Provide the polly polyhedral optimizer} {}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -666,58 +664,62 @@ if {${subport} eq "llvm-${llvm_version}"} {
</span>         default_variants-append +defaultlibcxx
     }
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    variant libstdcxx description {-stdlib=macports-libstdc++ searches for MacPorts libstdc++} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    variant libstdcxx description {-stdlib=libstdc++_macports searches for MacPorts libstdc++} {
</span> 
         patchfiles-append 9001-macports-libstdcxx.diff
 
         post-patch {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+            if { ${configure.build_arch} eq "arm64" } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                # see https://github.com/macports/macports-ports/commit/be1e11a368f672d927a7bdb381f2fa71a79ba483
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                set gcc_arch    aarch64
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                set gcc_arch    ${configure.build_arch}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span>             reinplace "s|@@MACPORTS_GCC_INCLUDE_DIR@@|${prefix}/include/gcc/c++|g" \
                 ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_HOST_NAME@@|${build_arch}-apple-darwin${os.major}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            reinplace "s|@@MACPORTS_HOST_NAME@@|${gcc_arch}-apple-darwin${os.major}|g" \
</span>                 ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
             reinplace "s|@@MACPORTS_libstdc++@@|${prefix}/lib/libgcc/libstdc++.6.dylib|g" \
                 ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # GCC was built for ${build_arch}-apple-darwin${os.major}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # GCC was built for ${configure.build_arch}-apple-darwin${os.major}
</span>             # if GCC was also built universal, it has an extra include directory
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # MacPorts GCC can not compile across platforms
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            switch ${build_arch} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # MacPorts GCC cannot compile across platforms
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            switch ${configure.build_arch} {
</span>                 x86_64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   "i386"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_32bit_DIR@@|i386|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_64bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span>                 }
                 i386 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_32bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_64bit_DIR@@|x86_64|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span>                 }
                 ppc64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    "ppc"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_32bit_DIR@@|ppc|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_64bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span>                 }
                 ppc {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_32bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_64bit_DIR@@|ppc64|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                arm64 {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_32bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_64bit_DIR@@||g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span>                 }
             }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@|${gcc_subdirectory_x86_64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_i386@@|${gcc_subdirectory_i386}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@|${gcc_subdirectory_ppc64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc@@|${gcc_subdirectory_ppc}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span>         }
     }
     default_variants-append +libstdcxx
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-8.0/files/9001-macports-libstdcxx.diff b/lang/llvm-8.0/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;color:#808080;'>index c73a7b240c5..5bb895ab3e3 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-8.0/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-8.0/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -12,85 +12,50 @@
</span>  
 --- orig/tools/clang/lib/Frontend/CompilerInvocation.cpp
 +++ new/tools/clang/lib/Frontend/CompilerInvocation.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1721,8 +1721,10 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1915,8 +1915,10 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args,
</span>    Opts.UseBuiltinIncludes = !Args.hasArg(OPT_nobuiltininc);
    Opts.UseStandardSystemIncludes = !Args.hasArg(OPT_nostdsysteminc);
    Opts.UseStandardCXXIncludes = !Args.hasArg(OPT_nostdincxx);
 -  if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ))
 +  if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ)) {
      Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0);
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+    Opts.UseMacPortsLibstdcxx = (strcmp(A->getValue(), "macports-libstdc++") == 0);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    Opts.UseMacPortsLibstdcxx = (strcmp(A->getValue(), "macports-libstdc++") == 0 || strcmp(A->getValue(), "libstdc++_macports") == 0);
</span> +  }
    Opts.ResourceDir = Args.getLastArgValue(OPT_resource_dir);
  
    // Canonicalize -fmodules-cache-path before storing it.
<span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -111,7 +111,7 @@ static bool CanPrefixSysroot(StringRef Path) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #if defined(_WIN32)
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #else
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--  return llvm::sys::path::is_absolute(Path);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  return llvm::sys::path::is_absolute(Path) && Path.find("@@MACPORTS_GCC_INCLUDE_DIR@@")!=0;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #endif
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -371,9 +371,17 @@ void InitHeaderSearch::AddDefaultCPlusPlusIncludePaths(
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--      IsBaseFound = AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "powerpc-apple-darwin10", "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "ppc64", triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound = false;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (HSOpts.UseMacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        IsBaseFound = AddGnuCPlusPlusIncludePaths("@@MACPORTS_GCC_INCLUDE_DIR@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "@@MACPORTS_HOST_NAME@@", "@@MACPORTS_GCC_SUBDIRECTORY_ppc@@", "@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound |= AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "powerpc-apple-darwin10", "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "ppc64", triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       IsBaseFound |= AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                  "powerpc-apple-darwin8", "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                  "ppc64", triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -381,9 +389,16 @@ void InitHeaderSearch::AddDefaultCPlusPlusIncludePaths(
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86_64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--      IsBaseFound = AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "i686-apple-darwin10", "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "x86_64", triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound = false;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (HSOpts.UseMacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        IsBaseFound = AddGnuCPlusPlusIncludePaths("@@MACPORTS_GCC_INCLUDE_DIR@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "@@MACPORTS_HOST_NAME@@", "@@MACPORTS_GCC_SUBDIRECTORY_i386@@", "@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@", triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound |= AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "i686-apple-darwin10", "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "x86_64", triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       IsBaseFound |= AddGnuCPlusPlusIncludePaths(
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-           "/usr/include/c++/4.0.0", "i686-apple-darwin8", "", "x86_64", triple);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       break;
</span> --- orig/tools/clang/include/clang/Driver/ToolChain.h
 +++ new/tools/clang/include/clang/Driver/ToolChain.h
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -91,7 +91,8 @@ public:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -92,6 +92,7 @@ public:
</span>  
    enum CXXStdlibType {
      CST_Libcxx,
<span style='display:block; white-space:pre;background:#ffe0e0;'>--    CST_Libstdcxx
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_Libstdcxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_MacPortsLibstdcxx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    CST_MacPortsLibstdcxx,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CST_Libstdcxx
</span>    };
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   enum RuntimeLibType {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -689,6 +689,8 @@ ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     return ToolChain::CST_Libcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   else if (LibName == "libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     return ToolChain::CST_Libstdcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  else if (LibName == "macports-libstdc++" || LibName == "libstdc++_macports")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    return ToolChain::CST_MacPortsLibstdcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   else if (LibName == "platform")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     return GetDefaultCXXStdlibType();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -770,6 +772,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   case ToolChain::CST_Libstdcxx:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  case ToolChain::CST_MacPortsLibstdcxx:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CmdArgs.push_back("-lstdc++");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   }
</span> --- orig/tools/clang/lib/Driver/ToolChains/Darwin.cpp
 +++ new/tools/clang/lib/Driver/ToolChains/Darwin.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1729,6 +1729,12 @@ void DarwinClang::AddCXXStdlibLibArgs(const ArgList &Args,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1788,6 +1788,12 @@ void DarwinClang::AddCXXStdlibLibArgs(const ArgList &Args,
</span>      break;
  
    case ToolChain::CST_Libstdcxx:
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -98,38 +63,50 @@
</span> +    if (Type==ToolChain::CST_MacPortsLibstdcxx && getVFS().exists("@@MACPORTS_libstdc++@@")) {
 +      CmdArgs.push_back("@@MACPORTS_libstdc++@@");
 +      return;
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    }
</span> +
      // Unfortunately, -lstdc++ doesn't always exist in the standard search path;
      // it was previously found in the gcc lib dir. However, for all the Darwin
      // platforms we care about it was -lstdc++.6, so we search for that
 --- orig/tools/clang/lib/Driver/ToolChains/Hexagon.cpp
 +++ new/tools/clang/lib/Driver/ToolChains/Hexagon.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -557,6 +557,8 @@ HexagonToolChain::GetCXXStdlibType(const ArgList &Args) const {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -552,6 +552,8 @@ HexagonToolChain::GetCXXStdlibType(const ArgList &Args) const {
</span>      return ToolChain::CST_Libstdcxx;
  
    StringRef Value = A->getValue();
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  if (Value == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  if (Value == "macports-libstdc++" || Value == "libstdc++_macports")
</span> +    return ToolChain::CST_MacPortsLibstdcxx;
    if (Value != "libstdc++")
      getDriver().Diag(diag::err_drv_invalid_stdlib_name) << A->getAsString(Args);
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -674,6 +674,8 @@ ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return ToolChain::CST_Libcxx;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   else if (LibName == "libstdc++")
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return ToolChain::CST_Libstdcxx;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  else if (LibName == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    return ToolChain::CST_MacPortsLibstdcxx;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   else if (LibName == "platform")
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return GetDefaultCXXStdlibType();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -111,7 +111,7 @@ static bool CanPrefixSysroot(StringRef Path) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if defined(_WIN32)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-  return llvm::sys::path::is_absolute(Path);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  return llvm::sys::path::is_absolute(Path) && Path.find("@@MACPORTS_GCC_INCLUDE_DIR@@")!=0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span>  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -755,6 +757,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -366,6 +366,19 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   // FIXME: temporary hack: hard-coded paths.
</span>  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   case ToolChain::CST_Libstdcxx:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  case ToolChain::CST_MacPortsLibstdcxx:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     CmdArgs.push_back("-lstdc++");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     break;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   if (triple.isOSDarwin()) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    if (HSOpts.UseMacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  bool IsBaseFoundMacPorts = AddGnuCPlusPlusIncludePaths("@@MACPORTS_GCC_INCLUDE_DIR@@",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                                 "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                                 "@@MACPORTS_32bit_DIR@@", "@@MACPORTS_64bit_DIR@@",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                                 triple);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  if (!IsBaseFoundMacPorts &&
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++      !(LangOpts.CUDA || LangOpts.OpenCL || LangOpts.RenderScript)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++      Headers.getDiags().Report(SourceLocation(),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                diag::warn_stdlibcxx_not_found);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  return;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     bool IsBaseFound = true;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     switch (triple.getArch()) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     default: break;
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-9.0/Portfile b/lang/llvm-9.0/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 89c4cf44a66..d5a49defce3 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-9.0/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-9.0/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -14,8 +14,8 @@ set llvm_version_no_dot 90
</span> set clang_executable_version 9
 set lldb_executable_version 9.0.0
 name                    llvm-${llvm_version}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-revision                2
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-subport                 clang-${llvm_version} { revision 4 }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+revision                3
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+subport                 clang-${llvm_version} { revision 5 }
</span> subport                 lldb-${llvm_version} { revision 2 }
 set suffix              mp-${llvm_version}
 set sub_prefix          ${prefix}/libexec/llvm-${llvm_version}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -601,23 +601,21 @@ post-destroot {
</span>     }
 }
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-if {${os.major} < 11} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    variant emulated_tls description { enable c11/c++11 thread support on older systems using emulated-tls } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        # use emulated-tls to support thread_local on systems prior to 10.7
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        # requires linking against macports-libstdc++ or libc++ / libc++abi with cxa_thread_atexit
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        # the test for default emulated-tls has been moved into the backend
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+variant emulated_tls description { enable c11/c++11 thread support on older systems using emulated-tls } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    # use emulated-tls to support thread_local on systems prior to 10.7
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    # requires linking against macports-libstdc++ or libc++ / libc++abi with cxa_thread_atexit
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    # the test for default emulated-tls has been moved into the backend
</span> 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-        # this patch is needed for llvm and clang builds
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        patchfiles-append \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            9000-patch-llvm-7.0-support-emulated-tls.diff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    # this patch is needed for llvm and clang builds
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    patchfiles-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        9000-patch-llvm-7.0-support-emulated-tls.diff
</span> 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-        if {${subport} eq "clang-${llvm_version}"} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            patchfiles-append \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                9000-patch-clang-7.0-support-emulated-tls.diff
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    if {${subport} eq "clang-${llvm_version}"} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        patchfiles-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            9000-patch-clang-7.0-support-emulated-tls.diff
</span>     }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    default_variants-append +emulated_tls
</span> }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+default_variants-append +emulated_tls
</span> 
 if {${subport} eq "llvm-${llvm_version}"} {
     variant polly description {Provide the polly polyhedral optimizer} {}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -674,59 +672,53 @@ if {${subport} eq "llvm-${llvm_version}"} {
</span>         default_variants-append +defaultlibcxx
     }
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    variant libstdcxx description {-stdlib=macports-libstdc++ searches for MacPorts libstdc++} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    variant libstdcxx description {-stdlib=libstdc++_macports searches for MacPorts libstdc++} {
</span> 
         patchfiles-append 9001-macports-libstdcxx.diff
 
         post-patch {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+            if { ${configure.build_arch} eq "arm64" } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                # see https://github.com/macports/macports-ports/commit/be1e11a368f672d927a7bdb381f2fa71a79ba483
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                set gcc_arch    aarch64
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                set gcc_arch    ${configure.build_arch}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span>             reinplace "s|@@MACPORTS_GCC_INCLUDE_DIR@@|${prefix}/include/gcc/c++|g" \
                 ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp \
                 ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_HOST_NAME@@|${build_arch}-apple-darwin${os.major}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            reinplace "s|@@MACPORTS_HOST_NAME@@|${gcc_arch}-apple-darwin${os.major}|g" \
</span>                 ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
             reinplace "s|@@MACPORTS_libstdc++@@|${prefix}/lib/libgcc/libstdc++.6.dylib|g" \
                 ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # GCC was built for ${build_arch}-apple-darwin${os.major}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # GCC was built for ${configure.build_arch}-apple-darwin${os.major}
</span>             # if GCC was also built universal, it has an extra include directory
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # MacPorts GCC can not compile across platforms
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            switch ${build_arch} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # MacPorts GCC cannot compile across platforms
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            switch ${configure.build_arch} {
</span>                 x86_64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   "i386"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::x86_64 ? "" : "i386"|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
                 i386 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::x86_64 ? "x86_64" : ""|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
                 ppc64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    "ppc"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::ppc64 ? "" : "ppc"|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
                 ppc {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::ppc64 ? "ppc64" : ""|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                arm64 {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|""|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
             }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@|${gcc_subdirectory_x86_64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_i386@@|${gcc_subdirectory_i386}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@|${gcc_subdirectory_ppc64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc@@|${gcc_subdirectory_ppc}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${worksrcpath}/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span>         }
     }
     default_variants-append +libstdcxx
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-9.0/files/9001-macports-libstdcxx.diff b/lang/llvm-9.0/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;color:#808080;'>index 9d9154e8c81..bdbf305f0bd 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-9.0/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-9.0/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1,157 +1,108 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -184,6 +184,9 @@ public:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   /// Use libc++ instead of the default libstdc++.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   unsigned UseLibcxx : 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  /// Use MacPorts libstdc++ instead of default system libstdc++.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  unsigned UseMacPortsLibstdcxx : 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   /// Whether header search information should be output as for -v.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   unsigned Verbose : 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Frontend/CompilerInvocation.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Frontend/CompilerInvocation.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1967,8 +1967,10 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   Opts.UseBuiltinIncludes = !Args.hasArg(OPT_nobuiltininc);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   Opts.UseStandardSystemIncludes = !Args.hasArg(OPT_nostdsysteminc);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   Opts.UseStandardCXXIncludes = !Args.hasArg(OPT_nostdincxx);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--  if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ))
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ)) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    Opts.UseMacPortsLibstdcxx = (strcmp(A->getValue(), "macports-libstdc++") == 0);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   Opts.ResourceDir = Args.getLastArgValue(OPT_resource_dir);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   // Canonicalize -fmodules-cache-path before storing it.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -110,7 +110,7 @@ static bool CanPrefixSysroot(StringRef Path) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #if defined(_WIN32)
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #else
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--  return llvm::sys::path::is_absolute(Path);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  return llvm::sys::path::is_absolute(Path) && Path.find("@@MACPORTS_GCC_INCLUDE_DIR@@")!=0;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #endif
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/include/clang/Driver/ToolChain.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/include/clang/Driver/ToolChain.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -91,7 +91,8 @@ public:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+From 4e850191efa6659de85a4ff9be7c896cfb0bb1ec Mon Sep 17 00:00:00 2001
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Date: Mon, 17 May 2021 21:28:40 -0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Subject: [PATCH 05/24] clang: support macports-libstdcxx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+requires reinplace of search paths
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+---
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ clang/include/clang/Driver/ToolChain.h        |  3 +-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ clang/lib/Driver/ToolChain.cpp                |  3 ++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ clang/lib/Driver/ToolChains/Darwin.cpp        | 40 ++++++++++++++-----
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ clang/lib/Driver/ToolChains/Hexagon.cpp       |  2 +
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ clang/lib/Frontend/InitHeaderSearch.cpp       |  2 +-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 7 files changed, 63 insertions(+), 11 deletions(-)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ create mode 100644 clang/lib/Frontend/CompilerInvocation.cpp.rej
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index 28c37a44e1eb..78fcaec7bfb0 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- a/tools/clang/include/clang/Driver/ToolChain.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ b/tools//clang/include/clang/Driver/ToolChain.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -91,6 +91,7 @@ public:
</span>  
    enum CXXStdlibType {
      CST_Libcxx,
<span style='display:block; white-space:pre;background:#ffe0e0;'>--    CST_Libstdcxx
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_Libstdcxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_MacPortsLibstdcxx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    CST_MacPortsLibstdcxx,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CST_Libstdcxx
</span>    };
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   enum RuntimeLibType {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1921,8 +1921,9 @@ void DarwinClang::AddClangCXXStdlibInclu
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index b2ddef141a75..6160843b6885 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- a/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ b/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -769,6 +769,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     return ToolChain::CST_Libcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   else if (LibName == "libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     return ToolChain::CST_Libstdcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  else if (LibName == "macports-libstdc++" || LibName == "libstdc++_macports")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    return ToolChain::CST_MacPortsLibstdcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   else if (LibName == "platform")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     return GetDefaultCXXStdlibType();
</span>  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   llvm::StringRef Sysroot = GetHeaderSysroot(DriverArgs);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  CXXStdlibType Type = GetCXXStdlibType(DriverArgs);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -850,6 +852,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     break;
</span>  
<span style='display:block; white-space:pre;background:#ffe0e0;'>--  switch (GetCXXStdlibType(DriverArgs)) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  switch (Type) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   case ToolChain::CST_Libcxx: {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     // On Darwin, libc++ is installed alongside the compiler in
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     // include/c++/v1, so get from '<install>/bin' to '<install>/include/c++/v1'.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1943,6 +1944,7 @@ void DarwinClang::AddClangCXXStdlibInclu
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   case ToolChain::CST_Libstdcxx:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  case ToolChain::CST_MacPortsLibstdcxx:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CmdArgs.push_back("-lstdc++");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index eb7bd4aec898..daa8e520e404 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- a/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ b/tools/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1969,6 +1969,16 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     break;
</span>    }
  
<span style='display:block; white-space:pre;background:#e0ffe0;'>++  case ToolChain::CST_MacPortsLibstdcxx: {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    bool IsBaseFoundMacPorts = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, llvm::StringRef("@@MACPORTS_GCC_INCLUDE_DIR@@"),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                             "",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                             "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                             @@MACPORTS_TEST_32_64@@);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    if (!IsBaseFoundMacPorts) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++      getDriver().Diag(diag::warn_drv_libstdcxx_not_found);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    }}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span>    case ToolChain::CST_Libstdcxx:
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  case ToolChain::CST_MacPortsLibstdcxx:
</span>      llvm::SmallString<128> UsrIncludeCxx = Sysroot;
      llvm::sys::path::append(UsrIncludeCxx, "usr", "include", "c++");
<span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1953,10 +1955,17 @@ void DarwinClang::AddClangCXXStdlibInclu
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--      IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "powerpc-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                arch == llvm::Triple::ppc64 ? "ppc64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound = false;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (Type==ToolChain::CST_MacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, llvm::StringRef("@@MACPORTS_GCC_INCLUDE_DIR@@"),
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  arch == llvm::Triple::ppc64 ? "@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@" : "@@MACPORTS_GCC_SUBDIRECTORY_ppc@@");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "powerpc-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 arch == llvm::Triple::ppc64 ? "ppc64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                 "4.0.0", "powerpc-apple-darwin8",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                  arch == llvm::Triple::ppc64 ? "ppc64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1964,10 +1973,17 @@ void DarwinClang::AddClangCXXStdlibInclu
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86_64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--      IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "i686-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                arch == llvm::Triple::x86_64 ? "x86_64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound = false;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (Type==ToolChain::CST_MacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, llvm::StringRef("@@MACPORTS_GCC_INCLUDE_DIR@@"),
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  arch == llvm::Triple::x86_64 ? "@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@" : "@@MACPORTS_GCC_SUBDIRECTORY_i386@@");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "i686-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 arch == llvm::Triple::x86_64 ? "x86_64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                 "4.0.0", "i686-apple-darwin8",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                  arch == llvm::Triple::x86_64 ? "x86_64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2010,6 +2026,12 @@ void DarwinClang::AddCXXStdlibLibArgs(co
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -2036,6 +2046,10 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CmdArgs.push_back("-lc++");
</span>      break;
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   case ToolChain::CST_Libstdcxx:
</span> +  case ToolChain::CST_MacPortsLibstdcxx:
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+    if (Type==ToolChain::CST_MacPortsLibstdcxx && getVFS().exists("@@MACPORTS_libstdc++@@")) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      CmdArgs.push_back("@@MACPORTS_libstdc++@@");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      return;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    CmdArgs.push_back("@@MACPORTS_libstdc++@@");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    break;
</span> +
<span style='display:block; white-space:pre;background:#e0ffe0;'>+   case ToolChain::CST_Libstdcxx:
</span>      // Unfortunately, -lstdc++ doesn't always exist in the standard search path;
      // it was previously found in the gcc lib dir. However, for all the Darwin
<span style='display:block; white-space:pre;background:#ffe0e0;'>-     // platforms we care about it was -lstdc++.6, so we search for that
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Driver/ToolChains/Hexagon.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Driver/ToolChains/Hexagon.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -551,6 +551,8 @@ HexagonToolChain::GetCXXStdlibType(const ArgList &Args) const {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index fb54f73bcd4c..0260a32096af 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- a/tools/clang/lib/Driver/ToolChains/Hexagon.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ b/tools/clang/lib/Driver/ToolChains/Hexagon.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -551,6 +551,8 @@
</span>      return ToolChain::CST_Libstdcxx;
  
    StringRef Value = A->getValue();
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  if (Value == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  if (Value == "macports-libstdc++" || Value == "libstdc++_macports")
</span> +    return ToolChain::CST_MacPortsLibstdcxx;
    if (Value != "libstdc++")
      getDriver().Diag(diag::err_drv_invalid_stdlib_name) << A->getAsString(Args);
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>---- orig/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ new/tools/clang/lib/Driver/ToolChain.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -766,6 +766,8 @@ ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return ToolChain::CST_Libcxx;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   else if (LibName == "libstdc++")
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return ToolChain::CST_Libstdcxx;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  else if (LibName == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    return ToolChain::CST_MacPortsLibstdcxx;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   else if (LibName == "platform")
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return GetDefaultCXXStdlibType();
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -847,6 +849,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git a/clang/lib/Frontend/InitHeaderSearch.cpp b/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index bc31445d6d08..abc3750edec0 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- a/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ b/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -110,7 +110,7 @@ static bool CanPrefixSysroot(StringRef Path) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if defined(_WIN32)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+   return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-  return llvm::sys::path::is_absolute(Path);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  return llvm::sys::path::is_absolute(Path) && Path.find("@@MACPORTS_GCC_INCLUDE_DIR@@")!=0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span>  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   case ToolChain::CST_Libstdcxx:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  case ToolChain::CST_MacPortsLibstdcxx:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     CmdArgs.push_back("-lstdc++");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     break;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-- 
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+2.21.1 (Apple Git-122.3)
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-devel/Portfile b/lang/llvm-devel/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 008a206b82c..1622e51eee3 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-devel/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-devel/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -45,9 +45,9 @@ checksums               rmd160  ee02192e14f7ccfe04c0af7e0aac8633587dafdc \
</span>                         size    158064059
 
 name                    llvm-${llvm_version}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-revision                0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+revision                1
</span> subport                 mlir-${llvm_version}  { revision 0 }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-subport                 clang-${llvm_version} { revision 0 }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+subport                 clang-${llvm_version} { revision 1 }
</span> subport                 lldb-${llvm_version}  { revision 0 }
 subport                 flang-${llvm_version} { revision 0 }
 
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -146,6 +146,7 @@ patchfiles-append \
</span>     0012-compiler-rt-add-some-defs-missing-in-older-SDKs.patch \
     0013-clang-add-back-runtime-libraries-used-on-10.4-and-10.patch \
     0015-Fixup-libstdc-header-search-paths-for-older-versions.patch \
<span style='display:block; white-space:pre;background:#e0ffe0;'>+    0019-10.6-and-less-use-emulated-TLS-before-10.7.patch \
</span>     0025-lldb-add-defines-needed-for-older-SDKs.patch
 
 if {${os.platform} eq "darwin" && ${os.major} < 14} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -156,7 +157,6 @@ if {${os.platform} eq "darwin" && ${os.major} < 14} {
</span> if {${os.platform} eq "darwin" && ${os.major} < 11} {
     patchfiles-append \
         0017-10.6-and-less-libcxx-work-around-no-reexported_symbo.patch \
<span style='display:block; white-space:pre;background:#ffe0e0;'>-        0019-10.6-and-less-use-emulated-TLS-before-10.7.patch \
</span>         0020-10.6-and-less-work-around-no-directory-watcher-befor.patch \
         0021-10.6-and-less-libcxx-disable-Availability-tests.patch
 }
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -504,65 +504,56 @@ if {${subport} eq "clang-${llvm_version}"} {
</span>         default_variants-append +defaultlibcxx
     }
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    variant libstdcxx description {-stdlib=macports-libstdc++ searches for MacPorts libstdc++} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    variant libstdcxx description {-stdlib=libstdc++_macports searches for MacPorts libstdc++} {
</span> 
         patchfiles-append 0005-clang-support-macports-libstdcxx.patch
 
         post-patch {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+            if { ${configure.build_arch} eq "arm64" } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                # see https://github.com/macports/macports-ports/commit/be1e11a368f672d927a7bdb381f2fa71a79ba483
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                set gcc_arch    aarch64
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                set gcc_arch    ${configure.build_arch}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span>             reinplace "s|@@MACPORTS_GCC_INCLUDE_DIR@@|${prefix}/include/gcc/c++|g" \
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${patch.dir}/clang/lib/Frontend/InitHeaderSearch.cpp \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                ${patch.dir}/clang/lib/Lex/InitHeaderSearch.cpp \
</span>                 ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_HOST_NAME@@|${build_arch}-apple-darwin${os.major}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            reinplace "s|@@MACPORTS_HOST_NAME@@|${gcc_arch}-apple-darwin${os.major}|g" \
</span>                 ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
             reinplace "s|@@MACPORTS_libstdc++@@|${prefix}/lib/libgcc/libstdc++.6.dylib|g" \
                 ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # GCC was built for ${build_arch}-apple-darwin${os.major}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # GCC was built for ${configure.build_arch}-apple-darwin${os.major}
</span>             # if GCC was also built universal, it has an extra include directory
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # if ${build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            # MacPorts GCC can not compile across platforms
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            switch ${build_arch} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 32-bit, there is an extra 64-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # if ${configure.build_arch} is 64-bit, there is an extra 32-bit subdirectory
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # MacPorts GCC cannot compile across platforms
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            switch ${configure.build_arch} {
</span>                 x86_64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   "i386"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::x86_64 ? "" : "i386"|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
                 i386 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::x86_64 ? "x86_64" : ""|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
                 ppc64 {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    "ppc"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::ppc64 ? "" : "ppc"|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
                 ppc {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_ppc64  "ppc64"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_i386   ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    set gcc_subdirectory_x86_64 "x86_64"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|getTriple().getArch() == llvm::Triple::ppc64 ? "ppc64" : ""|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                arm64 {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    reinplace {s|@@MACPORTS_TEST_32_64@@|""|g} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span>                 }
             }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@|${gcc_subdirectory_x86_64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_i386@@|${gcc_subdirectory_i386}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@|${gcc_subdirectory_ppc64}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            reinplace "s|@@MACPORTS_GCC_SUBDIRECTORY_ppc@@|${gcc_subdirectory_ppc}|g" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                ${patch.dir}/clang/lib/Driver/ToolChains/Darwin.cpp
</span>         }
     }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    # at present, only the non-arm archs can use this variant
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    if {${build_arch} in "x86_64 i386 ppc64 ppc"} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        default_variants-append +libstdcxx
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    default_variants-append +libstdcxx
</span> }
 
 # For releases
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-devel/files/0005-clang-support-macports-libstdcxx.patch b/lang/llvm-devel/files/0005-clang-support-macports-libstdcxx.patch
</span><span style='display:block; white-space:pre;color:#808080;'>index af3794c4457..cd5cee0c407 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-devel/files/0005-clang-support-macports-libstdcxx.patch
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-devel/files/0005-clang-support-macports-libstdcxx.patch
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -5,12 +5,10 @@ Subject: [PATCH 05/24] clang: support macports-libstdcxx
</span> requires reinplace of search paths
 ---
  clang/include/clang/Driver/ToolChain.h        |  3 +-
<span style='display:block; white-space:pre;background:#ffe0e0;'>- clang/include/clang/Lex/HeaderSearchOptions.h |  3 ++
</span>  clang/lib/Driver/ToolChain.cpp                |  3 ++
  clang/lib/Driver/ToolChains/Darwin.cpp        | 40 ++++++++++++++-----
  clang/lib/Driver/ToolChains/Hexagon.cpp       |  2 +
<span style='display:block; white-space:pre;background:#ffe0e0;'>- clang/lib/Frontend/CompilerInvocation.cpp.rej | 21 ++++++++++
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- clang/lib/Frontend/InitHeaderSearch.cpp       |  2 +-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ clang/lib/Lex/InitHeaderSearch.cpp       |  2 +-
</span>  7 files changed, 63 insertions(+), 11 deletions(-)
  create mode 100644 clang/lib/Frontend/CompilerInvocation.cpp.rej
 
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -18,45 +16,28 @@ diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver
</span> index 28c37a44e1eb..78fcaec7bfb0 100644
 --- a/clang/include/clang/Driver/ToolChain.h
 +++ b/clang/include/clang/Driver/ToolChain.h
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -94,7 +94,8 @@ public:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -94,6 +94,7 @@ public:
</span>  
    enum CXXStdlibType {
      CST_Libcxx,
<span style='display:block; white-space:pre;background:#ffe0e0;'>--    CST_Libstdcxx
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_Libstdcxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    CST_MacPortsLibstdcxx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    CST_MacPortsLibstdcxx,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CST_Libstdcxx
</span>    };
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   enum RuntimeLibType {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-diff --git a/clang/include/clang/Lex/HeaderSearchOptions.h b/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-index 42f3cff8c57a..97a01793c12c 100644
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- a/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ b/clang/include/clang/Lex/HeaderSearchOptions.h
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -189,6 +189,9 @@ public:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   /// Use libc++ instead of the default libstdc++.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   unsigned UseLibcxx : 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  /// Use MacPorts libstdc++ instead of default system libstdc++.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  unsigned UseMacPortsLibstdcxx : 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   /// Whether header search information should be output as for -v.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   unsigned Verbose : 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span> diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
 index b2ddef141a75..6160843b6885 100644
 --- a/clang/lib/Driver/ToolChain.cpp
 +++ b/clang/lib/Driver/ToolChain.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -826,7 +826,9 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -850,6 +850,8 @@
</span>      cxxStdlibType = ToolChain::CST_Libcxx;
    else if (LibName == "libstdc++")
      cxxStdlibType = ToolChain::CST_Libstdcxx;
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  else if (LibName == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  else if (LibName == "macports-libstdc++" || LibName == "libstdc++_macports")
</span> +    cxxStdlibType = ToolChain::CST_MacPortsLibstdcxx;
    else if (LibName == "platform")
      cxxStdlibType = GetDefaultCXXStdlibType();
    else {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -1017,6 +1019,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -969,6 +971,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
</span>      break;
  
    case ToolChain::CST_Libstdcxx:
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -68,127 +49,53 @@ diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChain
</span> index eb7bd4aec898..daa8e520e404 100644
 --- a/clang/lib/Driver/ToolChains/Darwin.cpp
 +++ b/clang/lib/Driver/ToolChains/Darwin.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2039,8 +2039,9 @@ void DarwinClang::AddClangCXXStdlibIncludeArgs(
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     return;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   llvm::StringRef Sysroot = GetHeaderSysroot(DriverArgs);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  CXXStdlibType Type = GetCXXStdlibType(DriverArgs);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--  switch (GetCXXStdlibType(DriverArgs)) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  switch (Type) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-   case ToolChain::CST_Libcxx: {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     // On Darwin, libc++ can be installed in one of the following two places:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     // 1. Alongside the compiler in         <install>/include/c++/v1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2082,6 +2083,7 @@ void DarwinClang::AddClangCXXStdlibIncludeArgs(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -2282,6 +2282,16 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     break;
</span>    }
  
<span style='display:block; white-space:pre;background:#e0ffe0;'>++  case ToolChain::CST_MacPortsLibstdcxx: {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    bool IsBaseFoundMacPorts = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, llvm::StringRef("@@MACPORTS_GCC_INCLUDE_DIR@@"),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                             "",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                             "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++                                             @@MACPORTS_TEST_32_64@@);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    if (!IsBaseFoundMacPorts) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++      getDriver().Diag(diag::warn_drv_libstdcxx_not_found);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    }}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span>    case ToolChain::CST_Libstdcxx:
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  case ToolChain::CST_MacPortsLibstdcxx:
</span>      llvm::SmallString<128> UsrIncludeCxx = Sysroot;
      llvm::sys::path::append(UsrIncludeCxx, "usr", "include", "c++");
<span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2092,10 +2094,17 @@ void DarwinClang::AddClangCXXStdlibIncludeArgs(
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::ppc64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--      IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "powerpc-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                arch == llvm::Triple::ppc64 ? "ppc64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound = false;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (Type==ToolChain::CST_MacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, llvm::StringRef("@@MACPORTS_GCC_INCLUDE_DIR@@"),
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  arch == llvm::Triple::ppc64 ? "@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@" : "@@MACPORTS_GCC_SUBDIRECTORY_ppc@@");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "powerpc-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 arch == llvm::Triple::ppc64 ? "ppc64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                 "4.0.0", "powerpc-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                  arch == llvm::Triple::ppc64 ? "ppc64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2103,10 +2112,17 @@ void DarwinClang::AddClangCXXStdlibIncludeArgs(
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-     case llvm::Triple::x86_64:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--      IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                "i686-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--                                                arch == llvm::Triple::x86_64 ? "x86_64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound = false;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      if (Type==ToolChain::CST_MacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+        IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, llvm::StringRef("@@MACPORTS_GCC_INCLUDE_DIR@@"),
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  "@@MACPORTS_HOST_NAME@@",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                  arch == llvm::Triple::x86_64 ? "@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@" : "@@MACPORTS_GCC_SUBDIRECTORY_i386@@");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "4.2.1",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 "i686-apple-darwin10",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+                                                 arch == llvm::Triple::x86_64 ? "x86_64" : "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-       IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                 "4.0.0", "i686-apple-darwin8",
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                  "");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -2149,6 +2165,12 @@ void DarwinClang::AddCXXStdlibLibArgs(const ArgList &Args,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -2349,6 +2360,10 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+     CmdArgs.push_back("-lc++");
</span>      break;
  
<span style='display:block; white-space:pre;background:#ffe0e0;'>-   case ToolChain::CST_Libstdcxx:
</span> +  case ToolChain::CST_MacPortsLibstdcxx:
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+    if (Type==ToolChain::CST_MacPortsLibstdcxx && getVFS().exists("@@MACPORTS_libstdc++@@")) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      CmdArgs.push_back("@@MACPORTS_libstdc++@@");
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      return;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    CmdArgs.push_back("@@MACPORTS_libstdc++@@");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++    break;
</span> +
<span style='display:block; white-space:pre;background:#e0ffe0;'>+   case ToolChain::CST_Libstdcxx:
</span>      // Unfortunately, -lstdc++ doesn't always exist in the standard search path;
      // it was previously found in the gcc lib dir. However, for all the Darwin
<span style='display:block; white-space:pre;background:#ffe0e0;'>-     // platforms we care about it was -lstdc++.6, so we search for that
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp
 index fb54f73bcd4c..0260a32096af 100644
 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp
 +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp
<span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -643,6 +643,8 @@ HexagonToolChain::GetCXXStdlibType(const ArgList &Args) const {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -758,6 +758,8 @@ HexagonToolChain::GetCXXStdlibType(const ArgList &Args) const {
</span>        return ToolChain::CST_Libstdcxx;
    }
    StringRef Value = A->getValue();
<span style='display:block; white-space:pre;background:#ffe0e0;'>-+  if (Value == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++  if (Value == "macports-libstdc++" || Value == "libstdc++_macports")
</span> +    return ToolChain::CST_MacPortsLibstdcxx;
    if (Value != "libstdc++" && Value != "libc++")
      getDriver().Diag(diag::err_drv_invalid_stdlib_name) << A->getAsString(Args);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- 
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-diff --git a/clang/lib/Frontend/CompilerInvocation.cpp.rej b/clang/lib/Frontend/CompilerInvocation.cpp.rej
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-new file mode 100644
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-index 000000000000..227618c333c4
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>---- /dev/null
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ b/clang/lib/Frontend/CompilerInvocation.cpp.rej
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -0,0 +1,21 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+***************
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+*** 2939,2946 ****
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  #include "clang/Driver/Options.inc"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  #undef HEADER_SEARCH_OPTION_WITH_MARSHALLING
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+-   if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ))
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    // Canonicalize -fmodules-cache-path before storing it.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    SmallString<128> P(Args.getLastArgValue(OPT_fmodules_cache_path));
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+--- 2939,2948 ----
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  #include "clang/Driver/Options.inc"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  #undef HEADER_SEARCH_OPTION_WITH_MARSHALLING
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-++   if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ)) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+      Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-++     Opts.UseMacPortsLibstdcxx = (strcmp(A->getValue(), "macports-libstdc++") == 0);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-++   }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+  
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    // Canonicalize -fmodules-cache-path before storing it.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+    SmallString<128> P(Args.getLastArgValue(OPT_fmodules_cache_path));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> diff --git a/clang/lib/Frontend/InitHeaderSearch.cpp b/clang/lib/Frontend/InitHeaderSearch.cpp
 index bc31445d6d08..abc3750edec0 100644
<span style='display:block; white-space:pre;background:#ffe0e0;'>---- a/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-+++ b/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-@@ -108,7 +108,7 @@ static bool CanPrefixSysroot(StringRef Path) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- a/clang/lib/Lex/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ b/clang/lib/Lex/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -117,7 +117,7 @@ static bool CanPrefixSysroot(StringRef Path) {
</span>  #if defined(_WIN32)
    return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
  #else
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -199,4 +106,3 @@ index bc31445d6d08..abc3750edec0 100644
</span>  
 -- 
 2.21.1 (Apple Git-122.3)
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span></pre><pre style='margin:0'>

</pre>