[PATCH] D101682: [Driver] Fix `ToolChain::getCompilerRTPath()` to return the correct path on Darwin.

2021-05-01 Thread Dan Liew via Phabricator via cfe-commits
delcypher marked an inline comment as done.
delcypher added inline comments.



Comment at: clang/lib/Driver/ToolChain.cpp:401
 return "aix";
+  case llvm::Triple::Darwin:
+return "darwin";

arphaman wrote:
> Should this also apply to `llvm::Triple::MacOSX` , `iOS`, and other Darwin 
> OSes?
Good catch. I've fixed this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101682/new/

https://reviews.llvm.org/D101682

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101682: [Driver] Fix `ToolChain::getCompilerRTPath()` to return the correct path on Darwin.

2021-05-01 Thread Dan Liew via Phabricator via cfe-commits
delcypher updated this revision to Diff 342152.
delcypher added a comment.

- Support other Apple target triples.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101682/new/

https://reviews.llvm.org/D101682

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/test/Driver/darwin-print-file-name.c
  clang/test/Driver/darwin-print-runtime-dir.c


Index: clang/test/Driver/darwin-print-runtime-dir.c
===
--- /dev/null
+++ clang/test/Driver/darwin-print-runtime-dir.c
@@ -0,0 +1,24 @@
+// Regression test. Previously the output returned the full OS name
+// (e.g. `darwin20.3.0`) instead of just `darwin`.
+
+// RUN: %clang -print-runtime-dir --target=x86_64-apple-darwin20.3.0 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s
+
+// RUN: %clang -print-runtime-dir --target=x86_64-apple-macosx11.0.0 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s
+
+// RUN: %clang -print-runtime-dir --target=arm64-apple-ios14.0.0 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s
+
+// RUN: %clang -print-runtime-dir --target=arm64-apple-tvos14.0.0 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s
+
+// RUN: %clang -print-runtime-dir --target=arm64-apple-watchos5.0.0 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s
+
+// PRINT-RUNTIME-DIR: lib{{/|\\}}darwin{{$}}
Index: clang/test/Driver/darwin-print-file-name.c
===
--- /dev/null
+++ clang/test/Driver/darwin-print-file-name.c
@@ -0,0 +1,27 @@
+// Regression test. Previously Clang just returned the library name instead
+// of the full path.
+
+// RUN: %clang -print-file-name=libclang_rt.osx.a 
--target=x86_64-apple-darwin20.3.0 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s
+
+// RUN: %clang -print-file-name=libclang_rt.osx.a 
--target=x86_64-apple-macosx11.0.0 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s
+
+// PRINT-RUNTIME-DIR: lib{{/|\\}}darwin{{/|\\}}libclang_rt.osx.a
+
+// RUN: %clang -print-file-name=libclang_rt.ios.a 
--target=arm64-apple-ios14.0.0 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR-IOS %s
+// PRINT-RUNTIME-DIR-IOS: lib{{/|\\}}darwin{{/|\\}}libclang_rt.ios.a
+
+// RUN: %clang -print-file-name=libclang_rt.tvos.a 
--target=arm64-apple-tvos14.0.0 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR-TVOS %s
+// PRINT-RUNTIME-DIR-TVOS: lib{{/|\\}}darwin{{/|\\}}libclang_rt.tvos.a
+
+// RUN: %clang -print-file-name=libclang_rt.watchos.a 
--target=arm64-apple-watchos5.0.0 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR-WATCHOS %s
+// PRINT-RUNTIME-DIR-WATCHOS: lib{{/|\\}}darwin{{/|\\}}libclang_rt.watchos.a
Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -398,6 +398,12 @@
 return "sunos";
   case llvm::Triple::AIX:
 return "aix";
+  case llvm::Triple::Darwin:
+  case llvm::Triple::MacOSX:
+  case llvm::Triple::IOS:
+  case llvm::Triple::TvOS:
+  case llvm::Triple::WatchOS:
+return "darwin";
   default:
 return getOS();
   }


