[Driver] Use platform-appropriate profiling libraries for WatchOS, TVOS

When adding profiling instrumentation, use libclang_rt.profile_tvos.a
for TVOS targets and libclang_rt.profile_watchos.a for WatchOS targets.

I've also fixed up a comment and added an assert() that prevents us from
defaulting to an incorrect platform.

Differential Revision: http://reviews.llvm.org/D14521

Reviewed-by: t.p.northover
llvm-svn: 252558
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp
index 5df96ce..f83c7c9 100644
--- a/clang/lib/Driver/ToolChains.cpp
+++ b/clang/lib/Driver/ToolChains.cpp
@@ -324,12 +324,20 @@
   if (!needsProfileRT(Args)) return;
 
   // Select the appropriate runtime library for the target.
-  if (isTargetIOSBased())
+  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);
-  else
+  } else {
+    assert(isTargetMacOS() && "unexpected non MacOS platform");
     AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.profile_osx.a",
                       /*AlwaysLink*/ true);
+  }
   return;
 }