[PATCH] D14847: Support CMake's clang_rt.profile library naming scheme

Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 19 16:22:08 PST 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL253625: Support CMake's clang_rt.profile library naming scheme (authored by cbieneman).

Changed prior to commit:
  http://reviews.llvm.org/D14847?vs=40712&id=40717#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14847

Files:
  cfe/trunk/lib/Driver/ToolChains.cpp

Index: cfe/trunk/lib/Driver/ToolChains.cpp
===================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp
+++ cfe/trunk/lib/Driver/ToolChains.cpp
@@ -323,21 +323,35 @@
                               ArgStringList &CmdArgs) const {
   if (!needsProfileRT(Args)) return;
 
+  // TODO: Clean this up once autoconf is gone
+  SmallString<128> P(getDriver().ResourceDir);
+  llvm::sys::path::append(P, "lib", "darwin");
+  const char *Library = "libclang_rt.profile_osx.a";
+
   // Select the appropriate runtime library for the target.
-  if (isTargetWatchOSBased()) {
-    AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.profile_watchos.a",
-                      /*AlwaysLink*/ true);
-  } else if (isTargetTvOSBased()) {
-    AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.profile_tvos.a",
-                      /*AlwaysLink*/ true);
-  } else if (isTargetIOSBased()) {
-    AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.profile_ios.a",
-                      /*AlwaysLink*/ true);
+  if (isTargetWatchOS()) {
+    Library = "libclang_rt.profile_watchos.a";
+  } else if (isTargetWatchOSSimulator()) {
+    llvm::sys::path::append(P, "libclang_rt.profile_watchossim.a");
+    Library = getVFS().exists(P) ? "libclang_rt.profile_watchossim.a"
+                                 : "libclang_rt.profile_watchos.a";
+  } else if (isTargetTvOS()) {
+    Library = "libclang_rt.profile_tvos.a";
+  } else if (isTargetTvOSSimulator()) {
+    llvm::sys::path::append(P, "libclang_rt.profile_tvossim.a");
+    Library = getVFS().exists(P) ? "libclang_rt.profile_tvossim.a"
+                                 : "libclang_rt.profile_tvos.a";
+  } else if (isTargetIPhoneOS()) {
+    Library = "libclang_rt.profile_ios.a";
+  } else if (isTargetIOSSimulator()) {
+    llvm::sys::path::append(P, "libclang_rt.profile_iossim.a");
+    Library = getVFS().exists(P) ? "libclang_rt.profile_iossim.a"
+                                 : "libclang_rt.profile_ios.a";
   } else {
     assert(isTargetMacOS() && "unexpected non MacOS platform");
-    AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.profile_osx.a",
-                      /*AlwaysLink*/ true);
   }
+  AddLinkRuntimeLib(Args, CmdArgs, Library,
+                    /*AlwaysLink*/ true);
   return;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14847.40717.patch
Type: text/x-patch
Size: 2286 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151120/16d891d9/attachment.bin>


More information about the cfe-commits mailing list