Index: clang/test/Driver/darwin-print-runtime-dir.c
===
--- /dev/null
+++ clang/test/Driver/darwin-print-runtime-dir.c
@@ -0,0 +1,24 @@
+// Regression test. Previously the output returned the full OS name
+// (e.g. `darwin20.3.0`) instead of just `darwin`.
+
+// RUN: %clang -print-runtime-dir --target=x86_64-apple-darwin20.3.0 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s
+
+// RUN: %clang -print-runtime-dir --target=x86_64-apple-macosx11.0.0 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s
+
+// RUN: %clang -print-runtime-dir --target=arm64-apple-ios14.0.0 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s
+
+// RUN: %clang -print-runtime-dir --target=arm64-apple-tvos14.0.0 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s
+
+// RUN: %clang -print-runtime-dir --target=arm64-apple-watchos5.0.0 \
+// RUN:

[PATCH] D101682: [Driver] Fix `ToolChain::getCompilerRTPath()` to return the correct path on Darwin.

2021-04-30 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added inline comments.



Comment at: clang/lib/Driver/ToolChain.cpp:401
 return "aix";
+  case llvm::Triple::Darwin:
+return "darwin";

Should this also apply to `llvm::Triple::MacOSX` , `iOS`, and other Darwin OSes?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101682/new/

https://reviews.llvm.org/D101682

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101682: [Driver] Fix `ToolChain::getCompilerRTPath()` to return the correct path on Darwin.

2021-04-30 Thread Dan Liew via Phabricator via cfe-commits
delcypher created this revision.
delcypher added reviewers: arphaman, dexonsmith, kubamracek, aralisza, yln.
delcypher requested review of this revision.
Herald added a project: clang.

When the Darwin target triple included the OS version number this would cause
`ToolChain::getCompilerRTPath()` to return an incorrect path because the
suffix was something like `darwin20.3.0` instead of `darwin`.

This in turn caused

- `-print-runtime-dir` to return a non-existant path.
- `-print-file-name=` to not return a useful path.

Two regression tests are included.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101682

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/test/Driver/darwin-print-file-name.c
  clang/test/Driver/darwin-print-runtime-dir.c


Index: clang/test/Driver/darwin-print-runtime-dir.c
===
--- /dev/null
+++ clang/test/Driver/darwin-print-runtime-dir.c
@@ -0,0 +1,6 @@
+// Regression test. Previously the output included the OS version number
+// which was not correct.
+// RUN: %clang -print-runtime-dir --target=x86_64-apple-darwin20.3.0 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s
+// PRINT-RUNTIME-DIR: lib{{/|\\}}darwin{{$}}
\ No newline at end of file
Index: clang/test/Driver/darwin-print-file-name.c
===
--- /dev/null
+++ clang/test/Driver/darwin-print-file-name.c
@@ -0,0 +1,6 @@
+// Regression test. Previously Clang just returned the library name instead
+// of the full path.
+// RUN: %clang -print-file-name=libclang_rt.osx.a 
--target=x86_64-apple-darwin20.3.0 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s
+// PRINT-RUNTIME-DIR: lib{{/|\\}}darwin{{/|\\}}libclang_rt.osx.a
\ No newline at end of file
Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -398,6 +398,8 @@
 return "sunos";
   case llvm::Triple::AIX:
 return "aix";
+  case llvm::Triple::Darwin:
+return "darwin";
   default:
 return getOS();
   }


Index: clang/test/Driver/darwin-print-runtime-dir.c
===
--- /dev/null
+++ clang/test/Driver/darwin-print-runtime-dir.c
@@ -0,0 +1,6 @@
+// Regression test. Previously the output included the OS version number
+// which was not correct.
+// RUN: %clang -print-runtime-dir --target=x86_64-apple-darwin20.3.0 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s
+// PRINT-RUNTIME-DIR: lib{{/|\\}}darwin{{$}}
\ No newline at end of file
Index: clang/test/Driver/darwin-print-file-name.c
===
--- /dev/null
+++ clang/test/Driver/darwin-print-file-name.c
@@ -0,0 +1,6 @@
+// Regression test. Previously Clang just returned the library name instead
+// of the full path.
+// RUN: %clang -print-file-name=libclang_rt.osx.a --target=x86_64-apple-darwin20.3.0 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:  | FileCheck --check-prefix=PRINT-RUNTIME-DIR %s
+// PRINT-RUNTIME-DIR: lib{{/|\\}}darwin{{/|\\}}libclang_rt.osx.a
\ No newline at end of file
Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -398,6 +398,8 @@
 return "sunos";
   case llvm::Triple::AIX:
 return "aix";
+  case llvm::Triple::Darwin:
+return "darwin";
   default:
 return getOS();
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits