[PATCH] D80225: [Driver] Recognize -fuse-ld={bfd, gold, lld} but don't prepend "ld." or "ld64." for other values

2020-05-27 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

I've submitted a related change to accept relative paths for `-fuse-ld` 
https://reviews.llvm.org/D80660


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80225



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


[PATCH] D80660: clang: Add support for relative linker paths with -fuse-ld

2020-05-27 Thread Keith Smiley via Phabricator via cfe-commits
keith created this revision.
keith added reviewers: kastiglione, MaskRay, theraven, rnk.
Herald added a project: clang.

This adds support for resolving linker executable paths relatively
instead of requiring them to be names, or absolute paths. This is useful
if you're vendoring an in-tree linker, and do not want to potentially
invalidate shared remote caches by using local absolute paths in command
lines.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80660

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/test/Driver/fuse-ld.c


Index: clang/test/Driver/fuse-ld.c
===
--- clang/test/Driver/fuse-ld.c
+++ clang/test/Driver/fuse-ld.c
@@ -4,6 +4,20 @@
 // RUN:   | FileCheck %s --check-prefix=CHECK-ABSOLUTE-LD
 // CHECK-ABSOLUTE-LD: /usr/local/bin/or1k-linux-ld
 
+// RUN: cd "%S" && %clang %s -### \
+// RUN: -fuse-ld=Inputs/fuse_ld_windows/ld.foo.exe 2>&1 \
+// RUN: -target x86_64-unknown-linux \
+// RUN:   | FileCheck %s --check-prefix=CHECK-RELATIVE-LD
+// CHECK-RELATIVE-LD-NOT: error: invalid linker name
+// CHECK-RELATIVE-LD: test/Driver/Inputs/fuse_ld_windows/ld.foo.exe
+
+// RUN: %clang %s -### \
+// RUN: -fuse-ld=fuse_ld_windows/ld.foo.exe 2>&1 \
+// RUN: -target x86_64-unknown-linux \
+// RUN: -working-directory "%S/Inputs" \
+// RUN:   | FileCheck %s --check-prefix=CHECK-RELATIVE-WORKDIR-LD
+// CHECK-RELATIVE-WORKDIR-LD-NOT: error: invalid linker name
+// CHECK-RELATIVE-WORKDIR-LD: test/Driver/Inputs/fuse_ld_windows/ld.foo.exe
 
 // RUN: %clang %s -### \
 // RUN: -target x86_64-unknown-freebsd 2>&1 \
Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -554,6 +554,18 @@
 std::string LinkerPath(GetProgramPath(LinkerName.c_str()));
 if (llvm::sys::fs::can_execute(LinkerPath))
   return LinkerPath;
+
+const Arg *WorkingDir = Args.getLastArg(options::OPT_working_directory);
+SmallString<128> ResolvedPath(UseLinker);
+if (WorkingDir) {
+  sys::fs::make_absolute(WorkingDir->getValue(), ResolvedPath);
+  if (llvm::sys::fs::can_execute(ResolvedPath))
+return std::string(ResolvedPath);
+}
+
+if (!sys::fs::make_absolute(ResolvedPath) &&
+llvm::sys::fs::can_execute(ResolvedPath))
+  return std::string(ResolvedPath);
   }
 
   if (A)


Index: clang/test/Driver/fuse-ld.c
===
--- clang/test/Driver/fuse-ld.c
+++ clang/test/Driver/fuse-ld.c
@@ -4,6 +4,20 @@
 // RUN:   | FileCheck %s --check-prefix=CHECK-ABSOLUTE-LD
 // CHECK-ABSOLUTE-LD: /usr/local/bin/or1k-linux-ld
 
+// RUN: cd "%S" && %clang %s -### \
+// RUN: -fuse-ld=Inputs/fuse_ld_windows/ld.foo.exe 2>&1 \
+// RUN: -target x86_64-unknown-linux \
+// RUN:   | FileCheck %s --check-prefix=CHECK-RELATIVE-LD
+// CHECK-RELATIVE-LD-NOT: error: invalid linker name
+// CHECK-RELATIVE-LD: test/Driver/Inputs/fuse_ld_windows/ld.foo.exe
+
+// RUN: %clang %s -### \
+// RUN: -fuse-ld=fuse_ld_windows/ld.foo.exe 2>&1 \
+// RUN: -target x86_64-unknown-linux \
+// RUN: -working-directory "%S/Inputs" \
+// RUN:   | FileCheck %s --check-prefix=CHECK-RELATIVE-WORKDIR-LD
+// CHECK-RELATIVE-WORKDIR-LD-NOT: error: invalid linker name
+// CHECK-RELATIVE-WORKDIR-LD: test/Driver/Inputs/fuse_ld_windows/ld.foo.exe
 
 // RUN: %clang %s -### \
 // RUN: -target x86_64-unknown-freebsd 2>&1 \
Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -554,6 +554,18 @@
 std::string LinkerPath(GetProgramPath(LinkerName.c_str()));
 if (llvm::sys::fs::can_execute(LinkerPath))
   return LinkerPath;
+
+const Arg *WorkingDir = Args.getLastArg(options::OPT_working_directory);
+SmallString<128> ResolvedPath(UseLinker);
+if (WorkingDir) {
+  sys::fs::make_absolute(WorkingDir->getValue(), ResolvedPath);
+  if (llvm::sys::fs::can_execute(ResolvedPath))
+return std::string(ResolvedPath);
+}
+
+if (!sys::fs::make_absolute(ResolvedPath) &&
+llvm::sys::fs::can_execute(ResolvedPath))
+  return std::string(ResolvedPath);
   }
 
   if (A)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80660: clang: Add support for relative linker paths with -fuse-ld

2020-05-28 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 267069.
keith added a comment.

Update tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80660

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/test/Driver/fuse-ld.c


Index: clang/test/Driver/fuse-ld.c
===
--- clang/test/Driver/fuse-ld.c
+++ clang/test/Driver/fuse-ld.c
@@ -4,7 +4,6 @@
 // RUN:   | FileCheck %s --check-prefix=CHECK-ABSOLUTE-LD
 // CHECK-ABSOLUTE-LD: /usr/local/bin/or1k-linux-ld
 
-
 // RUN: %clang %s -### \
 // RUN: -target x86_64-unknown-freebsd 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-FREEBSD-LD
@@ -94,3 +93,18 @@
 // RUN:   | FileCheck %s --check-prefix CHECK-WINDOWS-MSVC-BFD
 // CHECK-WINDOWS-MSVC-BFD: "{{.*}}ld.bfd"
 // CHECK-WINDOWS-MSVC-BFD-SAME: "-o"
+
+// RUN: %clang %s -### \
+// RUN: -target x86_64-unknown-linux \
+// RUN: -working-directory "%S/Inputs" \
+// RUN: -fuse-ld=fuse_ld_windows/ld.foo.exe 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-RELATIVE-WORKDIR-LD
+// CHECK-RELATIVE-WORKDIR-LD-NOT: error: invalid linker name
+// CHECK-RELATIVE-WORKDIR-LD: 
test{{/|\\+}}Driver{{/|\\+}}Inputs/fuse_ld_windows/ld.foo.exe
+
+// RUN: cd "%S" && %clang %s -### \
+// RUN: -target x86_64-unknown-linux \
+// RUN: -fuse-ld=Inputs/fuse_ld_windows/ld.foo.exe 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-RELATIVE-LD
+// CHECK-RELATIVE-LD-NOT: error: invalid linker name
+// CHECK-RELATIVE-LD: 
test{{/|\\+}}Driver{{/|\\+}}Inputs/fuse_ld_windows/ld.foo.exe
Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -554,6 +554,18 @@
 std::string LinkerPath(GetProgramPath(LinkerName.c_str()));
 if (llvm::sys::fs::can_execute(LinkerPath))
   return LinkerPath;
+
+const Arg *WorkingDir = Args.getLastArg(options::OPT_working_directory);
+SmallString<128> ResolvedPath(UseLinker);
+if (WorkingDir) {
+  sys::fs::make_absolute(WorkingDir->getValue(), ResolvedPath);
+  if (llvm::sys::fs::can_execute(ResolvedPath))
+return std::string(ResolvedPath);
+}
+
+if (!sys::fs::make_absolute(ResolvedPath) &&
+llvm::sys::fs::can_execute(ResolvedPath))
+  return std::string(ResolvedPath);
   }
 
   if (A)


Index: clang/test/Driver/fuse-ld.c
===
--- clang/test/Driver/fuse-ld.c
+++ clang/test/Driver/fuse-ld.c
@@ -4,7 +4,6 @@
 // RUN:   | FileCheck %s --check-prefix=CHECK-ABSOLUTE-LD
 // CHECK-ABSOLUTE-LD: /usr/local/bin/or1k-linux-ld
 
-
 // RUN: %clang %s -### \
 // RUN: -target x86_64-unknown-freebsd 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-FREEBSD-LD
@@ -94,3 +93,18 @@
 // RUN:   | FileCheck %s --check-prefix CHECK-WINDOWS-MSVC-BFD
 // CHECK-WINDOWS-MSVC-BFD: "{{.*}}ld.bfd"
 // CHECK-WINDOWS-MSVC-BFD-SAME: "-o"
+
+// RUN: %clang %s -### \
+// RUN: -target x86_64-unknown-linux \
+// RUN: -working-directory "%S/Inputs" \
+// RUN: -fuse-ld=fuse_ld_windows/ld.foo.exe 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-RELATIVE-WORKDIR-LD
+// CHECK-RELATIVE-WORKDIR-LD-NOT: error: invalid linker name
+// CHECK-RELATIVE-WORKDIR-LD: test{{/|\\+}}Driver{{/|\\+}}Inputs/fuse_ld_windows/ld.foo.exe
+
+// RUN: cd "%S" && %clang %s -### \
+// RUN: -target x86_64-unknown-linux \
+// RUN: -fuse-ld=Inputs/fuse_ld_windows/ld.foo.exe 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-RELATIVE-LD
+// CHECK-RELATIVE-LD-NOT: error: invalid linker name
+// CHECK-RELATIVE-LD: test{{/|\\+}}Driver{{/|\\+}}Inputs/fuse_ld_windows/ld.foo.exe
Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -554,6 +554,18 @@
 std::string LinkerPath(GetProgramPath(LinkerName.c_str()));
 if (llvm::sys::fs::can_execute(LinkerPath))
   return LinkerPath;
+
+const Arg *WorkingDir = Args.getLastArg(options::OPT_working_directory);
+SmallString<128> ResolvedPath(UseLinker);
+if (WorkingDir) {
+  sys::fs::make_absolute(WorkingDir->getValue(), ResolvedPath);
+  if (llvm::sys::fs::can_execute(ResolvedPath))
+return std::string(ResolvedPath);
+}
+
+if (!sys::fs::make_absolute(ResolvedPath) &&
+llvm::sys::fs::can_execute(ResolvedPath))
+  return std::string(ResolvedPath);
   }
 
   if (A)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80660: clang: Add support for relative linker paths with -fuse-ld

2020-05-28 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

Thanks I moved them to the bottom and I believe I fixed them on windows!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80660



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


[PATCH] D80660: clang: Add support for relative linker paths with -fuse-ld

2020-05-28 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

The new test failure appears unrelated to my changes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80660



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


[PATCH] D80660: clang: Add support for relative linker paths with -fuse-ld

2020-06-02 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 267991.
keith added a comment.

Fix test on windows


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80660

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/test/Driver/fuse-ld.c


Index: clang/test/Driver/fuse-ld.c
===
--- clang/test/Driver/fuse-ld.c
+++ clang/test/Driver/fuse-ld.c
@@ -4,7 +4,6 @@
 // RUN:   | FileCheck %s --check-prefix=CHECK-ABSOLUTE-LD
 // CHECK-ABSOLUTE-LD: /usr/local/bin/or1k-linux-ld
 
-
 // RUN: %clang %s -### \
 // RUN: -target x86_64-unknown-freebsd 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-FREEBSD-LD
@@ -94,3 +93,18 @@
 // RUN:   | FileCheck %s --check-prefix CHECK-WINDOWS-MSVC-BFD
 // CHECK-WINDOWS-MSVC-BFD: "{{.*}}ld.bfd"
 // CHECK-WINDOWS-MSVC-BFD-SAME: "-o"
+
+// RUN: %clang %s -### \
+// RUN: -target x86_64-unknown-linux \
+// RUN: -working-directory "%S/Inputs" \
+// RUN: -fuse-ld=fuse_ld_windows/ld.foo.exe 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-RELATIVE-WORKDIR-LD
+// CHECK-RELATIVE-WORKDIR-LD-NOT: error: invalid linker name
+// CHECK-RELATIVE-WORKDIR-LD: 
test{{/|\\+}}Driver{{/|\\+}}Inputs{{/|\\+}}fuse_ld_windows/ld.foo.exe
+
+// RUN: cd "%S" && %clang %s -### \
+// RUN: -target x86_64-unknown-linux \
+// RUN: -fuse-ld=Inputs/fuse_ld_windows/ld.foo.exe 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-RELATIVE-LD
+// CHECK-RELATIVE-LD-NOT: error: invalid linker name
+// CHECK-RELATIVE-LD: 
test{{/|\\+}}Driver{{/|\\+}}Inputs{{/|\\+}}fuse_ld_windows/ld.foo.exe
Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -557,6 +557,18 @@
 std::string LinkerPath(GetProgramPath(LinkerName.c_str()));
 if (llvm::sys::fs::can_execute(LinkerPath))
   return LinkerPath;
+
+const Arg *WorkingDir = Args.getLastArg(options::OPT_working_directory);
+SmallString<128> ResolvedPath(UseLinker);
+if (WorkingDir) {
+  sys::fs::make_absolute(WorkingDir->getValue(), ResolvedPath);
+  if (llvm::sys::fs::can_execute(ResolvedPath))
+return std::string(ResolvedPath);
+}
+
+if (!sys::fs::make_absolute(ResolvedPath) &&
+llvm::sys::fs::can_execute(ResolvedPath))
+  return std::string(ResolvedPath);
   }
 
   if (A)


Index: clang/test/Driver/fuse-ld.c
===
--- clang/test/Driver/fuse-ld.c
+++ clang/test/Driver/fuse-ld.c
@@ -4,7 +4,6 @@
 // RUN:   | FileCheck %s --check-prefix=CHECK-ABSOLUTE-LD
 // CHECK-ABSOLUTE-LD: /usr/local/bin/or1k-linux-ld
 
-
 // RUN: %clang %s -### \
 // RUN: -target x86_64-unknown-freebsd 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-FREEBSD-LD
@@ -94,3 +93,18 @@
 // RUN:   | FileCheck %s --check-prefix CHECK-WINDOWS-MSVC-BFD
 // CHECK-WINDOWS-MSVC-BFD: "{{.*}}ld.bfd"
 // CHECK-WINDOWS-MSVC-BFD-SAME: "-o"
+
+// RUN: %clang %s -### \
+// RUN: -target x86_64-unknown-linux \
+// RUN: -working-directory "%S/Inputs" \
+// RUN: -fuse-ld=fuse_ld_windows/ld.foo.exe 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-RELATIVE-WORKDIR-LD
+// CHECK-RELATIVE-WORKDIR-LD-NOT: error: invalid linker name
+// CHECK-RELATIVE-WORKDIR-LD: test{{/|\\+}}Driver{{/|\\+}}Inputs{{/|\\+}}fuse_ld_windows/ld.foo.exe
+
+// RUN: cd "%S" && %clang %s -### \
+// RUN: -target x86_64-unknown-linux \
+// RUN: -fuse-ld=Inputs/fuse_ld_windows/ld.foo.exe 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-RELATIVE-LD
+// CHECK-RELATIVE-LD-NOT: error: invalid linker name
+// CHECK-RELATIVE-LD: test{{/|\\+}}Driver{{/|\\+}}Inputs{{/|\\+}}fuse_ld_windows/ld.foo.exe
Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -557,6 +557,18 @@
 std::string LinkerPath(GetProgramPath(LinkerName.c_str()));
 if (llvm::sys::fs::can_execute(LinkerPath))
   return LinkerPath;
+
+const Arg *WorkingDir = Args.getLastArg(options::OPT_working_directory);
+SmallString<128> ResolvedPath(UseLinker);
+if (WorkingDir) {
+  sys::fs::make_absolute(WorkingDir->getValue(), ResolvedPath);
+  if (llvm::sys::fs::can_execute(ResolvedPath))
+return std::string(ResolvedPath);
+}
+
+if (!sys::fs::make_absolute(ResolvedPath) &&
+llvm::sys::fs::can_execute(ResolvedPath))
+  return std::string(ResolvedPath);
   }
 
   if (A)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D81122: Reland: Use -fdebug-compilation-dir to form absolute paths in coverage mappings

2020-06-03 Thread Keith Smiley via Phabricator via cfe-commits
keith created this revision.
keith added reviewers: arphaman, vsk, rnk, cfe-commits, kastiglione.
Herald added subscribers: llvm-commits, dexonsmith.
Herald added projects: clang, LLVM.

This reverts commit 62808631acceaa8b78f8ab9b407eb6b943ff5f77.

This was previously reverted because llvm-cov's -path-equivalence usage
wasn't working as expected. This does work with
`-path-equivalence=,/bar` when used with `-fdebug-compilation-dir .`

More discussion: https://lists.llvm.org/pipermail/cfe-dev/2020-June/065668.html


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81122

Files:
  clang/lib/CodeGen/CoverageMappingGen.cpp
  clang/lib/CodeGen/CoverageMappingGen.h
  clang/test/CoverageMapping/debug-dir.cpp
  llvm/docs/CommandGuide/llvm-cov.rst

Index: llvm/docs/CommandGuide/llvm-cov.rst
===
--- llvm/docs/CommandGuide/llvm-cov.rst
+++ llvm/docs/CommandGuide/llvm-cov.rst
@@ -314,7 +314,9 @@
 
  Map the paths in the coverage data to local source file paths. This allows you
  to generate the coverage data on one machine, and then use llvm-cov on a
- different machine where you have the same files on a different path.
+ different machine where you have the same files on a different path. When
+ using this option with '-fdebug-compilation-dir .' pass nothing for the 'from'
+ value.
 
 .. program:: llvm-cov report
 
Index: clang/test/CoverageMapping/debug-dir.cpp
===
--- /dev/null
+++ clang/test/CoverageMapping/debug-dir.cpp
@@ -0,0 +1,16 @@
+// %s expands to an absolute path, so to test relative paths we need to create a
+// clean directory, put the source there, and cd into it.
+// RUN: rm -rf %t
+// RUN: mkdir -p %t/foo/bar/baz
+// RUN: cp %s %t/foo/bar/baz/debug-dir.cpp
+// RUN: cd %t/foo/bar
+
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -mllvm -enable-name-compression=false -main-file-name debug-dir.cpp baz/debug-dir.cpp  -o - | FileCheck -check-prefix=ABSOLUTE %s
+//
+// ABSOLUTE: @__llvm_coverage_mapping = {{.*"\\01.*foo.*bar.*baz.*debug-dir\.cpp}}
+
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -mllvm -enable-name-compression=false -main-file-name debug-dir.cpp baz/debug-dir.cpp -fdebug-compilation-dir . -o - | FileCheck -check-prefix=RELATIVE %s
+//
+// RELATIVE: @__llvm_coverage_mapping = {{.*"\\01[^/]*baz.*debug-dir\.cpp}}
+
+void f1() {}
Index: clang/lib/CodeGen/CoverageMappingGen.h
===
--- clang/lib/CodeGen/CoverageMappingGen.h
+++ clang/lib/CodeGen/CoverageMappingGen.h
@@ -60,14 +60,16 @@
   llvm::SmallDenseMap FileEntries;
   std::vector FunctionNames;
   std::vector FunctionRecords;
+  SmallString<256> CWD;
+
+  std::string normalizeFilename(StringRef Filename);
 
   /// Emit a function record.
   void emitFunctionMappingRecord(const FunctionInfo &Info,
  uint64_t FilenamesRef);
 
 public:
-  CoverageMappingModuleGen(CodeGenModule &CGM, CoverageSourceInfo &SourceInfo)
-  : CGM(CGM), SourceInfo(SourceInfo) {}
+  CoverageMappingModuleGen(CodeGenModule &CGM, CoverageSourceInfo &SourceInfo);
 
   CoverageSourceInfo &getSourceInfo() const {
 return SourceInfo;
Index: clang/lib/CodeGen/CoverageMappingGen.cpp
===
--- clang/lib/CodeGen/CoverageMappingGen.cpp
+++ clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -1279,13 +1279,6 @@
   }
 };
 
-std::string normalizeFilename(StringRef Filename) {
-  llvm::SmallString<256> Path(Filename);
-  llvm::sys::fs::make_absolute(Path);
-  llvm::sys::path::remove_dots(Path, /*remove_dot_dot=*/true);
-  return std::string(Path);
-}
-
 } // end anonymous namespace
 
 static void dump(llvm::raw_ostream &OS, StringRef FunctionName,
@@ -1318,6 +1311,24 @@
   }
 }
 
+CoverageMappingModuleGen::CoverageMappingModuleGen(
+CodeGenModule &CGM, CoverageSourceInfo &SourceInfo)
+: CGM(CGM), SourceInfo(SourceInfo) {
+  // Honor -fdebug-compilation-dir in paths in coverage data. Otherwise, use the
+  // regular working directory when normalizing paths.
+  if (!CGM.getCodeGenOpts().DebugCompilationDir.empty())
+CWD = CGM.getCodeGenOpts().DebugCompilationDir;
+  else
+llvm::sys::fs::current_path(CWD);
+}
+
+std::string CoverageMappingModuleGen::normalizeFilename(StringRef Filename) {
+  llvm::SmallString<256> Path(Filename);
+  llvm::sys::fs::make_absolute(CWD, Path);
+  llvm::sys::path::remove_dots(Path, /*remove_dot_dot=*/true);
+  return Path.str().str();
+}
+
 static std::string getInstrProfSection(const CodeGenModule &CGM,
llvm::InstrProfSectKind SK) {
   return llvm::getInstrProfSectionName(
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D81122: Reland: Use -fdebug-compilation-dir to form absolute paths in coverage mappings

2020-06-04 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 268510.
keith added a comment.

Update relative paths to include the leading ./

This makes these remappings more analogous to lldb's source remapping, and
makes using `-path-equivalence` with `llvm-cov` more familiar.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81122

Files:
  clang/lib/CodeGen/CoverageMappingGen.cpp
  clang/lib/CodeGen/CoverageMappingGen.h
  clang/test/CoverageMapping/debug-dir.cpp


Index: clang/test/CoverageMapping/debug-dir.cpp
===
--- /dev/null
+++ clang/test/CoverageMapping/debug-dir.cpp
@@ -0,0 +1,16 @@
+// %s expands to an absolute path, so to test relative paths we need to create 
a
+// clean directory, put the source there, and cd into it.
+// RUN: rm -rf %t
+// RUN: mkdir -p %t/foo/bar/baz
+// RUN: cp %s %t/foo/bar/baz/debug-dir.cpp
+// RUN: cd %t/foo/bar
+
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm 
-mllvm -enable-name-compression=false -main-file-name debug-dir.cpp 
baz/debug-dir.cpp  -o - | FileCheck -check-prefix=ABSOLUTE %s
+//
+// ABSOLUTE: @__llvm_coverage_mapping = 
{{.*"\\01.*foo.*bar.*baz.*debug-dir\.cpp}}
+
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm 
-mllvm -enable-name-compression=false -main-file-name debug-dir.cpp 
baz/debug-dir.cpp -fdebug-compilation-dir . -o - | FileCheck 
-check-prefix=RELATIVE %s
+//
+// RELATIVE: @__llvm_coverage_mapping = 
{{.*"\\01[^/]*\.(/|)baz.*debug-dir\.cpp}}
+
+void f1() {}
Index: clang/lib/CodeGen/CoverageMappingGen.h
===
--- clang/lib/CodeGen/CoverageMappingGen.h
+++ clang/lib/CodeGen/CoverageMappingGen.h
@@ -60,14 +60,16 @@
   llvm::SmallDenseMap FileEntries;
   std::vector FunctionNames;
   std::vector FunctionRecords;
+  SmallString<256> CWD;
+
+  std::string normalizeFilename(StringRef Filename);
 
   /// Emit a function record.
   void emitFunctionMappingRecord(const FunctionInfo &Info,
  uint64_t FilenamesRef);
 
 public:
-  CoverageMappingModuleGen(CodeGenModule &CGM, CoverageSourceInfo &SourceInfo)
-  : CGM(CGM), SourceInfo(SourceInfo) {}
+  CoverageMappingModuleGen(CodeGenModule &CGM, CoverageSourceInfo &SourceInfo);
 
   CoverageSourceInfo &getSourceInfo() const {
 return SourceInfo;
Index: clang/lib/CodeGen/CoverageMappingGen.cpp
===
--- clang/lib/CodeGen/CoverageMappingGen.cpp
+++ clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -1279,13 +1279,6 @@
   }
 };
 
-std::string normalizeFilename(StringRef Filename) {
-  llvm::SmallString<256> Path(Filename);
-  llvm::sys::fs::make_absolute(Path);
-  llvm::sys::path::remove_dots(Path, /*remove_dot_dot=*/true);
-  return std::string(Path);
-}
-
 } // end anonymous namespace
 
 static void dump(llvm::raw_ostream &OS, StringRef FunctionName,
@@ -1318,6 +1311,24 @@
   }
 }
 
+CoverageMappingModuleGen::CoverageMappingModuleGen(
+CodeGenModule &CGM, CoverageSourceInfo &SourceInfo)
+: CGM(CGM), SourceInfo(SourceInfo) {
+  // Honor -fdebug-compilation-dir in paths in coverage data. Otherwise, use 
the
+  // regular working directory when normalizing paths.
+  if (!CGM.getCodeGenOpts().DebugCompilationDir.empty())
+CWD = CGM.getCodeGenOpts().DebugCompilationDir;
+  else
+llvm::sys::fs::current_path(CWD);
+}
+
+std::string CoverageMappingModuleGen::normalizeFilename(StringRef Filename) {
+  llvm::SmallString<256> Path(Filename);
+  llvm::sys::path::remove_dots(Path, /*remove_dot_dot=*/true);
+  llvm::sys::fs::make_absolute(CWD, Path);
+  return Path.str().str();
+}
+
 static std::string getInstrProfSection(const CodeGenModule &CGM,
llvm::InstrProfSectKind SK) {
   return llvm::getInstrProfSectionName(


Index: clang/test/CoverageMapping/debug-dir.cpp
===
--- /dev/null
+++ clang/test/CoverageMapping/debug-dir.cpp
@@ -0,0 +1,16 @@
+// %s expands to an absolute path, so to test relative paths we need to create a
+// clean directory, put the source there, and cd into it.
+// RUN: rm -rf %t
+// RUN: mkdir -p %t/foo/bar/baz
+// RUN: cp %s %t/foo/bar/baz/debug-dir.cpp
+// RUN: cd %t/foo/bar
+
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -mllvm -enable-name-compression=false -main-file-name debug-dir.cpp baz/debug-dir.cpp  -o - | FileCheck -check-prefix=ABSOLUTE %s
+//
+// ABSOLUTE: @__llvm_coverage_mapping = {{.*"\\01.*foo.*bar.*baz.*debug-dir\.cpp}}
+
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -mllvm -enable-name-compression=false -main-file-name debug-dir.cpp baz/debug-dir.cpp -fdebug-compilation-dir . -o - | FileCheck -check-prefix=RELATIVE %s
+//
+// RELATIVE: @__llvm_coverage_mapping = {{.*"

[PATCH] D81122: Reland: Use -fdebug-compilation-dir to form absolute paths in coverage mappings

2020-06-04 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

FYI I actually removed that piece this morning since I felt like since this now 
supports `-path-equivalence=.,foo` which is the "expected" behavior from lldb, 
that was "good enough". lmk if you want me to add it back!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81122



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


[PATCH] D83015: [Driver] Add -fld-path= and deprecate -fuse-ld=/abs/path and -fuse-ld=rel/path

2020-07-01 Thread Keith Smiley via Phabricator via cfe-commits
keith accepted this revision.
keith added a comment.

Awesome!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83015



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


[PATCH] D80660: clang: Add support for relative linker paths with -fuse-ld

2020-07-03 Thread Keith Smiley via Phabricator via cfe-commits
keith abandoned this revision.
keith added a comment.

https://reviews.llvm.org/D83015


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80660



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


[PATCH] D83154: clang: Add -fcoverage-prefix-map

2020-07-03 Thread Keith Smiley via Phabricator via cfe-commits
keith created this revision.
keith added reviewers: vsk, arphaman, rnk.
Herald added a subscriber: dexonsmith.
Herald added a project: clang.
keith added a comment.

Open question: I don't know how all the toolchains fit together, but I noticed 
that only Clang.cpp handles -fmacro-prefix-map, but Clang.cpp, FreeBSD.cpp, and 
Gnu.cpp all handle -fdebug-prefix-map. I wasn't sure which pattern I should 
follow here, so right now this only adds the handling to Clang.cpp, please let 
me know if that's not appropriate in this case!


This flag allows you to re-write absolute paths in coverage data analogous to 
-fdebug-prefix-map. This flag is also implied by -ffile-prefix-map.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83154

Files:
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CoverageMappingGen.cpp
  clang/lib/CodeGen/CoverageMappingGen.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CoverageMapping/coverage-prefix-map.c
  clang/test/Driver/debug-prefix-map.c

Index: clang/test/Driver/debug-prefix-map.c
===
--- clang/test/Driver/debug-prefix-map.c
+++ clang/test/Driver/debug-prefix-map.c
@@ -1,28 +1,39 @@
 // RUN: %clang -### -fdebug-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-INVALID
 // RUN: %clang -### -fmacro-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-INVALID
+// RUN: %clang -### -fcoverage-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-COVERAGE-INVALID
 // RUN: %clang -### -ffile-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-FILE-INVALID
 
 // RUN: %clang -### -fdebug-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-SIMPLE
 // RUN: %clang -### -fmacro-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-SIMPLE
+// RUN: %clang -### -fcoverage-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-COVERAGE-SIMPLE
 // RUN: %clang -### -ffile-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-SIMPLE
 // RUN: %clang -### -ffile-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-SIMPLE
+// RUN: %clang -### -ffile-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-COVERAGE-SIMPLE
 
 // RUN: %clang -### -fdebug-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-COMPLEX
 // RUN: %clang -### -fmacro-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-COMPLEX
+// RUN: %clang -### -fcoverage-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-COVERAGE-COMPLEX
 // RUN: %clang -### -ffile-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-COMPLEX
 // RUN: %clang -### -ffile-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-COMPLEX
+// RUN: %clang -### -ffile-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-COVERAGE-COMPLEX
 
 // RUN: %clang -### -fdebug-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-EMPTY
 // RUN: %clang -### -fmacro-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-EMPTY
+// RUN: %clang -### -fcoverage-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-COVERAGE-EMPTY
 // RUN: %clang -### -ffile-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-EMPTY
 // RUN: %clang -### -ffile-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-EMPTY
+// RUN: %clang -### -ffile-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-COVERAGE-EMPTY
 
 // CHECK-DEBUG-INVALID: error: invalid argument 'old' to -fdebug-prefix-map
 // CHECK-MACRO-INVALID: error: invalid argument 'old' to -fmacro-prefix-map
+// CHECK-COVERAGE-INVALID: error: invalid argument 'old' to -fcoverage-prefix-map
 // CHECK-FILE-INVALID: error: invalid argument 'old' to -ffile-prefix-map
 // CHECK-DEBUG-SIMPLE: fdebug-prefix-map=old=new
 // CHECK-MACRO-SIMPLE: fmacro-prefix-map=old=new
+// CHECK-COVERAGE-SIMPLE: fcoverage-prefix-map=old=new
 // CHECK-DEBUG-COMPLEX: fdebug-prefix-map=old=n=ew
 // CHECK-MACRO-COMPLEX: fmacro-prefix-map=old=n=ew
+// CHECK-COVERAGE-COMPLEX: fcoverage-prefix-map=old=n=ew
 // CHECK-DEBUG-EMPTY: fdebug-prefix-map=old=
 // CHECK-MACRO-EMPTY: fmacro-prefix-map=old=
+// CHECK-COVERAGE-EMPTY: fcoverage-prefix-map=old=
Index: clang/test/CoverageMapping/coverage-prefix-map.c
===
--- /dev/null
+++ clang/test/CoverageMapping/coverage-prefix-map.c
@@ -0,0 +1,14 @@
+// %s expands to an absolute path, so to test relative paths we need to create a
+// clean directory, put the source there, and cd into it.
+// RUN: rm -rf %t
+// RUN: mkdir -p %t/root/nested
+// RUN: echo "void f1() {}" > %t/root/nested/coverage-prefix-map.c
+// RUN: cd %t/root
+
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -mllvm -enable-name-compression=false -main-f

[PATCH] D81122: Reland: Use -fdebug-compilation-dir to form absolute paths in coverage mappings

2020-07-03 Thread Keith Smiley via Phabricator via cfe-commits
keith abandoned this revision.
keith added a comment.

https://reviews.llvm.org/D83154


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81122



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


[PATCH] D83154: clang: Add -fcoverage-prefix-map

2020-07-03 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

Open question: I don't know how all the toolchains fit together, but I noticed 
that only Clang.cpp handles -fmacro-prefix-map, but Clang.cpp, FreeBSD.cpp, and 
Gnu.cpp all handle -fdebug-prefix-map. I wasn't sure which pattern I should 
follow here, so right now this only adds the handling to Clang.cpp, please let 
me know if that's not appropriate in this case!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83154



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


[PATCH] D83154: clang: Add -fcoverage-prefix-map

2020-07-04 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 275506.
keith added a comment.

Fix tests on Windows


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83154

Files:
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CoverageMappingGen.cpp
  clang/lib/CodeGen/CoverageMappingGen.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CoverageMapping/coverage-prefix-map.c
  clang/test/Driver/debug-prefix-map.c

Index: clang/test/Driver/debug-prefix-map.c
===
--- clang/test/Driver/debug-prefix-map.c
+++ clang/test/Driver/debug-prefix-map.c
@@ -1,28 +1,39 @@
 // RUN: %clang -### -fdebug-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-INVALID
 // RUN: %clang -### -fmacro-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-INVALID
+// RUN: %clang -### -fcoverage-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-COVERAGE-INVALID
 // RUN: %clang -### -ffile-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-FILE-INVALID
 
 // RUN: %clang -### -fdebug-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-SIMPLE
 // RUN: %clang -### -fmacro-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-SIMPLE
+// RUN: %clang -### -fcoverage-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-COVERAGE-SIMPLE
 // RUN: %clang -### -ffile-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-SIMPLE
 // RUN: %clang -### -ffile-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-SIMPLE
+// RUN: %clang -### -ffile-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-COVERAGE-SIMPLE
 
 // RUN: %clang -### -fdebug-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-COMPLEX
 // RUN: %clang -### -fmacro-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-COMPLEX
+// RUN: %clang -### -fcoverage-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-COVERAGE-COMPLEX
 // RUN: %clang -### -ffile-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-COMPLEX
 // RUN: %clang -### -ffile-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-COMPLEX
+// RUN: %clang -### -ffile-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-COVERAGE-COMPLEX
 
 // RUN: %clang -### -fdebug-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-EMPTY
 // RUN: %clang -### -fmacro-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-EMPTY
+// RUN: %clang -### -fcoverage-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-COVERAGE-EMPTY
 // RUN: %clang -### -ffile-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-EMPTY
 // RUN: %clang -### -ffile-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-EMPTY
+// RUN: %clang -### -ffile-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-COVERAGE-EMPTY
 
 // CHECK-DEBUG-INVALID: error: invalid argument 'old' to -fdebug-prefix-map
 // CHECK-MACRO-INVALID: error: invalid argument 'old' to -fmacro-prefix-map
+// CHECK-COVERAGE-INVALID: error: invalid argument 'old' to -fcoverage-prefix-map
 // CHECK-FILE-INVALID: error: invalid argument 'old' to -ffile-prefix-map
 // CHECK-DEBUG-SIMPLE: fdebug-prefix-map=old=new
 // CHECK-MACRO-SIMPLE: fmacro-prefix-map=old=new
+// CHECK-COVERAGE-SIMPLE: fcoverage-prefix-map=old=new
 // CHECK-DEBUG-COMPLEX: fdebug-prefix-map=old=n=ew
 // CHECK-MACRO-COMPLEX: fmacro-prefix-map=old=n=ew
+// CHECK-COVERAGE-COMPLEX: fcoverage-prefix-map=old=n=ew
 // CHECK-DEBUG-EMPTY: fdebug-prefix-map=old=
 // CHECK-MACRO-EMPTY: fmacro-prefix-map=old=
+// CHECK-COVERAGE-EMPTY: fcoverage-prefix-map=old=
Index: clang/test/CoverageMapping/coverage-prefix-map.c
===
--- /dev/null
+++ clang/test/CoverageMapping/coverage-prefix-map.c
@@ -0,0 +1,14 @@
+// %s expands to an absolute path, so to test relative paths we need to create a
+// clean directory, put the source there, and cd into it.
+// RUN: rm -rf %t
+// RUN: mkdir -p %t/root/nested
+// RUN: echo "void f1() {}" > %t/root/nested/coverage-prefix-map.c
+// RUN: cd %t/root
+
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -mllvm -enable-name-compression=false -main-file-name coverage-prefix-map.c nested/coverage-prefix-map.c -o - | FileCheck --check-prefix=ABSOLUTE %s
+//
+// ABSOLUTE: @__llvm_coverage_mapping = {{.*"\\01.*root.*nested.*coverage-prefix-map\.c}}
+
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -mllvm -enable-name-compression=false -main-file-name coverage-prefix-map.c nested/coverage-prefix-map.c -fcoverage-prefix-map=%/t/root=. -o - | FileCheck --check-prefix=COVERAGE-PREFIX-MAP %s --implicit-check-not=root
+//
+// COVERAGE-PREFIX-MAP: 

[PATCH] D83154: clang: Add -fcoverage-prefix-map

2020-07-06 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

I originally implemented this behavior behind `-fdebug-prefix-map` but there 
was some pushback, more context: 
https://lists.llvm.org/pipermail/cfe-dev/2020-June/065668.html


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83154



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


[PATCH] D119788: [AArch64] Add support for -march=native for Apple M1 CPU

2022-03-23 Thread Keith Smiley via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfcca10c69aaa: [AArch64] Add support for -march=native for 
Apple M1 CPU (authored by keith).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119788

Files:
  clang/lib/Driver/ToolChains/Arch/AArch64.cpp
  llvm/lib/Support/Host.cpp

Index: llvm/lib/Support/Host.cpp
===
--- llvm/lib/Support/Host.cpp
+++ llvm/lib/Support/Host.cpp
@@ -41,6 +41,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #endif
 #ifdef _AIX
 #include 
@@ -1297,32 +1299,45 @@
   bool HaveVectorSupport = CVT[244] & 0x80;
   return getCPUNameFromS390Model(Id, HaveVectorSupport);
 }
-#elif defined(__APPLE__) && defined(__aarch64__)
-StringRef sys::getHostCPUName() {
-  return "cyclone";
-}
-#elif defined(__APPLE__) && defined(__arm__)
-StringRef sys::getHostCPUName() {
-  host_basic_info_data_t hostInfo;
-  mach_msg_type_number_t infoCount;
+#elif defined(__APPLE__) && (defined(__arm__) || defined(__aarch64__))
+#define CPUFAMILY_ARM_SWIFT 0x1e2d6381
+#define CPUFAMILY_ARM_CYCLONE 0x37a09642
+#define CPUFAMILY_ARM_TYPHOON 0x2c91a47e
+#define CPUFAMILY_ARM_TWISTER 0x92fb37c8
+#define CPUFAMILY_ARM_HURRICANE 0x67ceee93
+#define CPUFAMILY_ARM_MONSOON_MISTRAL 0xe81e7ef6
+#define CPUFAMILY_ARM_VORTEX_TEMPEST 0x07d34b9f
+#define CPUFAMILY_ARM_LIGHTNING_THUNDER 0x462504d2
+#define CPUFAMILY_ARM_FIRESTORM_ICESTORM 0x1b588bb3
 
-  infoCount = HOST_BASIC_INFO_COUNT;
-  mach_port_t hostPort = mach_host_self();
-  host_info(hostPort, HOST_BASIC_INFO, (host_info_t)&hostInfo,
-&infoCount);
-  mach_port_deallocate(mach_task_self(), hostPort);
+StringRef sys::getHostCPUName() {
+  uint32_t Family;
+  size_t Length = sizeof(Family);
+  sysctlbyname("hw.cpufamily", &Family, &Length, NULL, 0);
 
-  if (hostInfo.cpu_type != CPU_TYPE_ARM) {
-assert(false && "CPUType not equal to ARM should not be possible on ARM");
-return "generic";
+  switch (Family) {
+  case CPUFAMILY_ARM_SWIFT:
+return "swift";
+  case CPUFAMILY_ARM_CYCLONE:
+return "apple-a7";
+  case CPUFAMILY_ARM_TYPHOON:
+return "apple-a8";
+  case CPUFAMILY_ARM_TWISTER:
+return "apple-a9";
+  case CPUFAMILY_ARM_HURRICANE:
+return "apple-a10";
+  case CPUFAMILY_ARM_MONSOON_MISTRAL:
+return "apple-a11";
+  case CPUFAMILY_ARM_VORTEX_TEMPEST:
+return "apple-a12";
+  case CPUFAMILY_ARM_LIGHTNING_THUNDER:
+return "apple-a13";
+  case CPUFAMILY_ARM_FIRESTORM_ICESTORM:
+return "apple-m1";
+  default:
+// Default to the newest CPU we know about.
+return "apple-m1";
   }
-  switch (hostInfo.cpu_subtype) {
-case CPU_SUBTYPE_ARM_V7S:
-  return "swift";
-default:;
-}
-
-  return "generic";
 }
 #elif defined(_AIX)
 StringRef sys::getHostCPUName() {
@@ -1453,9 +1468,6 @@
 #elif defined(__linux__) && defined(__s390x__)
 int computeHostNumPhysicalCores() { return sysconf(_SC_NPROCESSORS_ONLN); }
 #elif defined(__APPLE__)
-#include 
-#include 
-
 // Gets the number of *physical cores* on the machine.
 int computeHostNumPhysicalCores() {
   uint32_t count;
Index: clang/lib/Driver/ToolChains/Arch/AArch64.cpp
===
--- clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -151,6 +151,8 @@
   std::pair Split = StringRef(MarchLowerCase).split("+");
 
   llvm::AArch64::ArchKind ArchKind = llvm::AArch64::parseArch(Split.first);
+  if (Split.first == "native")
+ArchKind = llvm::AArch64::getCPUArchKind(llvm::sys::getHostCPUName().str());
   if (ArchKind == llvm::AArch64::ArchKind::INVALID ||
   !llvm::AArch64::getArchFeatures(ArchKind, Features))
 return false;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D100692: clang-tidy: discover binaries in build dir

2022-03-12 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.
Herald added subscribers: cfe-commits, carlosgalvezp.
Herald added a project: All.

Ping, it seems like https://reviews.llvm.org/D101037 is stalled but the docs at 
this point state py >=3.6 is required for working on llvm so I think we're good 
here https://llvm.org/docs/GettingStarted.html#software


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100692

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


[PATCH] D119788: [AArch64] Add support for -march=native for Apple M1 CPU

2022-03-12 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 414866.
keith added a comment.
Herald added a project: All.

Update default to latest known CPU


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119788

Files:
  clang/lib/Driver/ToolChains/Arch/AArch64.cpp
  llvm/lib/Support/Host.cpp

Index: llvm/lib/Support/Host.cpp
===
--- llvm/lib/Support/Host.cpp
+++ llvm/lib/Support/Host.cpp
@@ -38,6 +38,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #endif
 #ifdef _AIX
 #include 
@@ -1294,32 +1296,45 @@
   bool HaveVectorSupport = CVT[244] & 0x80;
   return getCPUNameFromS390Model(Id, HaveVectorSupport);
 }
-#elif defined(__APPLE__) && defined(__aarch64__)
-StringRef sys::getHostCPUName() {
-  return "cyclone";
-}
-#elif defined(__APPLE__) && defined(__arm__)
-StringRef sys::getHostCPUName() {
-  host_basic_info_data_t hostInfo;
-  mach_msg_type_number_t infoCount;
+#elif defined(__APPLE__) && (defined(__arm__) || defined(__aarch64__))
+#define CPUFAMILY_ARM_SWIFT 0x1e2d6381
+#define CPUFAMILY_ARM_CYCLONE 0x37a09642
+#define CPUFAMILY_ARM_TYPHOON 0x2c91a47e
+#define CPUFAMILY_ARM_TWISTER 0x92fb37c8
+#define CPUFAMILY_ARM_HURRICANE 0x67ceee93
+#define CPUFAMILY_ARM_MONSOON_MISTRAL 0xe81e7ef6
+#define CPUFAMILY_ARM_VORTEX_TEMPEST 0x07d34b9f
+#define CPUFAMILY_ARM_LIGHTNING_THUNDER 0x462504d2
+#define CPUFAMILY_ARM_FIRESTORM_ICESTORM 0x1b588bb3
 
-  infoCount = HOST_BASIC_INFO_COUNT;
-  mach_port_t hostPort = mach_host_self();
-  host_info(hostPort, HOST_BASIC_INFO, (host_info_t)&hostInfo,
-&infoCount);
-  mach_port_deallocate(mach_task_self(), hostPort);
+StringRef sys::getHostCPUName() {
+  uint32_t Family;
+  size_t Length = sizeof(Family);
+  sysctlbyname("hw.cpufamily", &Family, &Length, NULL, 0);
 
-  if (hostInfo.cpu_type != CPU_TYPE_ARM) {
-assert(false && "CPUType not equal to ARM should not be possible on ARM");
-return "generic";
+  switch (Family) {
+  case CPUFAMILY_ARM_SWIFT:
+return "swift";
+  case CPUFAMILY_ARM_CYCLONE:
+return "apple-a7";
+  case CPUFAMILY_ARM_TYPHOON:
+return "apple-a8";
+  case CPUFAMILY_ARM_TWISTER:
+return "apple-a9";
+  case CPUFAMILY_ARM_HURRICANE:
+return "apple-a10";
+  case CPUFAMILY_ARM_MONSOON_MISTRAL:
+return "apple-a11";
+  case CPUFAMILY_ARM_VORTEX_TEMPEST:
+return "apple-a12";
+  case CPUFAMILY_ARM_LIGHTNING_THUNDER:
+return "apple-a13";
+  case CPUFAMILY_ARM_FIRESTORM_ICESTORM:
+return "apple-m1";
+  default:
+// Default to the knewest CPU we know about.
+return "apple-m1";
   }
-  switch (hostInfo.cpu_subtype) {
-case CPU_SUBTYPE_ARM_V7S:
-  return "swift";
-default:;
-}
-
-  return "generic";
 }
 #elif defined(_AIX)
 StringRef sys::getHostCPUName() {
@@ -1450,9 +1465,6 @@
 #elif defined(__linux__) && defined(__s390x__)
 int computeHostNumPhysicalCores() { return sysconf(_SC_NPROCESSORS_ONLN); }
 #elif defined(__APPLE__)
-#include 
-#include 
-
 // Gets the number of *physical cores* on the machine.
 int computeHostNumPhysicalCores() {
   uint32_t count;
Index: clang/lib/Driver/ToolChains/Arch/AArch64.cpp
===
--- clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -151,6 +151,8 @@
   std::pair Split = StringRef(MarchLowerCase).split("+");
 
   llvm::AArch64::ArchKind ArchKind = llvm::AArch64::parseArch(Split.first);
+  if (Split.first == "native")
+ArchKind = llvm::AArch64::getCPUArchKind(llvm::sys::getHostCPUName().str());
   if (ArchKind == llvm::AArch64::ArchKind::INVALID ||
   !llvm::AArch64::getArchFeatures(ArchKind, Features))
 return false;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D119788: [AArch64] Add support for -march=native for Apple M1 CPU

2022-03-12 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 414878.
keith added a comment.

Fix typo


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119788

Files:
  clang/lib/Driver/ToolChains/Arch/AArch64.cpp
  llvm/lib/Support/Host.cpp

Index: llvm/lib/Support/Host.cpp
===
--- llvm/lib/Support/Host.cpp
+++ llvm/lib/Support/Host.cpp
@@ -38,6 +38,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #endif
 #ifdef _AIX
 #include 
@@ -1294,32 +1296,45 @@
   bool HaveVectorSupport = CVT[244] & 0x80;
   return getCPUNameFromS390Model(Id, HaveVectorSupport);
 }
-#elif defined(__APPLE__) && defined(__aarch64__)
-StringRef sys::getHostCPUName() {
-  return "cyclone";
-}
-#elif defined(__APPLE__) && defined(__arm__)
-StringRef sys::getHostCPUName() {
-  host_basic_info_data_t hostInfo;
-  mach_msg_type_number_t infoCount;
+#elif defined(__APPLE__) && (defined(__arm__) || defined(__aarch64__))
+#define CPUFAMILY_ARM_SWIFT 0x1e2d6381
+#define CPUFAMILY_ARM_CYCLONE 0x37a09642
+#define CPUFAMILY_ARM_TYPHOON 0x2c91a47e
+#define CPUFAMILY_ARM_TWISTER 0x92fb37c8
+#define CPUFAMILY_ARM_HURRICANE 0x67ceee93
+#define CPUFAMILY_ARM_MONSOON_MISTRAL 0xe81e7ef6
+#define CPUFAMILY_ARM_VORTEX_TEMPEST 0x07d34b9f
+#define CPUFAMILY_ARM_LIGHTNING_THUNDER 0x462504d2
+#define CPUFAMILY_ARM_FIRESTORM_ICESTORM 0x1b588bb3
 
-  infoCount = HOST_BASIC_INFO_COUNT;
-  mach_port_t hostPort = mach_host_self();
-  host_info(hostPort, HOST_BASIC_INFO, (host_info_t)&hostInfo,
-&infoCount);
-  mach_port_deallocate(mach_task_self(), hostPort);
+StringRef sys::getHostCPUName() {
+  uint32_t Family;
+  size_t Length = sizeof(Family);
+  sysctlbyname("hw.cpufamily", &Family, &Length, NULL, 0);
 
-  if (hostInfo.cpu_type != CPU_TYPE_ARM) {
-assert(false && "CPUType not equal to ARM should not be possible on ARM");
-return "generic";
+  switch (Family) {
+  case CPUFAMILY_ARM_SWIFT:
+return "swift";
+  case CPUFAMILY_ARM_CYCLONE:
+return "apple-a7";
+  case CPUFAMILY_ARM_TYPHOON:
+return "apple-a8";
+  case CPUFAMILY_ARM_TWISTER:
+return "apple-a9";
+  case CPUFAMILY_ARM_HURRICANE:
+return "apple-a10";
+  case CPUFAMILY_ARM_MONSOON_MISTRAL:
+return "apple-a11";
+  case CPUFAMILY_ARM_VORTEX_TEMPEST:
+return "apple-a12";
+  case CPUFAMILY_ARM_LIGHTNING_THUNDER:
+return "apple-a13";
+  case CPUFAMILY_ARM_FIRESTORM_ICESTORM:
+return "apple-m1";
+  default:
+// Default to the newest CPU we know about.
+return "apple-m1";
   }
-  switch (hostInfo.cpu_subtype) {
-case CPU_SUBTYPE_ARM_V7S:
-  return "swift";
-default:;
-}
-
-  return "generic";
 }
 #elif defined(_AIX)
 StringRef sys::getHostCPUName() {
@@ -1450,9 +1465,6 @@
 #elif defined(__linux__) && defined(__s390x__)
 int computeHostNumPhysicalCores() { return sysconf(_SC_NPROCESSORS_ONLN); }
 #elif defined(__APPLE__)
-#include 
-#include 
-
 // Gets the number of *physical cores* on the machine.
 int computeHostNumPhysicalCores() {
   uint32_t count;
Index: clang/lib/Driver/ToolChains/Arch/AArch64.cpp
===
--- clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -151,6 +151,8 @@
   std::pair Split = StringRef(MarchLowerCase).split("+");
 
   llvm::AArch64::ArchKind ArchKind = llvm::AArch64::parseArch(Split.first);
+  if (Split.first == "native")
+ArchKind = llvm::AArch64::getCPUArchKind(llvm::sys::getHostCPUName().str());
   if (ArchKind == llvm::AArch64::ArchKind::INVALID ||
   !llvm::AArch64::getArchFeatures(ArchKind, Features))
 return false;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D100692: clang-tidy: discover binaries in build dir

2022-03-13 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 414975.
keith added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100692

Files:
  clang-tools-extra/clang-tidy/tool/run-clang-tidy.py

Index: clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
===
--- clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+++ clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 #===- run-clang-tidy.py - Parallel clang-tidy runner *- python -*--===#
 #
@@ -41,6 +41,7 @@
 import json
 import multiprocessing
 import os
+import queue
 import re
 import shutil
 import subprocess
@@ -54,13 +55,6 @@
 except ImportError:
   yaml = None
 
-is_py2 = sys.version[0] == '2'
-
-if is_py2:
-import Queue as queue
-else:
-import queue as queue
-
 
 def strtobool(val):
   """Convert a string representation of truth to a bool following LLVM's CLI argument parsing."""
@@ -158,20 +152,29 @@
 open(mergefile, 'w').close()
 
 
-def check_clang_apply_replacements_binary(args):
-  """Checks if invoking supplied clang-apply-replacements binary works."""
-  try:
-subprocess.check_call([args.clang_apply_replacements_binary, '--version'])
-  except:
-print('Unable to run clang-apply-replacements. Is clang-apply-replacements '
-  'binary correctly specified?', file=sys.stderr)
-traceback.print_exc()
-sys.exit(1)
+def find_binary(arg, name, build_path):
+  """Get the path for a binary or exit"""
+  if arg:
+if shutil.which(arg):
+  return arg
+else:
+  raise SystemExit(
+"error: passed binary '{}' was not found or is not executable"
+.format(arg))
 
+  built_path = os.path.join(build_path, "bin", name)
+  binary = shutil.which(name) or shutil.which(built_path)
+  if binary:
+return binary
+  else:
+raise SystemExit(
+  "error: failed to find {} in $PATH or at {}"
+  .format(name, built_path))
 
-def apply_fixes(args, tmpdir):
+
+def apply_fixes(args, clang_apply_replacements_binary, tmpdir):
   """Calls clang-apply-fixes on a given directory."""
-  invocation = [args.clang_apply_replacements_binary]
+  invocation = [clang_apply_replacements_binary]
   if args.format:
 invocation.append('-format')
   if args.style:
@@ -180,11 +183,12 @@
   subprocess.call(invocation)
 
 
-def run_tidy(args, tmpdir, build_path, queue, lock, failed_files):
+def run_tidy(args, clang_tidy_binary, tmpdir, build_path, queue, lock,
+ failed_files):
   """Takes filenames out of queue and runs clang-tidy on them."""
   while True:
 name = queue.get()
-invocation = get_tidy_invocation(name, args.clang_tidy_binary, args.checks,
+invocation = get_tidy_invocation(name, clang_tidy_binary, args.checks,
  tmpdir, build_path, args.header_filter,
  args.allow_enabling_alpha_checkers,
  args.extra_arg, args.extra_arg_before,
@@ -210,15 +214,13 @@
   parser = argparse.ArgumentParser(description='Runs clang-tidy over all files '
'in a compilation database. Requires '
'clang-tidy and clang-apply-replacements in '
-   '$PATH.')
+   '$PATH or in your build directory.')
   parser.add_argument('-allow-enabling-alpha-checkers',
   action='store_true', help='allow alpha checkers from '
 'clang-analyzer.')
   parser.add_argument('-clang-tidy-binary', metavar='PATH',
-  default='clang-tidy',
   help='path to clang-tidy binary')
   parser.add_argument('-clang-apply-replacements-binary', metavar='PATH',
-  default='clang-apply-replacements',
   help='path to clang-apply-replacements binary')
   parser.add_argument('-checks', default=None,
   help='checks filter, when not specified, use clang-tidy '
@@ -278,8 +280,18 @@
 # Find our database
 build_path = find_compilation_database(db_path)
 
+  clang_tidy_binary = find_binary(args.clang_tidy_binary, "clang-tidy",
+  build_path)
+
+  tmpdir = None
+  if args.fix or (yaml and args.export_fixes):
+clang_apply_replacements_binary = find_binary(
+  args.clang_apply_replacements_binary, "clang-apply-replacements",
+  build_path)
+tmpdir = tempfile.mkdtemp()
+
   try:
-invocation = get_tidy_invocation("", args.clang_tidy_binary, args.checks,
+invocation = get_tidy_invocation("", clang_tidy_binary, args.checks,
  None, build_path, args.header_filter,
  args.allow_enabling_alpha_checkers,
   

[PATCH] D111579: [clang] Fix DIFile directory root on Windows

2022-03-13 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 414976.
keith added a comment.
Herald added a project: All.

Remove variables from test expectations

This didn't work out because of the double vs single slash of the expansions


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111579

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/debug-prefix-map.c


Index: clang/test/CodeGen/debug-prefix-map.c
===
--- clang/test/CodeGen/debug-prefix-map.c
+++ clang/test/CodeGen/debug-prefix-map.c
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - | FileCheck %s 
-check-prefix CHECK-NO-MAIN-FILE-NAME
-// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=/UNLIKELY_PATH=empty %s -emit-llvm -o - | FileCheck %s 
-check-prefix CHECK-EVIL
-// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - -main-file-name 
debug-prefix-map.c | FileCheck %s
-// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - 
-fdebug-compilation-dir %p | FileCheck %s -check-prefix CHECK-COMPILATION-DIR
-// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - -isysroot %p 
-debugger-tuning=lldb | FileCheck %s -check-prefix CHECK-SYSROOT
-// RUN: %clang -g -fdebug-prefix-map=%p=/UNLIKELY_PATH/empty -S -c %s 
-emit-llvm -o - | FileCheck %s
-// RUN: %clang -g -ffile-prefix-map=%p=/UNLIKELY_PATH/empty -S -c %s 
-emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=%{fssrcroot}UNLIKELY_PATH%{fssep}empty %s -emit-llvm -o - 
| FileCheck %s -check-prefix CHECK-NO-MAIN-FILE-NAME
+// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=%{fssrcroot}UNLIKELY_PATH=empty %s -emit-llvm -o - | 
FileCheck %s -check-prefix CHECK-EVIL
+// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=%{fssrcroot}UNLIKELY_PATH%{fssep}empty %s -emit-llvm -o - 
-main-file-name debug-prefix-map.c | FileCheck %s
+// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=%{fssrcroot}UNLIKELY_PATH%{fssep}empty %s -emit-llvm -o - 
-fdebug-compilation-dir %p | FileCheck %s -check-prefix CHECK-COMPILATION-DIR
+// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=%{fssrcroot}UNLIKELY_PATH%{fssep}empty %s -emit-llvm -o - 
-isysroot %p -debugger-tuning=lldb | FileCheck %s -check-prefix CHECK-SYSROOT
+// RUN: %clang -g -fdebug-prefix-map=%p=%{fssrcroot}UNLIKELY_PATH%{fssep}empty 
-S -c %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang -g -ffile-prefix-map=%p=%{fssrcroot}UNLIKELY_PATH%{fssep}empty 
-S -c %s -emit-llvm -o - | FileCheck %s
 
 #include "Inputs/stdio.h"
 
@@ -19,26 +19,24 @@
   vprintf("string", argp);
 }
 
-// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"/UNLIKELY_PATH/empty{{/|}}"
-// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"/UNLIKELY_PATH/empty{{/|}}{{.*}}",
-// On POSIX systems "Dir" should actually be empty, but on Windows we
-// can't recognize "/UNLIKELY_PATH" as being an absolute path.
-// CHECK-NO-MAIN-FILE-NAME-SAME:directory: "{{()|(.*:.*)}}")
-// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"/UNLIKELY_PATH/empty{{/|}}Inputs/stdio.h",
-// CHECK-NO-MAIN-FILE-NAME-SAME:directory: "{{()|(.*:.*)}}")
+// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"{{/|\w:}}UNLIKELY_PATH{{/|}}empty{{/|}}",
+// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"{{/|\w:}}UNLIKELY_PATH{{/|}}empty{{/|}}{{.*}}",
+// CHECK-NO-MAIN-FILE-NAME-SAME:directory: "")
+// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"{{/|\w:}}UNLIKELY_PATH{{/|}}empty{{/|}}Inputs{{/|}}stdio.h",
+// CHECK-NO-MAIN-FILE-NAME-SAME:directory: "")
 // CHECK-NO-MAIN-FILE-NAME-NOT: !DIFile(filename:
 
-// CHECK-EVIL: !DIFile(filename: "/UNLIKELY_PATH=empty{{/|}}{{.*}}"
-// CHECK-EVIL: !DIFile(filename: 
"/UNLIKELY_PATH=empty{{/|}}{{.*}}Inputs/stdio.h",
-// CHECK-EVIL-SAME:directory: "{{()|(.*:.*)}}")
+// CHECK-EVIL: !DIFile(filename: 
"{{/|\w:}}UNLIKELY_PATH=empty{{/|}}{{.*}}"
+// CHECK-EVIL: !DIFile(filename: 
"{{/|\w:}}UNLIKELY_PATH=empty{{/|}}{{.*}}Inputs{{/|}}stdio.h",
+// CHECK-EVIL-SAME:directory: "")
 // CHECK-EVIL-NOT: !DIFile(filename:
 
-// CHECK: !DIFile(filename: "/UNLIKELY_PATH/empty{{/|}}{{.*}}"
-// CHECK: !DIFile(filename: 
"/UNLIKELY_PATH/empty{{/|}}{{.*}}Inputs/stdio.h",
-// CHECK-SAME:directory: "{{()|(.*:.*)}}")
+// CHECK: !DIFile(filename: 
"{{/|\w:}}UNLIKELY_PATH{{/|}}empty{{/|}}{{.*}}",
+// CHECK: !DIFile(filename: 
"{{/|\w:}}UNLIKELY_PATH{{/|}}empty{{/|}}{{.*}}Inputs{{/|}}stdio.h",
+// CHECK-SAME:directory: ""
 // CHECK-NOT: !DIFile(filename:
 
-// CHECK-COMPILATION

[PATCH] D111457: [test] Add lit helper for windows paths

2022-03-13 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.
Herald added a project: All.

@compnerd can you re-review here? I think I covered your feedback, let me know!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111457

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


[PATCH] D111579: [clang] Fix DIFile directory root on Windows

2022-03-13 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 415004.
keith added a comment.

Replace \w with .


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111579

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/debug-prefix-map.c


Index: clang/test/CodeGen/debug-prefix-map.c
===
--- clang/test/CodeGen/debug-prefix-map.c
+++ clang/test/CodeGen/debug-prefix-map.c
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - | FileCheck %s 
-check-prefix CHECK-NO-MAIN-FILE-NAME
-// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=/UNLIKELY_PATH=empty %s -emit-llvm -o - | FileCheck %s 
-check-prefix CHECK-EVIL
-// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - -main-file-name 
debug-prefix-map.c | FileCheck %s
-// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - 
-fdebug-compilation-dir %p | FileCheck %s -check-prefix CHECK-COMPILATION-DIR
-// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - -isysroot %p 
-debugger-tuning=lldb | FileCheck %s -check-prefix CHECK-SYSROOT
-// RUN: %clang -g -fdebug-prefix-map=%p=/UNLIKELY_PATH/empty -S -c %s 
-emit-llvm -o - | FileCheck %s
-// RUN: %clang -g -ffile-prefix-map=%p=/UNLIKELY_PATH/empty -S -c %s 
-emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=%{fssrcroot}UNLIKELY_PATH%{fssep}empty %s -emit-llvm -o - 
| FileCheck %s -check-prefix CHECK-NO-MAIN-FILE-NAME
+// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=%{fssrcroot}UNLIKELY_PATH=empty %s -emit-llvm -o - | 
FileCheck %s -check-prefix CHECK-EVIL
+// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=%{fssrcroot}UNLIKELY_PATH%{fssep}empty %s -emit-llvm -o - 
-main-file-name debug-prefix-map.c | FileCheck %s
+// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=%{fssrcroot}UNLIKELY_PATH%{fssep}empty %s -emit-llvm -o - 
-fdebug-compilation-dir %p | FileCheck %s -check-prefix CHECK-COMPILATION-DIR
+// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=%{fssrcroot}UNLIKELY_PATH%{fssep}empty %s -emit-llvm -o - 
-isysroot %p -debugger-tuning=lldb | FileCheck %s -check-prefix CHECK-SYSROOT
+// RUN: %clang -g -fdebug-prefix-map=%p=%{fssrcroot}UNLIKELY_PATH%{fssep}empty 
-S -c %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang -g -ffile-prefix-map=%p=%{fssrcroot}UNLIKELY_PATH%{fssep}empty 
-S -c %s -emit-llvm -o - | FileCheck %s
 
 #include "Inputs/stdio.h"
 
@@ -19,26 +19,24 @@
   vprintf("string", argp);
 }
 
-// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"/UNLIKELY_PATH/empty{{/|}}"
-// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"/UNLIKELY_PATH/empty{{/|}}{{.*}}",
-// On POSIX systems "Dir" should actually be empty, but on Windows we
-// can't recognize "/UNLIKELY_PATH" as being an absolute path.
-// CHECK-NO-MAIN-FILE-NAME-SAME:directory: "{{()|(.*:.*)}}")
-// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"/UNLIKELY_PATH/empty{{/|}}Inputs/stdio.h",
-// CHECK-NO-MAIN-FILE-NAME-SAME:directory: "{{()|(.*:.*)}}")
+// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"{{/|.:}}UNLIKELY_PATH{{/|}}empty{{/|}}",
+// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"{{/|.:}}UNLIKELY_PATH{{/|}}empty{{/|}}{{.*}}",
+// CHECK-NO-MAIN-FILE-NAME-SAME:directory: "")
+// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"{{/|.:}}UNLIKELY_PATH{{/|}}empty{{/|}}Inputs{{/|}}stdio.h",
+// CHECK-NO-MAIN-FILE-NAME-SAME:directory: "")
 // CHECK-NO-MAIN-FILE-NAME-NOT: !DIFile(filename:
 
-// CHECK-EVIL: !DIFile(filename: "/UNLIKELY_PATH=empty{{/|}}{{.*}}"
-// CHECK-EVIL: !DIFile(filename: 
"/UNLIKELY_PATH=empty{{/|}}{{.*}}Inputs/stdio.h",
-// CHECK-EVIL-SAME:directory: "{{()|(.*:.*)}}")
+// CHECK-EVIL: !DIFile(filename: 
"{{/|.:}}UNLIKELY_PATH=empty{{/|}}{{.*}}"
+// CHECK-EVIL: !DIFile(filename: 
"{{/|.:}}UNLIKELY_PATH=empty{{/|}}{{.*}}Inputs{{/|}}stdio.h",
+// CHECK-EVIL-SAME:directory: "")
 // CHECK-EVIL-NOT: !DIFile(filename:
 
-// CHECK: !DIFile(filename: "/UNLIKELY_PATH/empty{{/|}}{{.*}}"
-// CHECK: !DIFile(filename: 
"/UNLIKELY_PATH/empty{{/|}}{{.*}}Inputs/stdio.h",
-// CHECK-SAME:directory: "{{()|(.*:.*)}}")
+// CHECK: !DIFile(filename: 
"{{/|.:}}UNLIKELY_PATH{{/|}}empty{{/|}}{{.*}}",
+// CHECK: !DIFile(filename: 
"{{/|.:}}UNLIKELY_PATH{{/|}}empty{{/|}}{{.*}}Inputs{{/|}}stdio.h",
+// CHECK-SAME:directory: ""
 // CHECK-NOT: !DIFile(filename:
 
-// CHECK-COMPILATION-DIR: !DIFile(filename: "{{.*}}", directory: 
"/UNLIKELY_PATH/empty")
-// CHECK-COMPILATION-DIR: !DIFile(filename: "{{.*}}Inputs/stdio.h

[PATCH] D111579: [clang] Fix DIFile directory root on Windows

2022-03-14 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

Ping, all green here, I just had to mess with the test regex a bit


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111579

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


[PATCH] D100692: clang-tidy: discover binaries in build dir

2022-03-14 Thread Keith Smiley via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5da83eeb91ba: clang-tidy: discover binaries in build dir 
(authored by keith).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100692

Files:
  clang-tools-extra/clang-tidy/tool/run-clang-tidy.py

Index: clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
===
--- clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+++ clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 #===- run-clang-tidy.py - Parallel clang-tidy runner *- python -*--===#
 #
@@ -41,6 +41,7 @@
 import json
 import multiprocessing
 import os
+import queue
 import re
 import shutil
 import subprocess
@@ -54,13 +55,6 @@
 except ImportError:
   yaml = None
 
-is_py2 = sys.version[0] == '2'
-
-if is_py2:
-import Queue as queue
-else:
-import queue as queue
-
 
 def strtobool(val):
   """Convert a string representation of truth to a bool following LLVM's CLI argument parsing."""
@@ -158,20 +152,29 @@
 open(mergefile, 'w').close()
 
 
-def check_clang_apply_replacements_binary(args):
-  """Checks if invoking supplied clang-apply-replacements binary works."""
-  try:
-subprocess.check_call([args.clang_apply_replacements_binary, '--version'])
-  except:
-print('Unable to run clang-apply-replacements. Is clang-apply-replacements '
-  'binary correctly specified?', file=sys.stderr)
-traceback.print_exc()
-sys.exit(1)
+def find_binary(arg, name, build_path):
+  """Get the path for a binary or exit"""
+  if arg:
+if shutil.which(arg):
+  return arg
+else:
+  raise SystemExit(
+"error: passed binary '{}' was not found or is not executable"
+.format(arg))
+
+  built_path = os.path.join(build_path, "bin", name)
+  binary = shutil.which(name) or shutil.which(built_path)
+  if binary:
+return binary
+  else:
+raise SystemExit(
+  "error: failed to find {} in $PATH or at {}"
+  .format(name, built_path))
 
 
-def apply_fixes(args, tmpdir):
+def apply_fixes(args, clang_apply_replacements_binary, tmpdir):
   """Calls clang-apply-fixes on a given directory."""
-  invocation = [args.clang_apply_replacements_binary]
+  invocation = [clang_apply_replacements_binary]
   if args.format:
 invocation.append('-format')
   if args.style:
@@ -180,11 +183,12 @@
   subprocess.call(invocation)
 
 
-def run_tidy(args, tmpdir, build_path, queue, lock, failed_files):
+def run_tidy(args, clang_tidy_binary, tmpdir, build_path, queue, lock,
+ failed_files):
   """Takes filenames out of queue and runs clang-tidy on them."""
   while True:
 name = queue.get()
-invocation = get_tidy_invocation(name, args.clang_tidy_binary, args.checks,
+invocation = get_tidy_invocation(name, clang_tidy_binary, args.checks,
  tmpdir, build_path, args.header_filter,
  args.allow_enabling_alpha_checkers,
  args.extra_arg, args.extra_arg_before,
@@ -210,15 +214,13 @@
   parser = argparse.ArgumentParser(description='Runs clang-tidy over all files '
'in a compilation database. Requires '
'clang-tidy and clang-apply-replacements in '
-   '$PATH.')
+   '$PATH or in your build directory.')
   parser.add_argument('-allow-enabling-alpha-checkers',
   action='store_true', help='allow alpha checkers from '
 'clang-analyzer.')
   parser.add_argument('-clang-tidy-binary', metavar='PATH',
-  default='clang-tidy',
   help='path to clang-tidy binary')
   parser.add_argument('-clang-apply-replacements-binary', metavar='PATH',
-  default='clang-apply-replacements',
   help='path to clang-apply-replacements binary')
   parser.add_argument('-checks', default=None,
   help='checks filter, when not specified, use clang-tidy '
@@ -278,8 +280,18 @@
 # Find our database
 build_path = find_compilation_database(db_path)
 
+  clang_tidy_binary = find_binary(args.clang_tidy_binary, "clang-tidy",
+  build_path)
+
+  tmpdir = None
+  if args.fix or (yaml and args.export_fixes):
+clang_apply_replacements_binary = find_binary(
+  args.clang_apply_replacements_binary, "clang-apply-replacements",
+  build_path)
+tmpdir = tempfile.mkdtemp()
+
   try:
-invocation = get_tidy_invocation("", args.clang_tidy_binary, args.checks,
+invocation = get_tidy_invocation("", clang_tidy_binary, args.checks,
  None, build_path, a

[PATCH] D111457: [test] Add lit helper for windows paths

2022-03-14 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 415290.
keith added a comment.

Update substitutions to use dashes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111457

Files:
  llvm/docs/CommandGuide/lit.rst
  llvm/docs/TestingGuide.rst
  llvm/utils/lit/lit/TestRunner.py


Index: llvm/utils/lit/lit/TestRunner.py
===
--- llvm/utils/lit/lit/TestRunner.py
+++ llvm/utils/lit/lit/TestRunner.py
@@ -6,6 +6,7 @@
 import os, signal, subprocess, sys
 import re
 import stat
+import pathlib
 import platform
 import shutil
 import tempfile
@@ -1121,6 +1122,12 @@
   ('%basename_t', baseName),
   ('%T', tmpDir)])
 
+substitutions.extend([
+('%{fs-src-root}', pathlib.Path(sourcedir).anchor),
+('%{fs-tmp-root}', pathlib.Path(tmpBase).anchor),
+('%{fs-sep}', os.path.sep),
+])
+
 # "%/[STpst]" should be normalized.
 substitutions.extend([
 ('%/s', sourcepath.replace('\\', '/')),
Index: llvm/docs/TestingGuide.rst
===
--- llvm/docs/TestingGuide.rst
+++ llvm/docs/TestingGuide.rst
@@ -569,6 +569,18 @@
 
Expands to the path separator, i.e. ``:`` (or ``;`` on Windows).
 
+``${fs-src-root}``
+   Expands to the root component of file system paths for the source directory,
+   i.e. ``/`` on Unix systems or ``C:\`` (or another drive) on Windows.
+
+``${fs-tmp-root}``
+   Expands to the root component of file system paths for the test's temporary
+   directory, i.e. ``/`` on Unix systems or ``C:\`` (or another drive) on
+   Windows.
+
+``${fs-sep}``
+   Expands to the file system separator, i.e. ``/`` or ``\`` on Windows.
+
 ``%/s, %/S, %/t, %/T:``
 
   Act like the corresponding substitution above but replace any ``\``
Index: llvm/docs/CommandGuide/lit.rst
===
--- llvm/docs/CommandGuide/lit.rst
+++ llvm/docs/CommandGuide/lit.rst
@@ -523,6 +523,9 @@
  %S  source dir (directory of the file currently being run)
  %p  same as %S
  %{pathsep}  path separator
+ %{fs-src-root}  root component of file system paths pointing to the 
LLVM checkout
+ %{fs-tmp-root}  root component of file system paths pointing to the 
test's temporary directory
+ %{fs-sep}   file system path separator
  %t  temporary file name unique to the test
  %basename_t The last path component of %t but without the 
``.tmp`` extension
  %T  parent directory of %t (not unique, deprecated, do 
not use)


Index: llvm/utils/lit/lit/TestRunner.py
===
--- llvm/utils/lit/lit/TestRunner.py
+++ llvm/utils/lit/lit/TestRunner.py
@@ -6,6 +6,7 @@
 import os, signal, subprocess, sys
 import re
 import stat
+import pathlib
 import platform
 import shutil
 import tempfile
@@ -1121,6 +1122,12 @@
   ('%basename_t', baseName),
   ('%T', tmpDir)])
 
+substitutions.extend([
+('%{fs-src-root}', pathlib.Path(sourcedir).anchor),
+('%{fs-tmp-root}', pathlib.Path(tmpBase).anchor),
+('%{fs-sep}', os.path.sep),
+])
+
 # "%/[STpst]" should be normalized.
 substitutions.extend([
 ('%/s', sourcepath.replace('\\', '/')),
Index: llvm/docs/TestingGuide.rst
===
--- llvm/docs/TestingGuide.rst
+++ llvm/docs/TestingGuide.rst
@@ -569,6 +569,18 @@
 
Expands to the path separator, i.e. ``:`` (or ``;`` on Windows).
 
+``${fs-src-root}``
+   Expands to the root component of file system paths for the source directory,
+   i.e. ``/`` on Unix systems or ``C:\`` (or another drive) on Windows.
+
+``${fs-tmp-root}``
+   Expands to the root component of file system paths for the test's temporary
+   directory, i.e. ``/`` on Unix systems or ``C:\`` (or another drive) on
+   Windows.
+
+``${fs-sep}``
+   Expands to the file system separator, i.e. ``/`` or ``\`` on Windows.
+
 ``%/s, %/S, %/t, %/T:``
 
   Act like the corresponding substitution above but replace any ``\``
Index: llvm/docs/CommandGuide/lit.rst
===
--- llvm/docs/CommandGuide/lit.rst
+++ llvm/docs/CommandGuide/lit.rst
@@ -523,6 +523,9 @@
  %S  source dir (directory of the file currently being run)
  %p  same as %S
  %{pathsep}  path separator
+ %{fs-src-root}  root component of file system paths pointing to the LLVM checkout
+ %{fs-tmp-root}  root component of file system paths pointing to the test's temporary directory
+ %{fs-sep}   file system path separator
  %t  temporary fi

[PATCH] D111579: [clang] Fix DIFile directory root on Windows

2022-03-14 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 415291.
keith marked an inline comment as done.
keith added a comment.

Update subsitutions with dashes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111579

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/debug-prefix-map.c


Index: clang/test/CodeGen/debug-prefix-map.c
===
--- clang/test/CodeGen/debug-prefix-map.c
+++ clang/test/CodeGen/debug-prefix-map.c
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - | FileCheck %s 
-check-prefix CHECK-NO-MAIN-FILE-NAME
-// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=/UNLIKELY_PATH=empty %s -emit-llvm -o - | FileCheck %s 
-check-prefix CHECK-EVIL
-// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - -main-file-name 
debug-prefix-map.c | FileCheck %s
-// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - 
-fdebug-compilation-dir %p | FileCheck %s -check-prefix CHECK-COMPILATION-DIR
-// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - -isysroot %p 
-debugger-tuning=lldb | FileCheck %s -check-prefix CHECK-SYSROOT
-// RUN: %clang -g -fdebug-prefix-map=%p=/UNLIKELY_PATH/empty -S -c %s 
-emit-llvm -o - | FileCheck %s
-// RUN: %clang -g -ffile-prefix-map=%p=/UNLIKELY_PATH/empty -S -c %s 
-emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH%{fs-sep}empty %s -emit-llvm 
-o - | FileCheck %s -check-prefix CHECK-NO-MAIN-FILE-NAME
+// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH=empty %s -emit-llvm -o - | 
FileCheck %s -check-prefix CHECK-EVIL
+// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH%{fs-sep}empty %s -emit-llvm 
-o - -main-file-name debug-prefix-map.c | FileCheck %s
+// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH%{fs-sep}empty %s -emit-llvm 
-o - -fdebug-compilation-dir %p | FileCheck %s -check-prefix 
CHECK-COMPILATION-DIR
+// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH%{fs-sep}empty %s -emit-llvm 
-o - -isysroot %p -debugger-tuning=lldb | FileCheck %s -check-prefix 
CHECK-SYSROOT
+// RUN: %clang -g 
-fdebug-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH%{fs-sep}empty -S -c %s 
-emit-llvm -o - | FileCheck %s
+// RUN: %clang -g 
-ffile-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH%{fs-sep}empty -S -c %s 
-emit-llvm -o - | FileCheck %s
 
 #include "Inputs/stdio.h"
 
@@ -19,26 +19,24 @@
   vprintf("string", argp);
 }
 
-// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"/UNLIKELY_PATH/empty{{/|}}"
-// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"/UNLIKELY_PATH/empty{{/|}}{{.*}}",
-// On POSIX systems "Dir" should actually be empty, but on Windows we
-// can't recognize "/UNLIKELY_PATH" as being an absolute path.
-// CHECK-NO-MAIN-FILE-NAME-SAME:directory: "{{()|(.*:.*)}}")
-// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"/UNLIKELY_PATH/empty{{/|}}Inputs/stdio.h",
-// CHECK-NO-MAIN-FILE-NAME-SAME:directory: "{{()|(.*:.*)}}")
+// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"{{/|.:}}UNLIKELY_PATH{{/|}}empty{{/|}}",
+// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"{{/|.:}}UNLIKELY_PATH{{/|}}empty{{/|}}{{.*}}",
+// CHECK-NO-MAIN-FILE-NAME-SAME:directory: "")
+// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"{{/|.:}}UNLIKELY_PATH{{/|}}empty{{/|}}Inputs{{/|}}stdio.h",
+// CHECK-NO-MAIN-FILE-NAME-SAME:directory: "")
 // CHECK-NO-MAIN-FILE-NAME-NOT: !DIFile(filename:
 
-// CHECK-EVIL: !DIFile(filename: "/UNLIKELY_PATH=empty{{/|}}{{.*}}"
-// CHECK-EVIL: !DIFile(filename: 
"/UNLIKELY_PATH=empty{{/|}}{{.*}}Inputs/stdio.h",
-// CHECK-EVIL-SAME:directory: "{{()|(.*:.*)}}")
+// CHECK-EVIL: !DIFile(filename: 
"{{/|.:}}UNLIKELY_PATH=empty{{/|}}{{.*}}"
+// CHECK-EVIL: !DIFile(filename: 
"{{/|.:}}UNLIKELY_PATH=empty{{/|}}{{.*}}Inputs{{/|}}stdio.h",
+// CHECK-EVIL-SAME:directory: "")
 // CHECK-EVIL-NOT: !DIFile(filename:
 
-// CHECK: !DIFile(filename: "/UNLIKELY_PATH/empty{{/|}}{{.*}}"
-// CHECK: !DIFile(filename: 
"/UNLIKELY_PATH/empty{{/|}}{{.*}}Inputs/stdio.h",
-// CHECK-SAME:directory: "{{()|(.*:.*)}}")
+// CHECK: !DIFile(filename: 
"{{/|.:}}UNLIKELY_PATH{{/|}}empty{{/|}}{{.*}}",
+// CHECK: !DIFile(filename: 
"{{/|.:}}UNLIKELY_PATH{{/|}}empty{{/|}}{{.*}}Inputs{{/|}}stdio.h",
+// CHECK-SAME:directory: ""
 // CHECK-NOT: !DIFile(filename:
 
-// CHECK-COMPILATION-DIR: !DIFile(filename: "{{.*}}", directory: 
"/UNLIKELY_P

[PATCH] D111587: re-land: [clang] Fix absolute file paths with -fdebug-prefix-map

2022-03-14 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 415292.
keith added a comment.
Herald added a project: All.

Update subsitutions with slashes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111587

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/relative-debug-prefix-map.c
  clang/test/Modules/module-debuginfo-prefix.m


Index: clang/test/Modules/module-debuginfo-prefix.m
===
--- clang/test/Modules/module-debuginfo-prefix.m
+++ clang/test/Modules/module-debuginfo-prefix.m
@@ -4,7 +4,7 @@
 // Modules:
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -x objective-c -fmodules -fmodule-format=obj \
-// RUN:   -fdebug-prefix-map=%S/Inputs=/OVERRIDE \
+// RUN:   -fdebug-prefix-map=%S%{fs-sep}Inputs=%{fs-src-root}OVERRIDE \
 // RUN:   -fimplicit-module-maps -DMODULES -fmodules-cache-path=%t %s \
 // RUN:   -I %S/Inputs -I %t -emit-llvm -o %t.ll \
 // RUN:   -mllvm -debug-only=pchcontainer &>%t-mod.ll
@@ -12,7 +12,7 @@
 
 // PCH:
 // RUN: %clang_cc1 -x objective-c -emit-pch -fmodule-format=obj -I %S/Inputs \
-// RUN:   -fdebug-prefix-map=%S/Inputs=/OVERRIDE \
+// RUN:   -fdebug-prefix-map=%S%{fs-sep}Inputs=%{fs-src-root}OVERRIDE \
 // RUN:   -o %t.pch %S/Inputs/DebugObjC.h \
 // RUN:   -mllvm -debug-only=pchcontainer &>%t-pch.ll
 // RUN: cat %t-pch.ll | FileCheck %s
@@ -21,6 +21,4 @@
 @import DebugObjC;
 #endif
 
-// Dir should always be empty, but on Windows we can't recognize /var
-// as being an absolute path.
-// CHECK: !DIFile(filename: "/OVERRIDE/DebugObjC.h", directory: 
"{{()|(.*:.*)}}")
+// CHECK: !DIFile(filename: "{{/|.:}}OVERRIDE{{/|}}DebugObjC.h", 
directory: "")
Index: clang/test/CodeGen/relative-debug-prefix-map.c
===
--- /dev/null
+++ clang/test/CodeGen/relative-debug-prefix-map.c
@@ -0,0 +1,17 @@
+// RUN: mkdir -p %t.nested/dir && cd %t.nested/dir
+// RUN: cp %s %t.nested/dir/main.c
+// RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%t.nested=. 
%t.nested/dir/main.c -emit-llvm -o - | FileCheck %s
+//
+// RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%p=. %s 
-emit-llvm -o - | FileCheck %s --check-prefix=CHECK-DIRECT
+//
+// RUN: cd %p
+// RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-compilation-dir=. 
relative-debug-prefix-map.c -emit-llvm -o - | FileCheck %s 
--check-prefix=CHECK-DIRECT
+
+// CHECK: !DIFile(filename: "main.c", directory: "./dir")
+// CHECK-DIRECT: !DIFile(filename: "relative-debug-prefix-map.c", directory: 
".")
+
+int main(int argc, char **argv) {
+  (void)argc;
+  (void)argv;
+  return 0;
+}
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -443,6 +443,9 @@
   Dir = DirBuf;
   File = FileBuf;
 }
+  } else if (llvm::sys::path::is_absolute(FileName)) {
+Dir = llvm::sys::path::parent_path(RemappedFile);
+File = llvm::sys::path::filename(RemappedFile);
   } else {
 Dir = CurDir;
 File = RemappedFile;


Index: clang/test/Modules/module-debuginfo-prefix.m
===
--- clang/test/Modules/module-debuginfo-prefix.m
+++ clang/test/Modules/module-debuginfo-prefix.m
@@ -4,7 +4,7 @@
 // Modules:
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -x objective-c -fmodules -fmodule-format=obj \
-// RUN:   -fdebug-prefix-map=%S/Inputs=/OVERRIDE \
+// RUN:   -fdebug-prefix-map=%S%{fs-sep}Inputs=%{fs-src-root}OVERRIDE \
 // RUN:   -fimplicit-module-maps -DMODULES -fmodules-cache-path=%t %s \
 // RUN:   -I %S/Inputs -I %t -emit-llvm -o %t.ll \
 // RUN:   -mllvm -debug-only=pchcontainer &>%t-mod.ll
@@ -12,7 +12,7 @@
 
 // PCH:
 // RUN: %clang_cc1 -x objective-c -emit-pch -fmodule-format=obj -I %S/Inputs \
-// RUN:   -fdebug-prefix-map=%S/Inputs=/OVERRIDE \
+// RUN:   -fdebug-prefix-map=%S%{fs-sep}Inputs=%{fs-src-root}OVERRIDE \
 // RUN:   -o %t.pch %S/Inputs/DebugObjC.h \
 // RUN:   -mllvm -debug-only=pchcontainer &>%t-pch.ll
 // RUN: cat %t-pch.ll | FileCheck %s
@@ -21,6 +21,4 @@
 @import DebugObjC;
 #endif
 
-// Dir should always be empty, but on Windows we can't recognize /var
-// as being an absolute path.
-// CHECK: !DIFile(filename: "/OVERRIDE/DebugObjC.h", directory: "{{()|(.*:.*)}}")
+// CHECK: !DIFile(filename: "{{/|.:}}OVERRIDE{{/|}}DebugObjC.h", directory: "")
Index: clang/test/CodeGen/relative-debug-prefix-map.c
===
--- /dev/null
+++ clang/test/CodeGen/relative-debug-prefix-map.c
@@ -0,0 +1,17 @@
+// RUN: mkdir -p %t.nested/dir && cd %t.nested/dir
+// RUN: cp %s %t.nested/dir/main.c
+// RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%t.nested=. %t.nested/dir/main.c -emit-llvm -o - | FileCheck %s
+//
+// RUN: %clang_cc1 -debug-info-kind=stan

[PATCH] D111457: [test] Add lit helper for windows paths

2022-03-14 Thread Keith Smiley via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6541d3e979c1: [test] Add lit helper for windows paths 
(authored by keith).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111457

Files:
  llvm/docs/CommandGuide/lit.rst
  llvm/docs/TestingGuide.rst
  llvm/utils/lit/lit/TestRunner.py


Index: llvm/utils/lit/lit/TestRunner.py
===
--- llvm/utils/lit/lit/TestRunner.py
+++ llvm/utils/lit/lit/TestRunner.py
@@ -6,6 +6,7 @@
 import os, signal, subprocess, sys
 import re
 import stat
+import pathlib
 import platform
 import shutil
 import tempfile
@@ -1121,6 +1122,12 @@
   ('%basename_t', baseName),
   ('%T', tmpDir)])
 
+substitutions.extend([
+('%{fs-src-root}', pathlib.Path(sourcedir).anchor),
+('%{fs-tmp-root}', pathlib.Path(tmpBase).anchor),
+('%{fs-sep}', os.path.sep),
+])
+
 # "%/[STpst]" should be normalized.
 substitutions.extend([
 ('%/s', sourcepath.replace('\\', '/')),
Index: llvm/docs/TestingGuide.rst
===
--- llvm/docs/TestingGuide.rst
+++ llvm/docs/TestingGuide.rst
@@ -569,6 +569,18 @@
 
Expands to the path separator, i.e. ``:`` (or ``;`` on Windows).
 
+``${fs-src-root}``
+   Expands to the root component of file system paths for the source directory,
+   i.e. ``/`` on Unix systems or ``C:\`` (or another drive) on Windows.
+
+``${fs-tmp-root}``
+   Expands to the root component of file system paths for the test's temporary
+   directory, i.e. ``/`` on Unix systems or ``C:\`` (or another drive) on
+   Windows.
+
+``${fs-sep}``
+   Expands to the file system separator, i.e. ``/`` or ``\`` on Windows.
+
 ``%/s, %/S, %/t, %/T:``
 
   Act like the corresponding substitution above but replace any ``\``
Index: llvm/docs/CommandGuide/lit.rst
===
--- llvm/docs/CommandGuide/lit.rst
+++ llvm/docs/CommandGuide/lit.rst
@@ -523,6 +523,9 @@
  %S  source dir (directory of the file currently being run)
  %p  same as %S
  %{pathsep}  path separator
+ %{fs-src-root}  root component of file system paths pointing to the 
LLVM checkout
+ %{fs-tmp-root}  root component of file system paths pointing to the 
test's temporary directory
+ %{fs-sep}   file system path separator
  %t  temporary file name unique to the test
  %basename_t The last path component of %t but without the 
``.tmp`` extension
  %T  parent directory of %t (not unique, deprecated, do 
not use)


Index: llvm/utils/lit/lit/TestRunner.py
===
--- llvm/utils/lit/lit/TestRunner.py
+++ llvm/utils/lit/lit/TestRunner.py
@@ -6,6 +6,7 @@
 import os, signal, subprocess, sys
 import re
 import stat
+import pathlib
 import platform
 import shutil
 import tempfile
@@ -1121,6 +1122,12 @@
   ('%basename_t', baseName),
   ('%T', tmpDir)])
 
+substitutions.extend([
+('%{fs-src-root}', pathlib.Path(sourcedir).anchor),
+('%{fs-tmp-root}', pathlib.Path(tmpBase).anchor),
+('%{fs-sep}', os.path.sep),
+])
+
 # "%/[STpst]" should be normalized.
 substitutions.extend([
 ('%/s', sourcepath.replace('\\', '/')),
Index: llvm/docs/TestingGuide.rst
===
--- llvm/docs/TestingGuide.rst
+++ llvm/docs/TestingGuide.rst
@@ -569,6 +569,18 @@
 
Expands to the path separator, i.e. ``:`` (or ``;`` on Windows).
 
+``${fs-src-root}``
+   Expands to the root component of file system paths for the source directory,
+   i.e. ``/`` on Unix systems or ``C:\`` (or another drive) on Windows.
+
+``${fs-tmp-root}``
+   Expands to the root component of file system paths for the test's temporary
+   directory, i.e. ``/`` on Unix systems or ``C:\`` (or another drive) on
+   Windows.
+
+``${fs-sep}``
+   Expands to the file system separator, i.e. ``/`` or ``\`` on Windows.
+
 ``%/s, %/S, %/t, %/T:``
 
   Act like the corresponding substitution above but replace any ``\``
Index: llvm/docs/CommandGuide/lit.rst
===
--- llvm/docs/CommandGuide/lit.rst
+++ llvm/docs/CommandGuide/lit.rst
@@ -523,6 +523,9 @@
  %S  source dir (directory of the file currently being run)
  %p  same as %S
  %{pathsep}  path separator
+ %{fs-src-root}  root component of file system paths pointing to the LLVM checkout
+ %{fs-tmp-root}  root component of file system paths pointing to t

[PATCH] D119788: [AArch64] Add support for -march=native for Apple M1 CPU

2022-03-14 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

Bump, I think I've covered everything here, let me know if not!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119788

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


[PATCH] D111579: [clang] Fix DIFile directory root on Windows

2022-03-14 Thread Keith Smiley via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcb22d71806b7: [clang] Fix DIFile directory root on Windows 
(authored by keith).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111579

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/debug-prefix-map.c


Index: clang/test/CodeGen/debug-prefix-map.c
===
--- clang/test/CodeGen/debug-prefix-map.c
+++ clang/test/CodeGen/debug-prefix-map.c
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - | FileCheck %s 
-check-prefix CHECK-NO-MAIN-FILE-NAME
-// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=/UNLIKELY_PATH=empty %s -emit-llvm -o - | FileCheck %s 
-check-prefix CHECK-EVIL
-// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - -main-file-name 
debug-prefix-map.c | FileCheck %s
-// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - 
-fdebug-compilation-dir %p | FileCheck %s -check-prefix CHECK-COMPILATION-DIR
-// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - -isysroot %p 
-debugger-tuning=lldb | FileCheck %s -check-prefix CHECK-SYSROOT
-// RUN: %clang -g -fdebug-prefix-map=%p=/UNLIKELY_PATH/empty -S -c %s 
-emit-llvm -o - | FileCheck %s
-// RUN: %clang -g -ffile-prefix-map=%p=/UNLIKELY_PATH/empty -S -c %s 
-emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH%{fs-sep}empty %s -emit-llvm 
-o - | FileCheck %s -check-prefix CHECK-NO-MAIN-FILE-NAME
+// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH=empty %s -emit-llvm -o - | 
FileCheck %s -check-prefix CHECK-EVIL
+// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH%{fs-sep}empty %s -emit-llvm 
-o - -main-file-name debug-prefix-map.c | FileCheck %s
+// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH%{fs-sep}empty %s -emit-llvm 
-o - -fdebug-compilation-dir %p | FileCheck %s -check-prefix 
CHECK-COMPILATION-DIR
+// RUN: %clang_cc1 -debug-info-kind=standalone 
-fdebug-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH%{fs-sep}empty %s -emit-llvm 
-o - -isysroot %p -debugger-tuning=lldb | FileCheck %s -check-prefix 
CHECK-SYSROOT
+// RUN: %clang -g 
-fdebug-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH%{fs-sep}empty -S -c %s 
-emit-llvm -o - | FileCheck %s
+// RUN: %clang -g 
-ffile-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH%{fs-sep}empty -S -c %s 
-emit-llvm -o - | FileCheck %s
 
 #include "Inputs/stdio.h"
 
@@ -19,26 +19,24 @@
   vprintf("string", argp);
 }
 
-// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"/UNLIKELY_PATH/empty{{/|}}"
-// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"/UNLIKELY_PATH/empty{{/|}}{{.*}}",
-// On POSIX systems "Dir" should actually be empty, but on Windows we
-// can't recognize "/UNLIKELY_PATH" as being an absolute path.
-// CHECK-NO-MAIN-FILE-NAME-SAME:directory: "{{()|(.*:.*)}}")
-// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"/UNLIKELY_PATH/empty{{/|}}Inputs/stdio.h",
-// CHECK-NO-MAIN-FILE-NAME-SAME:directory: "{{()|(.*:.*)}}")
+// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"{{/|.:}}UNLIKELY_PATH{{/|}}empty{{/|}}",
+// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"{{/|.:}}UNLIKELY_PATH{{/|}}empty{{/|}}{{.*}}",
+// CHECK-NO-MAIN-FILE-NAME-SAME:directory: "")
+// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: 
"{{/|.:}}UNLIKELY_PATH{{/|}}empty{{/|}}Inputs{{/|}}stdio.h",
+// CHECK-NO-MAIN-FILE-NAME-SAME:directory: "")
 // CHECK-NO-MAIN-FILE-NAME-NOT: !DIFile(filename:
 
-// CHECK-EVIL: !DIFile(filename: "/UNLIKELY_PATH=empty{{/|}}{{.*}}"
-// CHECK-EVIL: !DIFile(filename: 
"/UNLIKELY_PATH=empty{{/|}}{{.*}}Inputs/stdio.h",
-// CHECK-EVIL-SAME:directory: "{{()|(.*:.*)}}")
+// CHECK-EVIL: !DIFile(filename: 
"{{/|.:}}UNLIKELY_PATH=empty{{/|}}{{.*}}"
+// CHECK-EVIL: !DIFile(filename: 
"{{/|.:}}UNLIKELY_PATH=empty{{/|}}{{.*}}Inputs{{/|}}stdio.h",
+// CHECK-EVIL-SAME:directory: "")
 // CHECK-EVIL-NOT: !DIFile(filename:
 
-// CHECK: !DIFile(filename: "/UNLIKELY_PATH/empty{{/|}}{{.*}}"
-// CHECK: !DIFile(filename: 
"/UNLIKELY_PATH/empty{{/|}}{{.*}}Inputs/stdio.h",
-// CHECK-SAME:directory: "{{()|(.*:.*)}}")
+// CHECK: !DIFile(filename: 
"{{/|.:}}UNLIKELY_PATH{{/|}}empty{{/|}}{{.*}}",
+// CHECK: !DIFile(filename: 
"{{/|.:}}UNLIKELY_PATH{{/|}}empty{{/|}}{{.*}}Inputs{{/|}}stdio.h",
+// CHECK-SAME:directory: ""
 // CHECK-NOT: !DIFile(filename:
 
-// CHECK-COMPILATION-DIR: !DIFile(filename: "

[PATCH] D111587: re-land: [clang] Fix absolute file paths with -fdebug-prefix-map

2022-03-14 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 415307.
keith added a comment.

Fix tests with dwarf 6


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111587

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/relative-debug-prefix-map.c
  clang/test/Modules/module-debuginfo-prefix.m


Index: clang/test/Modules/module-debuginfo-prefix.m
===
--- clang/test/Modules/module-debuginfo-prefix.m
+++ clang/test/Modules/module-debuginfo-prefix.m
@@ -4,7 +4,7 @@
 // Modules:
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -x objective-c -fmodules -fmodule-format=obj \
-// RUN:   -fdebug-prefix-map=%S/Inputs=/OVERRIDE \
+// RUN:   -fdebug-prefix-map=%S%{fs-sep}Inputs=%{fs-src-root}OVERRIDE \
 // RUN:   -fimplicit-module-maps -DMODULES -fmodules-cache-path=%t %s \
 // RUN:   -I %S/Inputs -I %t -emit-llvm -o %t.ll \
 // RUN:   -mllvm -debug-only=pchcontainer &>%t-mod.ll
@@ -12,7 +12,7 @@
 
 // PCH:
 // RUN: %clang_cc1 -x objective-c -emit-pch -fmodule-format=obj -I %S/Inputs \
-// RUN:   -fdebug-prefix-map=%S/Inputs=/OVERRIDE \
+// RUN:   -fdebug-prefix-map=%S%{fs-sep}Inputs=%{fs-src-root}OVERRIDE \
 // RUN:   -o %t.pch %S/Inputs/DebugObjC.h \
 // RUN:   -mllvm -debug-only=pchcontainer &>%t-pch.ll
 // RUN: cat %t-pch.ll | FileCheck %s
@@ -21,6 +21,4 @@
 @import DebugObjC;
 #endif
 
-// Dir should always be empty, but on Windows we can't recognize /var
-// as being an absolute path.
-// CHECK: !DIFile(filename: "/OVERRIDE/DebugObjC.h", directory: 
"{{()|(.*:.*)}}")
+// CHECK: !DIFile(filename: "{{/|.:}}OVERRIDE{{/|}}DebugObjC.h", 
directory: "")
Index: clang/test/CodeGen/relative-debug-prefix-map.c
===
--- /dev/null
+++ clang/test/CodeGen/relative-debug-prefix-map.c
@@ -0,0 +1,17 @@
+// RUN: mkdir -p %t.nested/dir && cd %t.nested/dir
+// RUN: cp %s %t.nested/dir/main.c
+// RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%t.nested=. 
%t.nested/dir/main.c -emit-llvm -o - | FileCheck %s
+//
+// RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%p=. %s 
-emit-llvm -o - | FileCheck %s --check-prefix=CHECK-DIRECT
+//
+// RUN: cd %p
+// RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-compilation-dir=. 
relative-debug-prefix-map.c -emit-llvm -o - | FileCheck %s 
--check-prefix=CHECK-DIRECT
+
+// CHECK: !DIFile(filename: "main.c", directory: "./dir"
+// CHECK-DIRECT: !DIFile(filename: "relative-debug-prefix-map.c", directory: 
"."
+
+int main(int argc, char **argv) {
+  (void)argc;
+  (void)argv;
+  return 0;
+}
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -443,6 +443,9 @@
   Dir = DirBuf;
   File = FileBuf;
 }
+  } else if (llvm::sys::path::is_absolute(FileName)) {
+Dir = llvm::sys::path::parent_path(RemappedFile);
+File = llvm::sys::path::filename(RemappedFile);
   } else {
 Dir = CurDir;
 File = RemappedFile;


Index: clang/test/Modules/module-debuginfo-prefix.m
===
--- clang/test/Modules/module-debuginfo-prefix.m
+++ clang/test/Modules/module-debuginfo-prefix.m
@@ -4,7 +4,7 @@
 // Modules:
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -x objective-c -fmodules -fmodule-format=obj \
-// RUN:   -fdebug-prefix-map=%S/Inputs=/OVERRIDE \
+// RUN:   -fdebug-prefix-map=%S%{fs-sep}Inputs=%{fs-src-root}OVERRIDE \
 // RUN:   -fimplicit-module-maps -DMODULES -fmodules-cache-path=%t %s \
 // RUN:   -I %S/Inputs -I %t -emit-llvm -o %t.ll \
 // RUN:   -mllvm -debug-only=pchcontainer &>%t-mod.ll
@@ -12,7 +12,7 @@
 
 // PCH:
 // RUN: %clang_cc1 -x objective-c -emit-pch -fmodule-format=obj -I %S/Inputs \
-// RUN:   -fdebug-prefix-map=%S/Inputs=/OVERRIDE \
+// RUN:   -fdebug-prefix-map=%S%{fs-sep}Inputs=%{fs-src-root}OVERRIDE \
 // RUN:   -o %t.pch %S/Inputs/DebugObjC.h \
 // RUN:   -mllvm -debug-only=pchcontainer &>%t-pch.ll
 // RUN: cat %t-pch.ll | FileCheck %s
@@ -21,6 +21,4 @@
 @import DebugObjC;
 #endif
 
-// Dir should always be empty, but on Windows we can't recognize /var
-// as being an absolute path.
-// CHECK: !DIFile(filename: "/OVERRIDE/DebugObjC.h", directory: "{{()|(.*:.*)}}")
+// CHECK: !DIFile(filename: "{{/|.:}}OVERRIDE{{/|}}DebugObjC.h", directory: "")
Index: clang/test/CodeGen/relative-debug-prefix-map.c
===
--- /dev/null
+++ clang/test/CodeGen/relative-debug-prefix-map.c
@@ -0,0 +1,17 @@
+// RUN: mkdir -p %t.nested/dir && cd %t.nested/dir
+// RUN: cp %s %t.nested/dir/main.c
+// RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%t.nested=. %t.nested/dir/main.c -emit-llvm -o - | FileCheck %s
+//
+// RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%p=. %s -emit-l

[PATCH] D121663: reland: [clang] Don't append the working directory to absolute paths

2022-03-14 Thread Keith Smiley via Phabricator via cfe-commits
keith created this revision.
keith added a reviewer: aprantl.
Herald added a project: All.
keith requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This fixes a bug that happens when using -fdebug-prefix-map to remap an
absolute path to a relative path. Since the path was absolute before
remapping, it is safe to assume that concatenating the remapped working
directory would be wrong.

This was originally submitted as https://reviews.llvm.org/D113718, but
reverted because when testing with dwarf 6 enabled, the tests were too
strict.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121663

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/debug-prefix-map.c


Index: clang/test/CodeGen/debug-prefix-map.c
===
--- clang/test/CodeGen/debug-prefix-map.c
+++ clang/test/CodeGen/debug-prefix-map.c
@@ -6,6 +6,9 @@
 // RUN: %clang -g 
-fdebug-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH%{fs-sep}empty -S -c %s 
-emit-llvm -o - | FileCheck %s
 // RUN: %clang -g 
-ffile-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH%{fs-sep}empty -S -c %s 
-emit-llvm -o - | FileCheck %s
 
+// RUN: %clang -g -fdebug-prefix-map=%p=./UNLIKELY_PATH/empty -S -c %s 
-emit-llvm -o - | FileCheck %s --check-prefix=CHECK-REL
+// RUN: %clang -g -ffile-prefix-map=%p=./UNLIKELY_PATH/empty -S -c %s 
-emit-llvm -o - | FileCheck %s --check-prefix=CHECK-REL
+
 #include "Inputs/stdio.h"
 
 int main(int argc, char **argv) {
@@ -40,3 +43,7 @@
 // CHECK-COMPILATION-DIR: !DIFile(filename: "{{.*}}Inputs{{/|}}stdio.h", 
directory: "{{/|.:}}UNLIKELY_PATH{{/|}}empty")
 // CHECK-COMPILATION-DIR-NOT: !DIFile(filename:
 // CHECK-SYSROOT: !DICompileUnit({{.*}}sysroot: 
"{{/|.:}}UNLIKELY_PATH{{/|}}empty"
+
+// CHECK-REL: !DIFile(filename: "./UNLIKELY_PATH/empty{{/|}}{{.*}}",
+// CHECK-REL: !DIFile(filename: 
"./UNLIKELY_PATH/empty{{/|}}{{.*}}Inputs/stdio.h",
+// CHECK-REL-SAME:directory: ""
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -444,7 +444,8 @@
   File = FileBuf;
 }
   } else {
-Dir = CurDir;
+if (!llvm::sys::path::is_absolute(FileName))
+  Dir = CurDir;
 File = RemappedFile;
   }
   llvm::DIFile *F = DBuilder.createFile(File, Dir, CSInfo, Source);


Index: clang/test/CodeGen/debug-prefix-map.c
===
--- clang/test/CodeGen/debug-prefix-map.c
+++ clang/test/CodeGen/debug-prefix-map.c
@@ -6,6 +6,9 @@
 // RUN: %clang -g -fdebug-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH%{fs-sep}empty -S -c %s -emit-llvm -o - | FileCheck %s
 // RUN: %clang -g -ffile-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH%{fs-sep}empty -S -c %s -emit-llvm -o - | FileCheck %s
 
+// RUN: %clang -g -fdebug-prefix-map=%p=./UNLIKELY_PATH/empty -S -c %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-REL
+// RUN: %clang -g -ffile-prefix-map=%p=./UNLIKELY_PATH/empty -S -c %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-REL
+
 #include "Inputs/stdio.h"
 
 int main(int argc, char **argv) {
@@ -40,3 +43,7 @@
 // CHECK-COMPILATION-DIR: !DIFile(filename: "{{.*}}Inputs{{/|}}stdio.h", directory: "{{/|.:}}UNLIKELY_PATH{{/|}}empty")
 // CHECK-COMPILATION-DIR-NOT: !DIFile(filename:
 // CHECK-SYSROOT: !DICompileUnit({{.*}}sysroot: "{{/|.:}}UNLIKELY_PATH{{/|}}empty"
+
+// CHECK-REL: !DIFile(filename: "./UNLIKELY_PATH/empty{{/|}}{{.*}}",
+// CHECK-REL: !DIFile(filename: "./UNLIKELY_PATH/empty{{/|}}{{.*}}Inputs/stdio.h",
+// CHECK-REL-SAME:directory: ""
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -444,7 +444,8 @@
   File = FileBuf;
 }
   } else {
-Dir = CurDir;
+if (!llvm::sys::path::is_absolute(FileName))
+  Dir = CurDir;
 File = RemappedFile;
   }
   llvm::DIFile *F = DBuilder.createFile(File, Dir, CSInfo, Source);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D111587: re-land: [clang] Fix absolute file paths with -fdebug-prefix-map

2022-03-15 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

I actually mean dwarf 6, which appears to be partially implemented according to 
https://lists.llvm.org/pipermail/llvm-dev/2020-April/141055.html

I discovered the issue from the failed tests on 
https://reviews.llvm.org/D113718 where you can see the test output contains a 
checksum that otherwise doesn't appear. Passing `-dwarf-version=6` reproduces 
the issue.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111587

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


[PATCH] D111587: re-land: [clang] Fix absolute file paths with -fdebug-prefix-map

2022-03-15 Thread Keith Smiley via Phabricator via cfe-commits
keith added inline comments.



Comment at: clang/test/Modules/module-debuginfo-prefix.m:24
 
-// Dir should always be empty, but on Windows we can't recognize /var
-// as being an absolute path.
-// CHECK: !DIFile(filename: "/OVERRIDE/DebugObjC.h", directory: 
"{{()|(.*:.*)}}")
+// CHECK: !DIFile(filename: "{{/|.:}}OVERRIDE{{/|}}DebugObjC.h", 
directory: "")

probinson wrote:
> Does this want to be 
> `"%{fs-src-root}OVERRIDE%{fs-sep}DebugObjC.h"` ?
That can only be used in the RUN invocations, but unfortunately regardless it 
could be used here because of the escaped backslashes, so it requires a regex 
like this instead 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111587

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


[PATCH] D111587: re-land: [clang] Fix absolute file paths with -fdebug-prefix-map

2022-03-15 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

You're right it's version 5 not 4, maybe the issue is that some platforms (like 
macOS) are defaulting to 4 intentionally for now? I guess I thought 6 because 
passing 6 also reproduces, but I didn't also try 5.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111587

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


[PATCH] D121663: reland: [clang] Don't append the working directory to absolute paths

2022-03-15 Thread Keith Smiley via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa2db7d5e9c52: reland: [clang] Don't append the working 
directory to absolute paths (authored by keith).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121663

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/debug-prefix-map.c


Index: clang/test/CodeGen/debug-prefix-map.c
===
--- clang/test/CodeGen/debug-prefix-map.c
+++ clang/test/CodeGen/debug-prefix-map.c
@@ -6,6 +6,9 @@
 // RUN: %clang -g 
-fdebug-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH%{fs-sep}empty -S -c %s 
-emit-llvm -o - | FileCheck %s
 // RUN: %clang -g 
-ffile-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH%{fs-sep}empty -S -c %s 
-emit-llvm -o - | FileCheck %s
 
+// RUN: %clang -g -fdebug-prefix-map=%p=./UNLIKELY_PATH/empty -S -c %s 
-emit-llvm -o - | FileCheck %s --check-prefix=CHECK-REL
+// RUN: %clang -g -ffile-prefix-map=%p=./UNLIKELY_PATH/empty -S -c %s 
-emit-llvm -o - | FileCheck %s --check-prefix=CHECK-REL
+
 #include "Inputs/stdio.h"
 
 int main(int argc, char **argv) {
@@ -40,3 +43,7 @@
 // CHECK-COMPILATION-DIR: !DIFile(filename: "{{.*}}Inputs{{/|}}stdio.h", 
directory: "{{/|.:}}UNLIKELY_PATH{{/|}}empty")
 // CHECK-COMPILATION-DIR-NOT: !DIFile(filename:
 // CHECK-SYSROOT: !DICompileUnit({{.*}}sysroot: 
"{{/|.:}}UNLIKELY_PATH{{/|}}empty"
+
+// CHECK-REL: !DIFile(filename: "./UNLIKELY_PATH/empty{{/|}}{{.*}}",
+// CHECK-REL: !DIFile(filename: 
"./UNLIKELY_PATH/empty{{/|}}{{.*}}Inputs/stdio.h",
+// CHECK-REL-SAME:directory: ""
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -444,7 +444,8 @@
   File = FileBuf;
 }
   } else {
-Dir = CurDir;
+if (!llvm::sys::path::is_absolute(FileName))
+  Dir = CurDir;
 File = RemappedFile;
   }
   llvm::DIFile *F = DBuilder.createFile(File, Dir, CSInfo, Source);


Index: clang/test/CodeGen/debug-prefix-map.c
===
--- clang/test/CodeGen/debug-prefix-map.c
+++ clang/test/CodeGen/debug-prefix-map.c
@@ -6,6 +6,9 @@
 // RUN: %clang -g -fdebug-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH%{fs-sep}empty -S -c %s -emit-llvm -o - | FileCheck %s
 // RUN: %clang -g -ffile-prefix-map=%p=%{fs-src-root}UNLIKELY_PATH%{fs-sep}empty -S -c %s -emit-llvm -o - | FileCheck %s
 
+// RUN: %clang -g -fdebug-prefix-map=%p=./UNLIKELY_PATH/empty -S -c %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-REL
+// RUN: %clang -g -ffile-prefix-map=%p=./UNLIKELY_PATH/empty -S -c %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-REL
+
 #include "Inputs/stdio.h"
 
 int main(int argc, char **argv) {
@@ -40,3 +43,7 @@
 // CHECK-COMPILATION-DIR: !DIFile(filename: "{{.*}}Inputs{{/|}}stdio.h", directory: "{{/|.:}}UNLIKELY_PATH{{/|}}empty")
 // CHECK-COMPILATION-DIR-NOT: !DIFile(filename:
 // CHECK-SYSROOT: !DICompileUnit({{.*}}sysroot: "{{/|.:}}UNLIKELY_PATH{{/|}}empty"
+
+// CHECK-REL: !DIFile(filename: "./UNLIKELY_PATH/empty{{/|}}{{.*}}",
+// CHECK-REL: !DIFile(filename: "./UNLIKELY_PATH/empty{{/|}}{{.*}}Inputs/stdio.h",
+// CHECK-REL-SAME:directory: ""
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -444,7 +444,8 @@
   File = FileBuf;
 }
   } else {
-Dir = CurDir;
+if (!llvm::sys::path::is_absolute(FileName))
+  Dir = CurDir;
 File = RemappedFile;
   }
   llvm::DIFile *F = DBuilder.createFile(File, Dir, CSInfo, Source);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D111587: re-land: [clang] Fix absolute file paths with -fdebug-prefix-map

2022-03-15 Thread Keith Smiley via Phabricator via cfe-commits
keith abandoned this revision.
keith added a comment.

There were 2 competing revisions for this bug fix, I landed 
https://reviews.llvm.org/D121663 instead since it sounds like having an empty 
`directory` is more correct in this case


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111587

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


[PATCH] D117937: [VFS] Add a "redirecting-with" field to overlays

2022-02-03 Thread Keith Smiley via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG502f14d6f2ee: [VFS] Add a "redirecting-with" field 
to overlays (authored by bnbarham, committed by keith).

Changed prior to commit:
  https://reviews.llvm.org/D117937?vs=404999&id=405758#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117937

Files:
  clang/test/VFS/Inputs/redirect-and-fallthrough.yaml
  clang/test/VFS/Inputs/unknown-redirect.yaml
  clang/test/VFS/fallback.c
  clang/test/VFS/parse-errors.c
  llvm/include/llvm/Support/VirtualFileSystem.h
  llvm/lib/Support/VirtualFileSystem.cpp
  llvm/unittests/Support/VirtualFileSystemTest.cpp

Index: llvm/unittests/Support/VirtualFileSystemTest.cpp
===
--- llvm/unittests/Support/VirtualFileSystemTest.cpp
+++ llvm/unittests/Support/VirtualFileSystemTest.cpp
@@ -1910,7 +1910,25 @@
   Lower);
   EXPECT_EQ(nullptr, FS.get());
 
-  EXPECT_EQ(26, NumDiagnostics);
+  // invalid redirect kind
+  FS = getFromYAMLString("{ 'redirecting-with': 'none', 'roots': [{\n"
+ "  'type': 'directory-remap',\n"
+ "  'name': '//root/A',\n"
+ "  'external-contents': '//root/B' }]}",
+ Lower);
+  EXPECT_EQ(nullptr, FS.get());
+
+  // redirect and fallthrough passed
+  FS = getFromYAMLString("{ 'redirecting-with': 'fallthrough',\n"
+ "  'fallthrough': true,\n"
+ "  'roots': [{\n"
+ "'type': 'directory-remap',\n"
+ "'name': '//root/A',\n"
+ "'external-contents': '//root/B' }]}",
+ Lower);
+  EXPECT_EQ(nullptr, FS.get());
+
+  EXPECT_EQ(28, NumDiagnostics);
 }
 
 TEST_F(VFSFromYAMLTest, UseExternalName) {
@@ -2710,6 +2728,121 @@
   EXPECT_FALSE(FS->exists(_c.path("c")));
 }
 
+TEST_F(VFSFromYAMLTest, RedirectingWith) {
+  IntrusiveRefCntPtr Both(new DummyFileSystem());
+  Both->addDirectory("//root/a");
+  Both->addRegularFile("//root/a/f");
+  Both->addDirectory("//root/b");
+  Both->addRegularFile("//root/b/f");
+
+  IntrusiveRefCntPtr AOnly(new DummyFileSystem());
+  AOnly->addDirectory("//root/a");
+  AOnly->addRegularFile("//root/a/f");
+
+  IntrusiveRefCntPtr BOnly(new DummyFileSystem());
+  BOnly->addDirectory("//root/b");
+  BOnly->addRegularFile("//root/b/f");
+
+  auto BaseStr = std::string("  'roots': [\n"
+ "{\n"
+ "  'type': 'directory-remap',\n"
+ "  'name': '//root/a',\n"
+ "  'external-contents': '//root/b'\n"
+ "}\n"
+ "  ]\n"
+ "}");
+  auto FallthroughStr = "{ 'redirecting-with': 'fallthrough',\n" + BaseStr;
+  auto FallbackStr = "{ 'redirecting-with': 'fallback',\n" + BaseStr;
+  auto RedirectOnlyStr = "{ 'redirecting-with': 'redirect-only',\n" + BaseStr;
+
+  auto ExpectPath = [&](vfs::FileSystem &FS, StringRef Expected,
+StringRef Message) {
+auto AF = FS.openFileForRead("//root/a/f");
+ASSERT_FALSE(AF.getError()) << Message;
+auto AFName = (*AF)->getName();
+ASSERT_FALSE(AFName.getError()) << Message;
+EXPECT_EQ(Expected.str(), AFName.get()) << Message;
+
+auto AS = FS.status("//root/a/f");
+ASSERT_FALSE(AS.getError()) << Message;
+EXPECT_EQ(Expected.str(), AS->getName()) << Message;
+  };
+
+  auto ExpectFailure = [&](vfs::FileSystem &FS, StringRef Message) {
+EXPECT_TRUE(FS.openFileForRead("//root/a/f").getError()) << Message;
+EXPECT_TRUE(FS.status("//root/a/f").getError()) << Message;
+  };
+
+  {
+// `f` in both `a` and `b`
+
+// `fallthrough` tries `external-name` first, so should be `b`
+IntrusiveRefCntPtr Fallthrough =
+getFromYAMLString(FallthroughStr, Both);
+ASSERT_TRUE(Fallthrough.get() != nullptr);
+ExpectPath(*Fallthrough, "//root/b/f", "fallthrough, both exist");
+
+// `fallback` tries the original name first, so should be `a`
+IntrusiveRefCntPtr Fallback =
+getFromYAMLString(FallbackStr, Both);
+ASSERT_TRUE(Fallback.get() != nullptr);
+ExpectPath(*Fallback, "//root/a/f", "fallback, both exist");
+
+// `redirect-only` is the same as `fallthrough` but doesn't try the
+// original on failure, so no change here (ie. `b`)
+IntrusiveRefCntPtr Redirect =
+getFromYAMLString(RedirectOnlyStr, Both);
+ASSERT_TRUE(Redirect.get() != nullptr);
+ExpectPath(*Redirect, "//root/b/f", "redirect-only, both exist");
+  }
+
+  {
+// `f` in `a` only
+
+// Fallthrough to the original path, `a`
+IntrusiveRefCntPtr Fallthrough =
+getFromYAMLString(

[PATCH] D119788: [AArch64] Add support for -march=native for Apple M1 CPU

2022-02-14 Thread Keith Smiley via Phabricator via cfe-commits
keith created this revision.
Herald added subscribers: dexonsmith, pengfei, hiraditya, kristof.beyls.
keith requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

This improves the getHostCPUName check for Apple M1 
 CPUs, which
previously would always be considered cyclone instead. This also enables
`-march=native` support when building on M1  CPUs 
which would previously
fail. This isn't as sophisticated as the X86 CPU feature checking which
consults the CPU via getHostCPUFeatures, but this is still better than
before. This CPU selection could also be invalid if this was run on an
iOS device instead, ideally we can improve those cases as they come up.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119788

Files:
  clang/lib/Driver/ToolChains/Arch/AArch64.cpp
  llvm/lib/Support/Host.cpp


Index: llvm/lib/Support/Host.cpp
===
--- llvm/lib/Support/Host.cpp
+++ llvm/lib/Support/Host.cpp
@@ -1299,11 +1299,7 @@
   bool HaveVectorSupport = CVT[244] & 0x80;
   return getCPUNameFromS390Model(Id, HaveVectorSupport);
 }
-#elif defined(__APPLE__) && defined(__aarch64__)
-StringRef sys::getHostCPUName() {
-  return "cyclone";
-}
-#elif defined(__APPLE__) && defined(__arm__)
+#elif defined(__APPLE__) && (defined(__arm__) || defined(__aarch64__))
 StringRef sys::getHostCPUName() {
   host_basic_info_data_t hostInfo;
   mach_msg_type_number_t infoCount;
@@ -1314,15 +1310,23 @@
 &infoCount);
   mach_port_deallocate(mach_task_self(), hostPort);
 
-  if (hostInfo.cpu_type != CPU_TYPE_ARM) {
-assert(false && "CPUType not equal to ARM should not be possible on ARM");
-return "generic";
-  }
-  switch (hostInfo.cpu_subtype) {
+  if (hostInfo.cpu_type == CPU_TYPE_ARM) {
+switch (hostInfo.cpu_subtype) {
 case CPU_SUBTYPE_ARM_V7S:
   return "swift";
-default:;
+default:
+  break;
 }
+  } else if (hostInfo.cpu_type == CPU_TYPE_ARM64) {
+switch (hostInfo.cpu_subtype) {
+case CPU_SUBTYPE_ARM64E:
+  return "apple-m1";
+default:
+  return "cyclone";
+}
+  } else {
+assert(false && "CPUType not equal to ARM/ARM64 should not be possible");
+  }
 
   return "generic";
 }
Index: clang/lib/Driver/ToolChains/Arch/AArch64.cpp
===
--- clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -151,6 +151,8 @@
   std::pair Split = StringRef(MarchLowerCase).split("+");
 
   llvm::AArch64::ArchKind ArchKind = llvm::AArch64::parseArch(Split.first);
+  if (Split.first == "native")
+ArchKind = 
llvm::AArch64::getCPUArchKind(llvm::sys::getHostCPUName().str());
   if (ArchKind == llvm::AArch64::ArchKind::INVALID ||
   !llvm::AArch64::getArchFeatures(ArchKind, Features))
 return false;


Index: llvm/lib/Support/Host.cpp
===
--- llvm/lib/Support/Host.cpp
+++ llvm/lib/Support/Host.cpp
@@ -1299,11 +1299,7 @@
   bool HaveVectorSupport = CVT[244] & 0x80;
   return getCPUNameFromS390Model(Id, HaveVectorSupport);
 }
-#elif defined(__APPLE__) && defined(__aarch64__)
-StringRef sys::getHostCPUName() {
-  return "cyclone";
-}
-#elif defined(__APPLE__) && defined(__arm__)
+#elif defined(__APPLE__) && (defined(__arm__) || defined(__aarch64__))
 StringRef sys::getHostCPUName() {
   host_basic_info_data_t hostInfo;
   mach_msg_type_number_t infoCount;
@@ -1314,15 +1310,23 @@
 &infoCount);
   mach_port_deallocate(mach_task_self(), hostPort);
 
-  if (hostInfo.cpu_type != CPU_TYPE_ARM) {
-assert(false && "CPUType not equal to ARM should not be possible on ARM");
-return "generic";
-  }
-  switch (hostInfo.cpu_subtype) {
+  if (hostInfo.cpu_type == CPU_TYPE_ARM) {
+switch (hostInfo.cpu_subtype) {
 case CPU_SUBTYPE_ARM_V7S:
   return "swift";
-default:;
+default:
+  break;
 }
+  } else if (hostInfo.cpu_type == CPU_TYPE_ARM64) {
+switch (hostInfo.cpu_subtype) {
+case CPU_SUBTYPE_ARM64E:
+  return "apple-m1";
+default:
+  return "cyclone";
+}
+  } else {
+assert(false && "CPUType not equal to ARM/ARM64 should not be possible");
+  }
 
   return "generic";
 }
Index: clang/lib/Driver/ToolChains/Arch/AArch64.cpp
===
--- clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -151,6 +151,8 @@
   std::pair Split = StringRef(MarchLowerCase).split("+");
 
   llvm::AArch64::ArchKind ArchKind = llvm::AArch64::parseArch(Split.first);
+  if (Split.first == "native")
+ArchKind = llvm::AArch64::getCPUArchKind(llvm::sys::getHostCPUName().str());
   if (ArchKind == llvm::AArch64::ArchKind::INVALID ||
   !llvm::AArch64::getArchFeatures(ArchKin

[PATCH] D119788: [AArch64] Add support for -march=native for Apple M1 CPU

2022-02-14 Thread Keith Smiley via Phabricator via cfe-commits
keith added reviewers: beanz, efriedma.
keith added a comment.

Adding folks from https://reviews.llvm.org/D69597


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119788

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


[PATCH] D124767: [Clang] Map .gcda paths according to -fcoverage-prefix-map

2022-05-02 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

Based on the issue it sounds like this should be gated behind a new 
`-fprofile-prefix-map` flag? I assume we'd also want `-ffile-prefix-map` to 
apply to it as well, similar to the others. And we'll definitely want some 
tests here!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124767

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


[PATCH] D124767: [Clang] Map .gcda paths according to -fcoverage-prefix-map

2022-05-02 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

I took this comment from the issue:

> Since the feature you're proposing is specific to gcov, using a separate flag 
> that matches the name used by GCC would be preferable to me.

To mean that we should introduce a new flag matching gcc's name. I think in 
general fewer flags would be preferred though, so I think it depends on if it 
would ever make sense to have separate values for these in the same build?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124767

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


[PATCH] D83154: clang: Add -fcoverage-prefix-map

2020-09-12 Thread Keith Smiley via Phabricator via cfe-commits
keith added inline comments.



Comment at: clang/lib/CodeGen/CoverageMappingGen.cpp:1334
+  llvm::SmallString<256> Path(Filename);
+  llvm::sys::fs::make_absolute(Path);
+  llvm::sys::path::remove_dots(Path, /*remove_dot_dot=*/true);

rnk wrote:
> keith wrote:
> > rnk wrote:
> > > Please only make the path absolute if nothing in the prefix map matches. 
> > > Otherwise, the user must embed the CWD into the prefix map, which is 
> > > needlessly difficult for the build system. I believe it is also 
> > > consistent with the way that the debug info prefix map works. It appears 
> > > to operate on the possibly relative source paths received on the command 
> > > line (-I...).
> > Are you suggesting that I try to remap them relatively, and if that fails, 
> > absolutize it and attempt the remapping again? Or don't absolutize them at 
> > all anymore?
> I'd prefer to do the remapping once without any absolutization, and if that 
> fails, preserve the behavior of absolutizing.
> 
> It would be my preference to not absolutize paths at all, since that is what 
> is done for debug info. However, @vsk implemented things this way, and I do 
> understand that this is convenient default behavior for most users: the paths 
> in the coverage are valid anywhere on their system. So, changing this 
> behavior is out of scope for this patch.
I'm not sure how this changed would work for our use case. With bazel the usage 
of this works something like:

1. Relative paths are passed to the compiler `clang ... foo.c`
2. We would normally do `-fprofile-prefix-map=$PWD=.` to remap them

I think if we made this change, we would either have to:

1. Make the paths we pass absolute, which we couldn't do for reproducibility
2. Add some known prefix to the paths, like `.`, so we could 
`-fprofile-prefix-map=.=.` just to avoid this absolutizing codepath

So I think without actually removing the absolutizing behavior at the same 
time, this wouldn't work as we'd hope.

Let me know if I'm mis-understanding your suggestion!

If we did what I said above, I think it would work since relative path 
remapping would fail, but then prefix mapping the absolute path would work.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83154

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


[PATCH] D83154: clang: Add -fcoverage-prefix-map

2020-09-15 Thread Keith Smiley via Phabricator via cfe-commits
keith added inline comments.



Comment at: clang/lib/CodeGen/CoverageMappingGen.cpp:1334
+  llvm::SmallString<256> Path(Filename);
+  llvm::sys::fs::make_absolute(Path);
+  llvm::sys::path::remove_dots(Path, /*remove_dot_dot=*/true);

phosek wrote:
> andrewjcg wrote:
> > keith wrote:
> > > rnk wrote:
> > > > keith wrote:
> > > > > rnk wrote:
> > > > > > Please only make the path absolute if nothing in the prefix map 
> > > > > > matches. Otherwise, the user must embed the CWD into the prefix 
> > > > > > map, which is needlessly difficult for the build system. I believe 
> > > > > > it is also consistent with the way that the debug info prefix map 
> > > > > > works. It appears to operate on the possibly relative source paths 
> > > > > > received on the command line (-I...).
> > > > > Are you suggesting that I try to remap them relatively, and if that 
> > > > > fails, absolutize it and attempt the remapping again? Or don't 
> > > > > absolutize them at all anymore?
> > > > I'd prefer to do the remapping once without any absolutization, and if 
> > > > that fails, preserve the behavior of absolutizing.
> > > > 
> > > > It would be my preference to not absolutize paths at all, since that is 
> > > > what is done for debug info. However, @vsk implemented things this way, 
> > > > and I do understand that this is convenient default behavior for most 
> > > > users: the paths in the coverage are valid anywhere on their system. 
> > > > So, changing this behavior is out of scope for this patch.
> > > I'm not sure how this changed would work for our use case. With bazel the 
> > > usage of this works something like:
> > > 
> > > 1. Relative paths are passed to the compiler `clang ... foo.c`
> > > 2. We would normally do `-fprofile-prefix-map=$PWD=.` to remap them
> > > 
> > > I think if we made this change, we would either have to:
> > > 
> > > 1. Make the paths we pass absolute, which we couldn't do for 
> > > reproducibility
> > > 2. Add some known prefix to the paths, like `.`, so we could 
> > > `-fprofile-prefix-map=.=.` just to avoid this absolutizing codepath
> > > 
> > > So I think without actually removing the absolutizing behavior at the 
> > > same time, this wouldn't work as we'd hope.
> > > 
> > > Let me know if I'm mis-understanding your suggestion!
> > > 
> > > If we did what I said above, I think it would work since relative path 
> > > remapping would fail, but then prefix mapping the absolute path would 
> > > work.
> > FWIW, there's a similar issue with doing the absolutizing for the Buck 
> > build tool, which by default sets `-fdebug-compilation-dir=.` for all 
> > compilations, then expects to use `-fdebug-prefix-map` (or 
> > `-ffile-prefix-map`) to fixup relative paths of sandboxed header symlink 
> > trees to point to their *real* paths (e.g. something like `clang -c 
> > -fdebug-compilation-dir=. -Iheader-tree-sandbox 
> > -ffile-prefix-map=header-tree-sandbox=original_dir`) (e.g. 
> > https://github.com/facebook/buck/blob/master/src/com/facebook/buck/cxx/toolchain/PrefixMapDebugPathSanitizer.java#L134).
> > 
> > So, in this case, *not* absolutizing would help here, but it kind of feels 
> > that the real issue is that there's not an equivalent 
> > `-fprofile-compilation-dir` to opt-out of the absolutizing of profile paths 
> > (which is orthogonal to this change)...
> FWIW this is something we've already discussed on the list and I started 
> prototyping that feature, I'm hoping to upload the change for review in the 
> next few days.
It's probably worth going back to the mailing list for some of these 
discussions. I think everyone was happy with the idea of one of the 
`-*compilation-dir` flags, but we decided to only add this flag for now 
https://lists.llvm.org/pipermail/cfe-dev/2020-June/066014.html

Also bazel "gets around" excluding PWD from command lines by hiding it in 
nested flags 
https://github.com/bazelbuild/bazel/blob/e3c8eb48dc05a666c68ae18e996f5d37cac5a607/tools/osx/crosstool/wrapped_clang.cc#L219-L221
 which is why this case was good enough for me as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83154

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


[PATCH] D87928: Provide -fsource-dir flag in Clang

2020-09-21 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

In D87928#2282609 , @phosek wrote:

> This change is trying to address the issues raised in D83154 
> . There are still some open questions:
>
> - Is `-fsource-dir` the best name for this flag?

I think this name works as long as its recommended usage doesn't end up 
including directories outside of the source root.

> - I'm not sure if `make_relative` should be applied to all source paths, or 
> only paths that start with `SourceDir` which would exclude system paths 
> outside of the source directory (e.g. it's probably undesirable to relativize 
> paths to `/usr/include`)?

This is one place where I think the `*-prefix-map` flags have a UX advantage. 
For example in the Apple toolchain, there are places where the Xcode paths are 
embedded in this data, and you may want to exclude them by doing 
`-f*-prefix-map=/path/to/Xcode.app=STANDARD_XCODE_PATH` and remapping that 
later as needed to increase reproducibility

> - If we decide to exclude source paths outside of the source directory, 
> should we support `-fsource-dir` to be specified more then once to handle 
> multiple source directories?

I think this would be a bit confusing usage wise, so I would say it should act 
like `-fdebug-compilation-dir` where only 1 can be passed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87928

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


[PATCH] D83154: clang: Add -fcoverage-prefix-map

2020-09-21 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

With D87928  do you think we would want this 
flag as well? The only difference I can think of (besides general UX) is if you 
need to remap paths outside of your source root, I believe having a 
`*-prefix-map` style flag makes that a bit more clear (or potentially possible 
at all). Ideally there wouldn't be issues around that but in the past in the 
Apple toolchain the Xcode path was embedded in debug info (as an example), so 
to get a reproducible build we had to pass 
`-fdebug-prefix-map=/path/to/Xcode.app=SOMETHING`. Which 
`-fdebug-compilation-dir .` couldn't solve. I'm wondering if we should add both 
flags for this flexibility, or if we should assume this should not happen?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83154

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


[PATCH] D83154: clang: Add -fcoverage-prefix-map

2020-09-22 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

Should we wait for that one to land and then pick this one up? Otherwise any 
thoughts on the outstanding discussion?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83154

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


[PATCH] D83154: clang: Add -fcoverage-prefix-map

2020-08-18 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

Yes I do, sorry I've been a bit busy, I will try to get to this later this week


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83154

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


[PATCH] D83154: clang: Add -fcoverage-prefix-map

2020-09-08 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 290610.
keith retitled this revision from "clang: Add -fprofile-prefix-map" to "clang: 
Add -fcoverage-prefix-map".
keith edited the summary of this revision.
keith added a comment.

Rename from fcoverage-prefix-map to fprofile-prefix-map


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83154

Files:
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CoverageMappingGen.cpp
  clang/lib/CodeGen/CoverageMappingGen.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/Driver/debug-prefix-map.c
  clang/test/Profile/profile-prefix-map.c

Index: clang/test/Profile/profile-prefix-map.c
===
--- /dev/null
+++ clang/test/Profile/profile-prefix-map.c
@@ -0,0 +1,14 @@
+// %s expands to an absolute path, so to test relative paths we need to create a
+// clean directory, put the source there, and cd into it.
+// RUN: rm -rf %t
+// RUN: mkdir -p %t/root/nested
+// RUN: echo "void f1() {}" > %t/root/nested/profile-prefix-map.c
+// RUN: cd %t/root
+
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -mllvm -enable-name-compression=false -main-file-name profile-prefix-map.c nested/profile-prefix-map.c -o - | FileCheck --check-prefix=ABSOLUTE %s
+//
+// ABSOLUTE: @__llvm_coverage_mapping = {{.*"\\01.*root.*nested.*profile-prefix-map\.c}}
+
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -mllvm -enable-name-compression=false -main-file-name profile-prefix-map.c nested/profile-prefix-map.c -fprofile-prefix-map=%/t/root=. -o - | FileCheck --check-prefix=PROFILE-PREFIX-MAP %s --implicit-check-not=root
+//
+// PROFILE-PREFIX-MAP: @__llvm_coverage_mapping = {{.*"\\01[^/]*}}.{{/|\\+}}nested{{.*profile-prefix-map\.c}}
Index: clang/test/Driver/debug-prefix-map.c
===
--- clang/test/Driver/debug-prefix-map.c
+++ clang/test/Driver/debug-prefix-map.c
@@ -1,28 +1,39 @@
 // RUN: %clang -### -fdebug-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-INVALID
 // RUN: %clang -### -fmacro-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-INVALID
+// RUN: %clang -### -fprofile-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-PROFILE-INVALID
 // RUN: %clang -### -ffile-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-FILE-INVALID
 
 // RUN: %clang -### -fdebug-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-SIMPLE
 // RUN: %clang -### -fmacro-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-SIMPLE
+// RUN: %clang -### -fprofile-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-PROFILE-SIMPLE
 // RUN: %clang -### -ffile-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-SIMPLE
 // RUN: %clang -### -ffile-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-SIMPLE
+// RUN: %clang -### -ffile-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-PROFILE-SIMPLE
 
 // RUN: %clang -### -fdebug-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-COMPLEX
 // RUN: %clang -### -fmacro-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-COMPLEX
+// RUN: %clang -### -fprofile-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-PROFILE-COMPLEX
 // RUN: %clang -### -ffile-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-COMPLEX
 // RUN: %clang -### -ffile-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-COMPLEX
+// RUN: %clang -### -ffile-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-PROFILE-COMPLEX
 
 // RUN: %clang -### -fdebug-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-EMPTY
 // RUN: %clang -### -fmacro-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-EMPTY
+// RUN: %clang -### -fprofile-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-PROFILE-EMPTY
 // RUN: %clang -### -ffile-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-EMPTY
 // RUN: %clang -### -ffile-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-EMPTY
+// RUN: %clang -### -ffile-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-PROFILE-EMPTY
 
 // CHECK-DEBUG-INVALID: error: invalid argument 'old' to -fdebug-prefix-map
 // CHECK-MACRO-INVALID: error: invalid argument 'old' to -fmacro-prefix-map
+// CHECK-PROFILE-INVALID: error: invalid argument 'old' to -fprofile-prefix-map
 // CHECK-FILE-INVALID: error: invalid argument 'old' to -ffile-prefix-map
 // CHECK-DEBUG-SIMPLE: fdebug-prefix-map=old=new
 // CHECK-MACRO-SIMPLE: fmacro-prefix-map=old=new
+// CHECK-PROFILE-SIMPLE: fprofile-prefix-map=old=new
 // CHECK-DEBUG-COMPLEX: fdebug-prefix-map=old=n=ew
 // CHECK-MACRO-COMPLEX: fmacro-

[PATCH] D83154: clang: Add -fcoverage-prefix-map

2020-09-09 Thread Keith Smiley via Phabricator via cfe-commits
keith added inline comments.



Comment at: clang/lib/CodeGen/CoverageMappingGen.cpp:1334
+  llvm::SmallString<256> Path(Filename);
+  llvm::sys::fs::make_absolute(Path);
+  llvm::sys::path::remove_dots(Path, /*remove_dot_dot=*/true);

rnk wrote:
> Please only make the path absolute if nothing in the prefix map matches. 
> Otherwise, the user must embed the CWD into the prefix map, which is 
> needlessly difficult for the build system. I believe it is also consistent 
> with the way that the debug info prefix map works. It appears to operate on 
> the possibly relative source paths received on the command line (-I...).
Are you suggesting that I try to remap them relatively, and if that fails, 
absolutize it and attempt the remapping again? Or don't absolutize them at all 
anymore?



Comment at: clang/test/Profile/profile-prefix-map.c:12
+
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm 
-mllvm -enable-name-compression=false -main-file-name profile-prefix-map.c 
nested/profile-prefix-map.c -fprofile-prefix-map=%/t/root=. -o - | FileCheck 
--check-prefix=PROFILE-PREFIX-MAP %s --implicit-check-not=root
+//

rnk wrote:
> See here, for example, where you must pass `-fprofile-prefix-map=%/t/...`.
+1. I do think I still want this test case, but likely another pending the 
discussion above that validates the relative path behavior.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83154

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


[PATCH] D83154: clang: Add -fcoverage-prefix-map

2020-09-09 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 290851.
keith marked 2 inline comments as done.
keith added a comment.

Small fixes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83154

Files:
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CoverageMappingGen.cpp
  clang/lib/CodeGen/CoverageMappingGen.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/Driver/debug-prefix-map.c
  clang/test/Profile/profile-prefix-map.c

Index: clang/test/Profile/profile-prefix-map.c
===
--- /dev/null
+++ clang/test/Profile/profile-prefix-map.c
@@ -0,0 +1,14 @@
+// %s expands to an absolute path, so to test relative paths we need to create a
+// clean directory, put the source there, and cd into it.
+// RUN: rm -rf %t
+// RUN: mkdir -p %t/root/nested
+// RUN: echo "void f1() {}" > %t/root/nested/profile-prefix-map.c
+// RUN: cd %t/root
+
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -mllvm -enable-name-compression=false -main-file-name profile-prefix-map.c nested/profile-prefix-map.c -o - | FileCheck --check-prefix=ABSOLUTE %s
+//
+// ABSOLUTE: @__llvm_coverage_mapping = {{.*"\\01.*root.*nested.*profile-prefix-map\.c}}
+
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -mllvm -enable-name-compression=false -main-file-name profile-prefix-map.c nested/profile-prefix-map.c -fprofile-prefix-map=%/t/root=. -o - | FileCheck --check-prefix=PROFILE-PREFIX-MAP %s --implicit-check-not=root
+//
+// PROFILE-PREFIX-MAP: @__llvm_coverage_mapping = {{.*"\\01[^/]*}}.{{/|\\+}}nested{{.*profile-prefix-map\.c}}
Index: clang/test/Driver/debug-prefix-map.c
===
--- clang/test/Driver/debug-prefix-map.c
+++ clang/test/Driver/debug-prefix-map.c
@@ -1,28 +1,39 @@
 // RUN: %clang -### -fdebug-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-INVALID
 // RUN: %clang -### -fmacro-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-INVALID
+// RUN: %clang -### -fprofile-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-PROFILE-INVALID
 // RUN: %clang -### -ffile-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-FILE-INVALID
 
 // RUN: %clang -### -fdebug-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-SIMPLE
 // RUN: %clang -### -fmacro-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-SIMPLE
+// RUN: %clang -### -fprofile-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-PROFILE-SIMPLE
 // RUN: %clang -### -ffile-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-SIMPLE
 // RUN: %clang -### -ffile-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-SIMPLE
+// RUN: %clang -### -ffile-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-PROFILE-SIMPLE
 
 // RUN: %clang -### -fdebug-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-COMPLEX
 // RUN: %clang -### -fmacro-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-COMPLEX
+// RUN: %clang -### -fprofile-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-PROFILE-COMPLEX
 // RUN: %clang -### -ffile-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-COMPLEX
 // RUN: %clang -### -ffile-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-COMPLEX
+// RUN: %clang -### -ffile-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-PROFILE-COMPLEX
 
 // RUN: %clang -### -fdebug-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-EMPTY
 // RUN: %clang -### -fmacro-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-EMPTY
+// RUN: %clang -### -fprofile-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-PROFILE-EMPTY
 // RUN: %clang -### -ffile-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-EMPTY
 // RUN: %clang -### -ffile-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-EMPTY
+// RUN: %clang -### -ffile-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-PROFILE-EMPTY
 
 // CHECK-DEBUG-INVALID: error: invalid argument 'old' to -fdebug-prefix-map
 // CHECK-MACRO-INVALID: error: invalid argument 'old' to -fmacro-prefix-map
+// CHECK-PROFILE-INVALID: error: invalid argument 'old' to -fprofile-prefix-map
 // CHECK-FILE-INVALID: error: invalid argument 'old' to -ffile-prefix-map
 // CHECK-DEBUG-SIMPLE: fdebug-prefix-map=old=new
 // CHECK-MACRO-SIMPLE: fmacro-prefix-map=old=new
+// CHECK-PROFILE-SIMPLE: fprofile-prefix-map=old=new
 // CHECK-DEBUG-COMPLEX: fdebug-prefix-map=old=n=ew
 // CHECK-MACRO-COMPLEX: fmacro-prefix-map=old=n=ew
+// CHECK-PROFILE-COMPLEX: fprofile-prefix-map=old=n=ew
 // CHECK-DEBUG-EMPTY: fdebug-prefix-map=old=
 // CHECK-MACRO-EMPTY: fmacro-pre

[PATCH] D17922: [clang-format] Don't add a space before Obj-C selector methods that are also clang-format keywords

2020-11-16 Thread Keith Smiley via Phabricator via cfe-commits
keith commandeered this revision.
keith added a reviewer: ksuther.
keith added a comment.

Note the test case shown here passes on master, so we can drop this


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

https://reviews.llvm.org/D17922

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


[PATCH] D91669: Don’t break before nested block param when prior param is not a block

2020-11-20 Thread Keith Smiley via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG244022a3cd75: Don’t break before nested block param when 
prior param is not a block (authored by segiddins, committed by keith).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91669

Files:
  clang/lib/Format/ContinuationIndenter.cpp
  clang/unittests/Format/FormatTestObjC.cpp


Index: clang/unittests/Format/FormatTestObjC.cpp
===
--- clang/unittests/Format/FormatTestObjC.cpp
+++ clang/unittests/Format/FormatTestObjC.cpp
@@ -18,6 +18,7 @@
 #define DEBUG_TYPE "format-test"
 
 using clang::tooling::ReplacementTest;
+using testing::internal::ScopedTrace;
 
 namespace clang {
 namespace format {
@@ -51,18 +52,24 @@
 return *Result;
   }
 
-  void verifyFormat(StringRef Code) {
+  void _verifyFormat(const char *File, int Line, StringRef Code) {
+ScopedTrace t(File, Line, ::testing::Message() << Code.str());
 EXPECT_EQ(Code.str(), format(Code)) << "Expected code is not stable";
 EXPECT_EQ(Code.str(), format(test::messUp(Code)));
   }
 
-  void verifyIncompleteFormat(StringRef Code) {
+  void _verifyIncompleteFormat(const char *File, int Line, StringRef Code) {
+ScopedTrace t(File, Line, ::testing::Message() << Code.str());
 EXPECT_EQ(Code.str(), format(test::messUp(Code), SC_ExpectIncomplete));
   }
 
   FormatStyle Style;
 };
 
+#define verifyIncompleteFormat(...)
\
+  _verifyIncompleteFormat(__FILE__, __LINE__, __VA_ARGS__)
+#define verifyFormat(...) _verifyFormat(__FILE__, __LINE__, __VA_ARGS__)
+
 TEST(FormatTestObjCStyle, DetectsObjCInHeaders) {
   auto Style = getStyle("LLVM", "a.h", "none",
 "@interface\n"
@@ -1453,6 +1460,39 @@
   "   callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {\n"
   " u = v;\n"
   "   }]");
+
+  verifyFormat("[self block:^(void) {\n"
+   "  doStuff();\n"
+   "} completionHandler:^(void) {\n"
+   "  doStuff();\n"
+   "  [self block:^(void) {\n"
+   "doStuff();\n"
+   "  } completionHandler:^(void) {\n"
+   "doStuff();\n"
+   "  }];\n"
+   "}];");
+
+  Style.ColumnLimit = 0;
+  verifyFormat("[[SessionService sharedService] "
+   "loadWindowWithCompletionBlock:^(SessionWindow *window) {\n"
+   "  if (window) {\n"
+   "[self windowDidLoad:window];\n"
+   "  } else {\n"
+   "[self errorLoadingWindow];\n"
+   "  }\n"
+   "}];");
+  verifyFormat("[controller test:^{\n"
+   "  doStuff();\n"
+   "} withTimeout:5 completionHandler:^{\n"
+   "  doStuff();\n"
+   "}];");
+  verifyFormat(
+  "[self setupTextFieldSignals:@[\n"
+  "  self.documentWidthField,\n"
+  "  self.documentHeightField,\n"
+  "] solver:^(NSTextField *textField) {\n"
+  "  return [self.representedObject 
solveEquationForTextField:textField];\n"
+  "}];");
 }
 
 TEST_F(FormatTestObjC, IfNotUnlikely) {
Index: clang/lib/Format/ContinuationIndenter.cpp
===
--- clang/lib/Format/ContinuationIndenter.cpp
+++ clang/lib/Format/ContinuationIndenter.cpp
@@ -400,7 +400,9 @@
 return true;
   if (Current.is(TT_SelectorName) && !Previous.is(tok::at) &&
   State.Stack.back().ObjCSelectorNameFound &&
-  State.Stack.back().BreakBeforeParameter)
+  State.Stack.back().BreakBeforeParameter &&
+  (Style.ObjCBreakBeforeNestedBlockParam ||
+   !Current.startsSequence(TT_SelectorName, tok::colon, tok::caret)))
 return true;
 
   unsigned NewLineColumn = getNewLineColumn(State);


Index: clang/unittests/Format/FormatTestObjC.cpp
===
--- clang/unittests/Format/FormatTestObjC.cpp
+++ clang/unittests/Format/FormatTestObjC.cpp
@@ -18,6 +18,7 @@
 #define DEBUG_TYPE "format-test"
 
 using clang::tooling::ReplacementTest;
+using testing::internal::ScopedTrace;
 
 namespace clang {
 namespace format {
@@ -51,18 +52,24 @@
 return *Result;
   }
 
-  void verifyFormat(StringRef Code) {
+  void _verifyFormat(const char *File, int Line, StringRef Code) {
+ScopedTrace t(File, Line, ::testing::Message() << Code.str());
 EXPECT_EQ(Code.str(), format(Code)) << "Expected code is not stable";
 EXPECT_EQ(Code.str(), format(test::messUp(Code)));
   }
 
-  void verifyIncompleteFormat(StringRef Code) {
+  void _verifyIncompleteFormat(const char *File, int Line, StringRef Code) {
+ScopedTrace t(File, Line, ::testing::Message() << Code.str());
 EXPECT_EQ(Code.str(), format(test::messUp(Code),

[PATCH] D92357: clang/darwin: Don't use response files with ld64, do use them with ld64.lld.darwinnew

2020-11-30 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

Note in your repro case the issue is that the response file doesn't end in a 
trailing newline


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

https://reviews.llvm.org/D92357

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


[PATCH] D92357: clang/darwin: Don't use response files with ld64, do use them with ld64.lld.darwinnew

2020-11-30 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

It looks like at least in the `-Wl` case clang passes the file through 
directly, so I'm not surprises that it repros there:

  % clang -Wl,@shell_dialogs_unittests.rsp -v
  Apple clang version 12.0.0 (clang-1200.0.32.27)
  Target: x86_64-apple-darwin19.6.0
  Thread model: posix
  InstalledDir: 
/Applications/Xcode-12.2.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
   
"/Applications/Xcode-12.2.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld"
 -demangle -lto_library 
/Applications/Xcode-12.2.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib
 -dynamic -arch x86_64 -platform_version macos 10.15.0 10.15.6 -syslibroot 
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -o a.out -L/usr/local/lib 
@shell_dialogs_unittests.rsp -lSystem 
/Applications/Xcode-12.2.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.osx.a
  clang: error: unable to execute command: Segmentation fault: 11
  clang: error: linker command failed due to signal (use -v to see invocation)

I _don't_ actually see this reproing when using `clang 
@shell_dialogs_unittests.rsp`:

  % /Users/ksmiley/dev/llvm-project/build/bin/clang-12 
@shell_dialogs_unittests.rsp
  clang version 12.0.0 (https://github.com/llvm/llvm-project 
bbf02e18f53681c079f7a88b2726d0714d92e1a0)
  Target: x86_64-apple-darwin19.6.0
  Thread model: posix
  InstalledDir: /Users/ksmiley/dev/llvm-project/build/bin
   "/usr/bin/ld" 
@/var/folders/h6/6btvg47n7y1f5xxz4_n9rsd4gn/T/response-5a15ec.txt

Which I believe makes sense because clang is processing each argument and 
writing the response file itself.

Is there any other case you've hit besides the missing trailing newline that 
causes this issue? While I'm sure Apple will fix that in due time I wonder if 
that's considered a "valid enough" response to warrant the revert here.


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

https://reviews.llvm.org/D92357

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


[PATCH] D92357: clang/darwin: Don't use response files with ld64

2020-12-01 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

I'm a bit worried that without a repro case (outside of the missing newline) 
Apple won't get around to fixing this, and in the meantime I'm wondering if 
outside of the chromium build system folks will experience this. I wonder if 
there's an acceptable alternative here such as adding a (ideally temporary) 
flag to force the old behavior?


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

https://reviews.llvm.org/D92357

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


[PATCH] D90430: [clang][NFC] Remove unused FileCheck prefix

2020-10-29 Thread Keith Smiley via Phabricator via cfe-commits
keith created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
keith requested review of this revision.

This is to enable --allow-unused-duplicates=false. This prefix appears
to be outdated and intentionally unused.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90430

Files:
  clang/test/Driver/debug-options.c


Index: clang/test/Driver/debug-options.c
===
--- clang/test/Driver/debug-options.c
+++ clang/test/Driver/debug-options.c
@@ -115,7 +115,7 @@
 // PS4 defaults to sce; -ggdb0 changes tuning but turns off debug info,
 // then -g turns it back on without affecting tuning.
 // RUN: %clang -### -c -ggdb0 -g -target x86_64-scei-ps4 %s 2>&1 \
-// RUN: | FileCheck -check-prefix=G -check-prefix=G_GDB %s
+// RUN: | FileCheck -check-prefix=G_GDB %s
 //
 // RUN: %clang -### -c -g1 %s 2>&1 \
 // RUN: | FileCheck -check-prefix=GLTO_ONLY %s


Index: clang/test/Driver/debug-options.c
===
--- clang/test/Driver/debug-options.c
+++ clang/test/Driver/debug-options.c
@@ -115,7 +115,7 @@
 // PS4 defaults to sce; -ggdb0 changes tuning but turns off debug info,
 // then -g turns it back on without affecting tuning.
 // RUN: %clang -### -c -ggdb0 -g -target x86_64-scei-ps4 %s 2>&1 \
-// RUN: | FileCheck -check-prefix=G -check-prefix=G_GDB %s
+// RUN: | FileCheck -check-prefix=G_GDB %s
 //
 // RUN: %clang -### -c -g1 %s 2>&1 \
 // RUN: | FileCheck -check-prefix=GLTO_ONLY %s
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D90430: [clang][NFC] Remove unused FileCheck prefix

2020-10-30 Thread Keith Smiley via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbbf02e18f536: [clang][NFC] Remove unused FileCheck prefix 
(authored by keith).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90430

Files:
  clang/test/Driver/debug-options.c


Index: clang/test/Driver/debug-options.c
===
--- clang/test/Driver/debug-options.c
+++ clang/test/Driver/debug-options.c
@@ -115,7 +115,7 @@
 // PS4 defaults to sce; -ggdb0 changes tuning but turns off debug info,
 // then -g turns it back on without affecting tuning.
 // RUN: %clang -### -c -ggdb0 -g -target x86_64-scei-ps4 %s 2>&1 \
-// RUN: | FileCheck -check-prefix=G -check-prefix=G_GDB %s
+// RUN: | FileCheck -check-prefix=G_GDB %s
 //
 // RUN: %clang -### -c -g1 %s 2>&1 \
 // RUN: | FileCheck -check-prefix=GLTO_ONLY %s


Index: clang/test/Driver/debug-options.c
===
--- clang/test/Driver/debug-options.c
+++ clang/test/Driver/debug-options.c
@@ -115,7 +115,7 @@
 // PS4 defaults to sce; -ggdb0 changes tuning but turns off debug info,
 // then -g turns it back on without affecting tuning.
 // RUN: %clang -### -c -ggdb0 -g -target x86_64-scei-ps4 %s 2>&1 \
-// RUN: | FileCheck -check-prefix=G -check-prefix=G_GDB %s
+// RUN: | FileCheck -check-prefix=G_GDB %s
 //
 // RUN: %clang -### -c -g1 %s 2>&1 \
 // RUN: | FileCheck -check-prefix=GLTO_ONLY %s
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D90646: [clang] Add warning when `-include-pch` is passed multiple times

2020-11-02 Thread Keith Smiley via Phabricator via cfe-commits
keith created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
keith requested review of this revision.

Previously this argument passed multiple times would result in the first
being silently ignored.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90646

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/PCH/multiple-include-pch-warning.c


Index: clang/test/PCH/multiple-include-pch-warning.c
===
--- /dev/null
+++ clang/test/PCH/multiple-include-pch-warning.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -emit-pch -o %t1.pch %s
+// RUN: %clang_cc1 -emit-pch -o %t2.pch %s
+// RUN: %clang_cc1 %s -include-pch %t1.pch -include-pch %t2.pch 2>&1 | 
FileCheck %s
+
+// CHECK: warning: -include-pch passed multiple times but only the last 
'{{.*\.pch}}' is being used
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -3576,7 +3576,13 @@
 static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
   DiagnosticsEngine &Diags,
   frontend::ActionKind Action) {
-  Opts.ImplicitPCHInclude = std::string(Args.getLastArgValue(OPT_include_pch));
+  auto allPchFiles = Args.getAllArgValues(OPT_include_pch);
+  if (!allPchFiles.empty()) {
+Opts.ImplicitPCHInclude = std::string(allPchFiles.back());
+if (allPchFiles.size() > 1)
+  Diags.Report(diag::warn_drv_multiple_include_pch)
+  << Opts.ImplicitPCHInclude;
+  }
   Opts.PCHWithHdrStop = Args.hasArg(OPT_pch_through_hdrstop_create) ||
 Args.hasArg(OPT_pch_through_hdrstop_use);
   Opts.PCHWithHdrStopCreate = Args.hasArg(OPT_pch_through_hdrstop_create);
Index: clang/include/clang/Basic/DiagnosticDriverKinds.td
===
--- clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -329,6 +329,8 @@
   InGroup;
 def warn_drv_pch_not_first_include : Warning<
   "precompiled header '%0' was ignored because '%1' is not first '-include'">;
+def warn_drv_multiple_include_pch : Warning<
+  "-include-pch passed multiple times but only the last '%0' is being used">;
 def warn_missing_sysroot : Warning<"no such sysroot directory: '%0'">,
   InGroup>;
 def warn_incompatible_sysroot : Warning<"using sysroot for '%0' but targeting 
'%1'">,


Index: clang/test/PCH/multiple-include-pch-warning.c
===
--- /dev/null
+++ clang/test/PCH/multiple-include-pch-warning.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -emit-pch -o %t1.pch %s
+// RUN: %clang_cc1 -emit-pch -o %t2.pch %s
+// RUN: %clang_cc1 %s -include-pch %t1.pch -include-pch %t2.pch 2>&1 | FileCheck %s
+
+// CHECK: warning: -include-pch passed multiple times but only the last '{{.*\.pch}}' is being used
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -3576,7 +3576,13 @@
 static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
   DiagnosticsEngine &Diags,
   frontend::ActionKind Action) {
-  Opts.ImplicitPCHInclude = std::string(Args.getLastArgValue(OPT_include_pch));
+  auto allPchFiles = Args.getAllArgValues(OPT_include_pch);
+  if (!allPchFiles.empty()) {
+Opts.ImplicitPCHInclude = std::string(allPchFiles.back());
+if (allPchFiles.size() > 1)
+  Diags.Report(diag::warn_drv_multiple_include_pch)
+  << Opts.ImplicitPCHInclude;
+  }
   Opts.PCHWithHdrStop = Args.hasArg(OPT_pch_through_hdrstop_create) ||
 Args.hasArg(OPT_pch_through_hdrstop_use);
   Opts.PCHWithHdrStopCreate = Args.hasArg(OPT_pch_through_hdrstop_create);
Index: clang/include/clang/Basic/DiagnosticDriverKinds.td
===
--- clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -329,6 +329,8 @@
   InGroup;
 def warn_drv_pch_not_first_include : Warning<
   "precompiled header '%0' was ignored because '%1' is not first '-include'">;
+def warn_drv_multiple_include_pch : Warning<
+  "-include-pch passed multiple times but only the last '%0' is being used">;
 def warn_missing_sysroot : Warning<"no such sysroot directory: '%0'">,
   InGroup>;
 def warn_incompatible_sysroot : Warning<"using sysroot for '%0' but targeting '%1'">,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listin

[PATCH] D83154: clang: Add -fprofile-prefix-map

2021-01-25 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 319045.
keith added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83154

Files:
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CoverageMappingGen.cpp
  clang/lib/CodeGen/CoverageMappingGen.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/Driver/debug-prefix-map.c
  clang/test/Profile/profile-prefix-map.c

Index: clang/test/Profile/profile-prefix-map.c
===
--- /dev/null
+++ clang/test/Profile/profile-prefix-map.c
@@ -0,0 +1,14 @@
+// %s expands to an absolute path, so to test relative paths we need to create a
+// clean directory, put the source there, and cd into it.
+// RUN: rm -rf %t
+// RUN: mkdir -p %t/root/nested
+// RUN: echo "void f1() {}" > %t/root/nested/profile-prefix-map.c
+// RUN: cd %t/root
+
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -mllvm -enable-name-compression=false -main-file-name profile-prefix-map.c nested/profile-prefix-map.c -o - | FileCheck --check-prefix=ABSOLUTE %s
+//
+// ABSOLUTE: @__llvm_coverage_mapping = {{.*"\\01.*root.*nested.*profile-prefix-map\.c}}
+
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -mllvm -enable-name-compression=false -main-file-name profile-prefix-map.c nested/profile-prefix-map.c -fprofile-prefix-map=%/t/root=. -o - | FileCheck --check-prefix=PROFILE-PREFIX-MAP %s --implicit-check-not=root
+//
+// PROFILE-PREFIX-MAP: @__llvm_coverage_mapping = {{.*"\\01[^/]*}}.{{/|\\+}}nested{{.*profile-prefix-map\.c}}
Index: clang/test/Driver/debug-prefix-map.c
===
--- clang/test/Driver/debug-prefix-map.c
+++ clang/test/Driver/debug-prefix-map.c
@@ -1,28 +1,39 @@
 // RUN: %clang -### -fdebug-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-INVALID
 // RUN: %clang -### -fmacro-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-INVALID
+// RUN: %clang -### -fprofile-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-PROFILE-INVALID
 // RUN: %clang -### -ffile-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-FILE-INVALID
 
 // RUN: %clang -### -fdebug-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-SIMPLE
 // RUN: %clang -### -fmacro-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-SIMPLE
+// RUN: %clang -### -fprofile-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-PROFILE-SIMPLE
 // RUN: %clang -### -ffile-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-SIMPLE
 // RUN: %clang -### -ffile-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-SIMPLE
+// RUN: %clang -### -ffile-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-PROFILE-SIMPLE
 
 // RUN: %clang -### -fdebug-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-COMPLEX
 // RUN: %clang -### -fmacro-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-COMPLEX
+// RUN: %clang -### -fprofile-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-PROFILE-COMPLEX
 // RUN: %clang -### -ffile-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-COMPLEX
 // RUN: %clang -### -ffile-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-COMPLEX
+// RUN: %clang -### -ffile-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-PROFILE-COMPLEX
 
 // RUN: %clang -### -fdebug-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-EMPTY
 // RUN: %clang -### -fmacro-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-EMPTY
+// RUN: %clang -### -fprofile-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-PROFILE-EMPTY
 // RUN: %clang -### -ffile-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-EMPTY
 // RUN: %clang -### -ffile-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-EMPTY
+// RUN: %clang -### -ffile-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-PROFILE-EMPTY
 
 // CHECK-DEBUG-INVALID: error: invalid argument 'old' to -fdebug-prefix-map
 // CHECK-MACRO-INVALID: error: invalid argument 'old' to -fmacro-prefix-map
+// CHECK-PROFILE-INVALID: error: invalid argument 'old' to -fprofile-prefix-map
 // CHECK-FILE-INVALID: error: invalid argument 'old' to -ffile-prefix-map
 // CHECK-DEBUG-SIMPLE: fdebug-prefix-map=old=new
 // CHECK-MACRO-SIMPLE: fmacro-prefix-map=old=new
+// CHECK-PROFILE-SIMPLE: fprofile-prefix-map=old=new
 // CHECK-DEBUG-COMPLEX: fdebug-prefix-map=old=n=ew
 // CHECK-MACRO-COMPLEX: fmacro-prefix-map=old=n=ew
+// CHECK-PROFILE-COMPLEX: fprofile-prefix-map=old=n=ew
 // CHECK-DEBUG-EMPTY: fdebug-prefix-map=old=
 // CHECK-MACRO-EMPTY: fmacro-prefix-map=old=
+// CHECK-PROFILE-EMPTY: fprofil

[PATCH] D83154: [clang] Add -fprofile-prefix-map

2021-01-25 Thread Keith Smiley via Phabricator via cfe-commits
keith closed this revision.
keith added a comment.

Something went wrong with this being attached to the commit (I believe because 
I committed from a different machine than I originally wrote this on), landed 
here 
https://github.com/llvm/llvm-project/commit/c3324450b204392169d4ec7172cb32f74c03e376
 thanks for the review!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83154

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


[PATCH] D95385: Revert "[clangd][NFC] Simplify handing on methods with no params"

2021-01-25 Thread Keith Smiley via Phabricator via cfe-commits
keith created this revision.
keith added a reviewer: njames93.
Herald added subscribers: usaxena95, kadircet, arphaman.
keith requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang.

This broke the build http://lab.llvm.org:8011/#/builders/7/builds/1405

This reverts commit f05b492aae4d4a741ec59f19518df91a3012824c 
.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95385

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/ClangdLSPServer.h
  clang-tools-extra/clangd/Protocol.h

Index: clang-tools-extra/clangd/Protocol.h
===
--- clang-tools-extra/clangd/Protocol.h
+++ clang-tools-extra/clangd/Protocol.h
@@ -265,6 +265,8 @@
   return true;
 }
 using InitializedParams = NoParams;
+using ShutdownParams = NoParams;
+using ExitParams = NoParams;
 
 /// Defines how the host (editor) should sync document changes to the language
 /// server.
Index: clang-tools-extra/clangd/ClangdLSPServer.h
===
--- clang-tools-extra/clangd/ClangdLSPServer.h
+++ clang-tools-extra/clangd/ClangdLSPServer.h
@@ -93,8 +93,8 @@
   // Calls have signature void(const Params&, Callback).
   void onInitialize(const InitializeParams &, Callback);
   void onInitialized(const InitializedParams &);
-  void onShutdown(Callback);
-  void onSync(Callback);
+  void onShutdown(const ShutdownParams &, Callback);
+  void onSync(const NoParams &, Callback);
   void onDocumentDidOpen(const DidOpenTextDocumentParams &);
   void onDocumentDidChange(const DidChangeTextDocumentParams &);
   void onDocumentDidClose(const DidCloseTextDocumentParams &);
@@ -161,7 +161,7 @@
  Callback);
   /// This is a clangd extension. Provides a json tree representing memory usage
   /// hierarchy.
-  void onMemoryUsage(Callback);
+  void onMemoryUsage(const NoParams &, Callback);
 
   std::vector getFixes(StringRef File, const clangd::Diagnostic &D);
 
Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -258,15 +258,6 @@
 };
   }
 
-  template 
-  void bind(const char *Method,
-void (ClangdLSPServer::*Handler)(Callback)) {
-Calls[Method] = [Handler, this](llvm::json::Value RawParams,
-ReplyOnce Reply) {
-  (Server.*Handler)(std::move(Reply));
-};
-  }
-
   // Bind a reply callback to a request. The callback will be invoked when
   // clangd receives the reply from the LSP client.
   // Return a call id of the request.
@@ -310,20 +301,6 @@
 };
   }
 
-  void bind(const char *Method, void (ClangdLSPServer::*Handler)()) {
-Notifications[Method] = [Handler, this](llvm::json::Value RawParams) {
-  (Server.*Handler)();
-};
-  }
-
-  template <>
-  void bind(const char *Method,
-  void (ClangdLSPServer::*Handler)(const NoParams &)) {
-Notifications[Method] = [Handler, this](llvm::json::Value RawParams) {
-  (Server.*Handler)(NoParams{});
-};
-  }
-
 private:
   // Function object to reply to an LSP call.
   // Each instance must be called exactly once, otherwise:
@@ -670,7 +647,8 @@
 
 void ClangdLSPServer::onInitialized(const InitializedParams &Params) {}
 
-void ClangdLSPServer::onShutdown(Callback Reply) {
+void ClangdLSPServer::onShutdown(const ShutdownParams &Params,
+ Callback Reply) {
   // Do essentially nothing, just say we're ready to exit.
   ShutdownRequestReceived = true;
   Reply(nullptr);
@@ -678,7 +656,8 @@
 
 // sync is a clangd extension: it blocks until all background work completes.
 // It blocks the calling thread, so no messages are processed until it returns!
-void ClangdLSPServer::onSync(Callback Reply) {
+void ClangdLSPServer::onSync(const NoParams &Params,
+ Callback Reply) {
   if (Server->blockUntilIdleForTest(/*TimeoutSeconds=*/60))
 Reply(nullptr);
   else
@@ -1466,7 +1445,8 @@
   });
 }
 
-void ClangdLSPServer::onMemoryUsage(Callback Reply) {
+void ClangdLSPServer::onMemoryUsage(const NoParams &,
+Callback Reply) {
   llvm::BumpPtrAllocator DetailAlloc;
   MemoryTree MT(&DetailAlloc);
   profile(MT);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D95385: Revert "[clangd][NFC] Simplify handing on methods with no params"

2021-01-25 Thread Keith Smiley via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9d9ceb37453f: Revert "[clangd][NFC] Simplify handing on 
methods with no params" (authored by keith).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95385

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/ClangdLSPServer.h
  clang-tools-extra/clangd/Protocol.h

Index: clang-tools-extra/clangd/Protocol.h
===
--- clang-tools-extra/clangd/Protocol.h
+++ clang-tools-extra/clangd/Protocol.h
@@ -265,6 +265,8 @@
   return true;
 }
 using InitializedParams = NoParams;
+using ShutdownParams = NoParams;
+using ExitParams = NoParams;
 
 /// Defines how the host (editor) should sync document changes to the language
 /// server.
Index: clang-tools-extra/clangd/ClangdLSPServer.h
===
--- clang-tools-extra/clangd/ClangdLSPServer.h
+++ clang-tools-extra/clangd/ClangdLSPServer.h
@@ -93,8 +93,8 @@
   // Calls have signature void(const Params&, Callback).
   void onInitialize(const InitializeParams &, Callback);
   void onInitialized(const InitializedParams &);
-  void onShutdown(Callback);
-  void onSync(Callback);
+  void onShutdown(const ShutdownParams &, Callback);
+  void onSync(const NoParams &, Callback);
   void onDocumentDidOpen(const DidOpenTextDocumentParams &);
   void onDocumentDidChange(const DidChangeTextDocumentParams &);
   void onDocumentDidClose(const DidCloseTextDocumentParams &);
@@ -161,7 +161,7 @@
  Callback);
   /// This is a clangd extension. Provides a json tree representing memory usage
   /// hierarchy.
-  void onMemoryUsage(Callback);
+  void onMemoryUsage(const NoParams &, Callback);
 
   std::vector getFixes(StringRef File, const clangd::Diagnostic &D);
 
Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -258,15 +258,6 @@
 };
   }
 
-  template 
-  void bind(const char *Method,
-void (ClangdLSPServer::*Handler)(Callback)) {
-Calls[Method] = [Handler, this](llvm::json::Value RawParams,
-ReplyOnce Reply) {
-  (Server.*Handler)(std::move(Reply));
-};
-  }
-
   // Bind a reply callback to a request. The callback will be invoked when
   // clangd receives the reply from the LSP client.
   // Return a call id of the request.
@@ -310,20 +301,6 @@
 };
   }
 
-  void bind(const char *Method, void (ClangdLSPServer::*Handler)()) {
-Notifications[Method] = [Handler, this](llvm::json::Value RawParams) {
-  (Server.*Handler)();
-};
-  }
-
-  template <>
-  void bind(const char *Method,
-  void (ClangdLSPServer::*Handler)(const NoParams &)) {
-Notifications[Method] = [Handler, this](llvm::json::Value RawParams) {
-  (Server.*Handler)(NoParams{});
-};
-  }
-
 private:
   // Function object to reply to an LSP call.
   // Each instance must be called exactly once, otherwise:
@@ -670,7 +647,8 @@
 
 void ClangdLSPServer::onInitialized(const InitializedParams &Params) {}
 
-void ClangdLSPServer::onShutdown(Callback Reply) {
+void ClangdLSPServer::onShutdown(const ShutdownParams &Params,
+ Callback Reply) {
   // Do essentially nothing, just say we're ready to exit.
   ShutdownRequestReceived = true;
   Reply(nullptr);
@@ -678,7 +656,8 @@
 
 // sync is a clangd extension: it blocks until all background work completes.
 // It blocks the calling thread, so no messages are processed until it returns!
-void ClangdLSPServer::onSync(Callback Reply) {
+void ClangdLSPServer::onSync(const NoParams &Params,
+ Callback Reply) {
   if (Server->blockUntilIdleForTest(/*TimeoutSeconds=*/60))
 Reply(nullptr);
   else
@@ -1466,7 +1445,8 @@
   });
 }
 
-void ClangdLSPServer::onMemoryUsage(Callback Reply) {
+void ClangdLSPServer::onMemoryUsage(const NoParams &,
+Callback Reply) {
   llvm::BumpPtrAllocator DetailAlloc;
   MemoryTree MT(&DetailAlloc);
   profile(MT);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D95385: Revert "[clangd][NFC] Simplify handing on methods with no params"

2021-01-25 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

No problem, thanks!!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95385

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


[PATCH] D90646: [clang] Add warning when `-include-pch` is passed multiple times

2021-01-25 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 319138.
keith added a comment.
Herald added a reviewer: jansvoboda11.

Add group to warning


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90646

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/PCH/multiple-include-pch-warning.c


Index: clang/test/PCH/multiple-include-pch-warning.c
===
--- /dev/null
+++ clang/test/PCH/multiple-include-pch-warning.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -emit-pch -o %t1.pch %s
+// RUN: %clang_cc1 -emit-pch -o %t2.pch %s
+// RUN: %clang_cc1 %s -include-pch %t1.pch -include-pch %t2.pch 2>&1 | 
FileCheck %s
+
+// CHECK: warning: -include-pch passed multiple times but only the last 
'{{.*\.pch}}' is being used
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -2779,6 +2779,14 @@
 static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
   DiagnosticsEngine &Diags,
   frontend::ActionKind Action) {
+  auto allPchFiles = Args.getAllArgValues(OPT_include_pch);
+  if (!allPchFiles.empty()) {
+Opts.ImplicitPCHInclude = std::string(allPchFiles.back());
+if (allPchFiles.size() > 1)
+  Diags.Report(diag::warn_drv_multiple_include_pch)
+  << Opts.ImplicitPCHInclude;
+  }
+
   Opts.PCHWithHdrStop = Args.hasArg(OPT_pch_through_hdrstop_create) ||
 Args.hasArg(OPT_pch_through_hdrstop_use);
 
Index: clang/include/clang/Basic/DiagnosticDriverKinds.td
===
--- clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -332,6 +332,9 @@
   InGroup;
 def warn_drv_pch_not_first_include : Warning<
   "precompiled header '%0' was ignored because '%1' is not first '-include'">;
+def warn_drv_multiple_include_pch : Warning<
+  "-include-pch passed multiple times but only the last '%0' is being used">,
+   InGroup;
 def warn_missing_sysroot : Warning<"no such sysroot directory: '%0'">,
   InGroup>;
 def warn_incompatible_sysroot : Warning<"using sysroot for '%0' but targeting 
'%1'">,


Index: clang/test/PCH/multiple-include-pch-warning.c
===
--- /dev/null
+++ clang/test/PCH/multiple-include-pch-warning.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -emit-pch -o %t1.pch %s
+// RUN: %clang_cc1 -emit-pch -o %t2.pch %s
+// RUN: %clang_cc1 %s -include-pch %t1.pch -include-pch %t2.pch 2>&1 | FileCheck %s
+
+// CHECK: warning: -include-pch passed multiple times but only the last '{{.*\.pch}}' is being used
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -2779,6 +2779,14 @@
 static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
   DiagnosticsEngine &Diags,
   frontend::ActionKind Action) {
+  auto allPchFiles = Args.getAllArgValues(OPT_include_pch);
+  if (!allPchFiles.empty()) {
+Opts.ImplicitPCHInclude = std::string(allPchFiles.back());
+if (allPchFiles.size() > 1)
+  Diags.Report(diag::warn_drv_multiple_include_pch)
+  << Opts.ImplicitPCHInclude;
+  }
+
   Opts.PCHWithHdrStop = Args.hasArg(OPT_pch_through_hdrstop_create) ||
 Args.hasArg(OPT_pch_through_hdrstop_use);
 
Index: clang/include/clang/Basic/DiagnosticDriverKinds.td
===
--- clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -332,6 +332,9 @@
   InGroup;
 def warn_drv_pch_not_first_include : Warning<
   "precompiled header '%0' was ignored because '%1' is not first '-include'">;
+def warn_drv_multiple_include_pch : Warning<
+  "-include-pch passed multiple times but only the last '%0' is being used">,
+   InGroup;
 def warn_missing_sysroot : Warning<"no such sysroot directory: '%0'">,
   InGroup>;
 def warn_incompatible_sysroot : Warning<"using sysroot for '%0' but targeting '%1'">,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D90646: [clang] Add warning when `-include-pch` is passed multiple times

2021-01-25 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

Fair question! I think this case is a bit different since it's quite subtle. 
The strange thing here is that the header you're intending to provide a pch for 
can still be read successfully, but not getting the benefits of the pch that 
you were expecting without knowing about it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90646

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


[PATCH] D109461: [clang][darwin] Add support for --emit-static-lib

2021-09-17 Thread Keith Smiley via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG80d62993d072: [clang][darwin] Add support for 
--emit-static-lib (authored by keith).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109461

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/Darwin.cpp
  clang/lib/Driver/ToolChains/Darwin.h
  clang/test/Driver/bindings.c
  clang/test/Driver/darwin-static-lib.c

Index: clang/test/Driver/darwin-static-lib.c
===
--- /dev/null
+++ clang/test/Driver/darwin-static-lib.c
@@ -0,0 +1,5 @@
+// RUN: %clang -target i386-apple-darwin9 %s -### --emit-static-lib 2>&1 | FileCheck %s
+// CHECK: "{{.*}}libtool" "-static" "-D" "-no_warning_for_no_symbols" "-o" "a.out" "{{.*o}}"
+
+// RUN: %clang -target i386-apple-darwin9 %s -### --emit-static-lib -o libfoo.a 2>&1 | FileCheck %s --check-prefix=OUTPUT
+// OUTPUT: "{{.*}}libtool" "-static" "-D" "-no_warning_for_no_symbols" "-o" "libfoo.a" "{{.*o}}"
Index: clang/test/Driver/bindings.c
===
--- clang/test/Driver/bindings.c
+++ clang/test/Driver/bindings.c
@@ -27,3 +27,7 @@
 // GNU StaticLibTool binding
 // RUN: %clang -target x86_64-linux-gnu -ccc-print-bindings --emit-static-lib %s 2>&1 | FileCheck %s --check-prefix=CHECK15
 // CHECK15: "x86_64-unknown-linux-gnu" - "GNU::StaticLibTool", inputs: ["{{.*}}.o"], output: "a.out"
+
+// Darwin StaticLibTool binding
+// RUN: %clang -target i386-apple-darwin9 -ccc-print-bindings --emit-static-lib %s 2>&1 | FileCheck %s --check-prefix=CHECK16
+// CHECK16: "i386-apple-darwin9" - "darwin::StaticLibTool", inputs: ["{{.*}}.o"], output: "a.out"
Index: clang/lib/Driver/ToolChains/Darwin.h
===
--- clang/lib/Driver/ToolChains/Darwin.h
+++ clang/lib/Driver/ToolChains/Darwin.h
@@ -78,6 +78,20 @@
 const char *LinkingOutput) const override;
 };
 
+class LLVM_LIBRARY_VISIBILITY StaticLibTool : public MachOTool {
+public:
+  StaticLibTool(const ToolChain &TC)
+  : MachOTool("darwin::StaticLibTool", "static-lib-linker", TC) {}
+
+  bool hasIntegratedCPP() const override { return false; }
+  bool isLinkJob() const override { return true; }
+
+  void ConstructJob(Compilation &C, const JobAction &JA,
+const InputInfo &Output, const InputInfoList &Inputs,
+const llvm::opt::ArgList &TCArgs,
+const char *LinkingOutput) const override;
+};
+
 class LLVM_LIBRARY_VISIBILITY Lipo : public MachOTool {
 public:
   Lipo(const ToolChain &TC) : MachOTool("darwin::Lipo", "lipo", TC) {}
@@ -125,6 +139,7 @@
 protected:
   Tool *buildAssembler() const override;
   Tool *buildLinker() const override;
+  Tool *buildStaticLibTool() const override;
   Tool *getTool(Action::ActionClass AC) const override;
 
 private:
Index: clang/lib/Driver/ToolChains/Darwin.cpp
===
--- clang/lib/Driver/ToolChains/Darwin.cpp
+++ clang/lib/Driver/ToolChains/Darwin.cpp
@@ -729,6 +729,54 @@
   C.addCommand(std::move(Cmd));
 }
 
+void darwin::StaticLibTool::ConstructJob(Compilation &C, const JobAction &JA,
+ const InputInfo &Output,
+ const InputInfoList &Inputs,
+ const ArgList &Args,
+ const char *LinkingOutput) const {
+  const Driver &D = getToolChain().getDriver();
+
+  // Silence warning for "clang -g foo.o -o foo"
+  Args.ClaimAllArgs(options::OPT_g_Group);
+  // and "clang -emit-llvm foo.o -o foo"
+  Args.ClaimAllArgs(options::OPT_emit_llvm);
+  // and for "clang -w foo.o -o foo". Other warning options are already
+  // handled somewhere else.
+  Args.ClaimAllArgs(options::OPT_w);
+  // Silence warnings when linking C code with a C++ '-stdlib' argument.
+  Args.ClaimAllArgs(options::OPT_stdlib_EQ);
+
+  // libtool   
+  ArgStringList CmdArgs;
+  // Create and insert file members with a deterministic index.
+  CmdArgs.push_back("-static");
+  CmdArgs.push_back("-D");
+  CmdArgs.push_back("-no_warning_for_no_symbols");
+  CmdArgs.push_back("-o");
+  CmdArgs.push_back(Output.getFilename());
+
+  for (const auto &II : Inputs) {
+if (II.isFilename()) {
+  CmdArgs.push_back(II.getFilename());
+}
+  }
+
+  // Delete old output archive file if it already exists before generating a new
+  // archive file.
+  const auto *OutputFileName = Output.getFilename();
+  if (Output.isFilename() && llvm::sys::fs::exists(OutputFileName)) {
+if (std::error_code EC = llvm::sys::fs::remove(OutputFileName)) {
+  D.Diag(diag::err_drv_unable_to_remove_file) << EC.message();
+  return;
+}
+  }
+
+  const char *Exec = Args.MakeArgString(getToolChain().Get

[PATCH] D90646: [clang] Add warning when `-include-pch` is passed multiple times

2021-02-09 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

Yea seems like a reasonable request, looking through the uses nothing 
immediately pops out as being not supporting multiple PCHs but I guess before I 
went down that path I'd want someone who knew the code better to agree on that


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90646

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


[PATCH] D103934: clang/darwin: use response files with ld64

2021-06-08 Thread Keith Smiley via Phabricator via cfe-commits
keith created this revision.
keith added a reviewer: thakis.
keith requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This crasher was fixed with Xcode 13.0 beta 1 / ld64 705. This is an
updated revert of https://reviews.llvm.org/D92357


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103934

Files:
  clang/lib/Driver/ToolChains/Darwin.cpp


Index: clang/lib/Driver/ToolChains/Darwin.cpp
===
--- clang/lib/Driver/ToolChains/Darwin.cpp
+++ clang/lib/Driver/ToolChains/Darwin.cpp
@@ -711,10 +711,7 @@
   }
 
   ResponseFileSupport ResponseSupport;
-  if (LinkerIsLLDDarwinNew) {
-// Xcode12's ld64 added support for @response files, but it's crashy:
-// https://openradar.appspot.com/radar?id=4933317065441280
-// FIXME: Pass this for ld64 once it no longer crashes.
+  if (Version[0] >= 705 || LinkerIsLLDDarwinNew) {
 ResponseSupport = ResponseFileSupport::AtFileUTF8();
   } else {
 // For older versions of the linker, use the legacy filelist method 
instead.


Index: clang/lib/Driver/ToolChains/Darwin.cpp
===
--- clang/lib/Driver/ToolChains/Darwin.cpp
+++ clang/lib/Driver/ToolChains/Darwin.cpp
@@ -711,10 +711,7 @@
   }
 
   ResponseFileSupport ResponseSupport;
-  if (LinkerIsLLDDarwinNew) {
-// Xcode12's ld64 added support for @response files, but it's crashy:
-// https://openradar.appspot.com/radar?id=4933317065441280
-// FIXME: Pass this for ld64 once it no longer crashes.
+  if (Version[0] >= 705 || LinkerIsLLDDarwinNew) {
 ResponseSupport = ResponseFileSupport::AtFileUTF8();
   } else {
 // For older versions of the linker, use the legacy filelist method instead.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D103934: clang/darwin: use response files with ld64

2021-06-09 Thread Keith Smiley via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1c7f3395b8ec: clang/darwin: use response files with ld64 
(authored by keith).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103934

Files:
  clang/lib/Driver/ToolChains/Darwin.cpp


Index: clang/lib/Driver/ToolChains/Darwin.cpp
===
--- clang/lib/Driver/ToolChains/Darwin.cpp
+++ clang/lib/Driver/ToolChains/Darwin.cpp
@@ -711,10 +711,7 @@
   }
 
   ResponseFileSupport ResponseSupport;
-  if (LinkerIsLLDDarwinNew) {
-// Xcode12's ld64 added support for @response files, but it's crashy:
-// https://openradar.appspot.com/radar?id=4933317065441280
-// FIXME: Pass this for ld64 once it no longer crashes.
+  if (Version[0] >= 705 || LinkerIsLLDDarwinNew) {
 ResponseSupport = ResponseFileSupport::AtFileUTF8();
   } else {
 // For older versions of the linker, use the legacy filelist method 
instead.


Index: clang/lib/Driver/ToolChains/Darwin.cpp
===
--- clang/lib/Driver/ToolChains/Darwin.cpp
+++ clang/lib/Driver/ToolChains/Darwin.cpp
@@ -711,10 +711,7 @@
   }
 
   ResponseFileSupport ResponseSupport;
-  if (LinkerIsLLDDarwinNew) {
-// Xcode12's ld64 added support for @response files, but it's crashy:
-// https://openradar.appspot.com/radar?id=4933317065441280
-// FIXME: Pass this for ld64 once it no longer crashes.
+  if (Version[0] >= 705 || LinkerIsLLDDarwinNew) {
 ResponseSupport = ResponseFileSupport::AtFileUTF8();
   } else {
 // For older versions of the linker, use the legacy filelist method instead.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101037: [clang-tidy] Change shebang from python to python3

2021-07-09 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

Doesn't seem like anything changed on the mailing list side, should we land 
this now?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101037

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


[PATCH] D112767: [clang][driver] Fix multiarch output name with -Wl arg

2021-10-28 Thread Keith Smiley via Phabricator via cfe-commits
keith created this revision.
keith added reviewers: ddunbar, JDevlieghere.
keith requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Previously if you passed a `-Wl,-foo` _before_ the source filename, the
first `InputInfos`, which is used for the base input name would be an
`InputArg` kind, which would never have a base input name. Now we use
that by default, but pick the first `InputInfo` that is of kind
`Filename` to get the name from if there is one.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112767

Files:
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/darwin-dsymutil.c


Index: clang/test/Driver/darwin-dsymutil.c
===
--- clang/test/Driver/darwin-dsymutil.c
+++ clang/test/Driver/darwin-dsymutil.c
@@ -51,6 +51,14 @@
 // CHECK-MULTIARCH-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Linker", 
inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.o"], output: 
"{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out"
 // CHECK-MULTIARCH-OUTPUT-NAME: "arm64-apple-darwin10" - "darwin::Linker", 
inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-arm64.o"], output: 
"{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"
 // CHECK-MULTIARCH-OUTPUT-NAME: "arm64-apple-darwin10" - "darwin::Lipo", 
inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out", 
"{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"], output: "a.out"
+//
+// RUN: %clang -target x86_64-apple-darwin10 \
+// RUN:   -Wl,-foo -arch x86_64 -arch arm64 -ccc-print-bindings %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG < %t %s
+//
+// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "x86_64-apple-darwin10" - 
"darwin::Linker", inputs: [(input arg), 
"{{.*}}{{/|\\}}darwin-dsymutil-x86_64.o"], output: 
"{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out"
+// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "arm64-apple-darwin10" - 
"darwin::Linker", inputs: [(input arg), 
"{{.*}}{{/|\\}}darwin-dsymutil-arm64.o"], output: 
"{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"
+// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "arm64-apple-darwin10" - 
"darwin::Lipo", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out", 
"{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"], output: "a.out"
 
 // Check that we only use dsymutil when needed.
 //
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -4696,6 +4696,12 @@
 
   // Always use the first input as the base input.
   const char *BaseInput = InputInfos[0].getBaseInput();
+  for (auto &Info : InputInfos) {
+if (Info.isFilename()) {
+  BaseInput = Info.getBaseInput();
+  break;
+}
+  }
 
   // ... except dsymutil actions, which use their actual input as the base
   // input.


Index: clang/test/Driver/darwin-dsymutil.c
===
--- clang/test/Driver/darwin-dsymutil.c
+++ clang/test/Driver/darwin-dsymutil.c
@@ -51,6 +51,14 @@
 // CHECK-MULTIARCH-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Linker", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out"
 // CHECK-MULTIARCH-OUTPUT-NAME: "arm64-apple-darwin10" - "darwin::Linker", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-arm64.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"
 // CHECK-MULTIARCH-OUTPUT-NAME: "arm64-apple-darwin10" - "darwin::Lipo", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out", "{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"], output: "a.out"
+//
+// RUN: %clang -target x86_64-apple-darwin10 \
+// RUN:   -Wl,-foo -arch x86_64 -arch arm64 -ccc-print-bindings %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG < %t %s
+//
+// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "x86_64-apple-darwin10" - "darwin::Linker", inputs: [(input arg), "{{.*}}{{/|\\}}darwin-dsymutil-x86_64.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out"
+// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "arm64-apple-darwin10" - "darwin::Linker", inputs: [(input arg), "{{.*}}{{/|\\}}darwin-dsymutil-arm64.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"
+// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "arm64-apple-darwin10" - "darwin::Lipo", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out", "{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"], output: "a.out"
 
 // Check that we only use dsymutil when needed.
 //
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -4696,6 +4696,12 @@
 
   // Always use the first input as the base input.
   const char *BaseInput = InputInfos[0].getBaseInput();
+  for (auto &Info : InputInfos) {
+if (Info.isFilename()) {
+  BaseInput = Info.getBaseInput();
+  break;
+}
+  }
 
   // ... except dsymutil actions, which use their actual input as the base
   // input.
__

[PATCH] D112767: [clang][driver] Fix multiarch output name with -Wl arg

2021-10-28 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 383213.
keith marked an inline comment as done.
keith added a comment.

Update comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112767

Files:
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/darwin-dsymutil.c


Index: clang/test/Driver/darwin-dsymutil.c
===
--- clang/test/Driver/darwin-dsymutil.c
+++ clang/test/Driver/darwin-dsymutil.c
@@ -51,6 +51,14 @@
 // CHECK-MULTIARCH-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Linker", 
inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.o"], output: 
"{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out"
 // CHECK-MULTIARCH-OUTPUT-NAME: "arm64-apple-darwin10" - "darwin::Linker", 
inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-arm64.o"], output: 
"{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"
 // CHECK-MULTIARCH-OUTPUT-NAME: "arm64-apple-darwin10" - "darwin::Lipo", 
inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out", 
"{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"], output: "a.out"
+//
+// RUN: %clang -target x86_64-apple-darwin10 \
+// RUN:   -Wl,-foo -arch x86_64 -arch arm64 -ccc-print-bindings %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG < %t %s
+//
+// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "x86_64-apple-darwin10" - 
"darwin::Linker", inputs: [(input arg), 
"{{.*}}{{/|\\}}darwin-dsymutil-x86_64.o"], output: 
"{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out"
+// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "arm64-apple-darwin10" - 
"darwin::Linker", inputs: [(input arg), 
"{{.*}}{{/|\\}}darwin-dsymutil-arm64.o"], output: 
"{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"
+// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "arm64-apple-darwin10" - 
"darwin::Lipo", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out", 
"{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"], output: "a.out"
 
 // Check that we only use dsymutil when needed.
 //
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -4694,8 +4694,14 @@
 CachedResults, A->getOffloadingDeviceKind()));
   }
 
-  // Always use the first input as the base input.
+  // Always use the first file input as the base input.
   const char *BaseInput = InputInfos[0].getBaseInput();
+  for (auto &Info : InputInfos) {
+if (Info.isFilename()) {
+  BaseInput = Info.getBaseInput();
+  break;
+}
+  }
 
   // ... except dsymutil actions, which use their actual input as the base
   // input.


Index: clang/test/Driver/darwin-dsymutil.c
===
--- clang/test/Driver/darwin-dsymutil.c
+++ clang/test/Driver/darwin-dsymutil.c
@@ -51,6 +51,14 @@
 // CHECK-MULTIARCH-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Linker", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out"
 // CHECK-MULTIARCH-OUTPUT-NAME: "arm64-apple-darwin10" - "darwin::Linker", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-arm64.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"
 // CHECK-MULTIARCH-OUTPUT-NAME: "arm64-apple-darwin10" - "darwin::Lipo", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out", "{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"], output: "a.out"
+//
+// RUN: %clang -target x86_64-apple-darwin10 \
+// RUN:   -Wl,-foo -arch x86_64 -arch arm64 -ccc-print-bindings %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG < %t %s
+//
+// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "x86_64-apple-darwin10" - "darwin::Linker", inputs: [(input arg), "{{.*}}{{/|\\}}darwin-dsymutil-x86_64.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out"
+// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "arm64-apple-darwin10" - "darwin::Linker", inputs: [(input arg), "{{.*}}{{/|\\}}darwin-dsymutil-arm64.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"
+// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "arm64-apple-darwin10" - "darwin::Lipo", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out", "{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"], output: "a.out"
 
 // Check that we only use dsymutil when needed.
 //
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -4694,8 +4694,14 @@
 CachedResults, A->getOffloadingDeviceKind()));
   }
 
-  // Always use the first input as the base input.
+  // Always use the first file input as the base input.
   const char *BaseInput = InputInfos[0].getBaseInput();
+  for (auto &Info : InputInfos) {
+if (Info.isFilename()) {
+  BaseInput = Info.getBaseInput();
+  break;
+}
+  }
 
   // ... except dsymutil actions, which use their actual input as the base
   // input.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bi

[PATCH] D109128: [VFS] Use original path when falling back to external FS

2021-10-29 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 383406.
keith added a comment.

Remove broken test for now

Turns out this fails on main as well, so I'll punt this to another change


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109128

Files:
  clang/test/VFS/relative-path-errors.c
  llvm/include/llvm/Support/VirtualFileSystem.h
  llvm/lib/Support/VirtualFileSystem.cpp
  llvm/unittests/Support/VirtualFileSystemTest.cpp

Index: llvm/unittests/Support/VirtualFileSystemTest.cpp
===
--- llvm/unittests/Support/VirtualFileSystemTest.cpp
+++ llvm/unittests/Support/VirtualFileSystemTest.cpp
@@ -1627,6 +1627,114 @@
   EXPECT_EQ(0, NumDiagnostics);
 }
 
+TEST_F(VFSFromYAMLTest, ReturnsRequestedPathVFSMiss) {
+  IntrusiveRefCntPtr BaseFS(
+  new vfs::InMemoryFileSystem);
+  BaseFS->addFile("//root/foo/a", 0,
+  MemoryBuffer::getMemBuffer("contents of a"));
+  ASSERT_FALSE(BaseFS->setCurrentWorkingDirectory("//root/foo"));
+  auto RemappedFS = vfs::RedirectingFileSystem::create(
+  {}, /*UseExternalNames=*/false, *BaseFS);
+
+  auto OpenedF = RemappedFS->openFileForRead("a");
+  ASSERT_FALSE(OpenedF.getError());
+  llvm::ErrorOr Name = (*OpenedF)->getName();
+  ASSERT_FALSE(Name.getError());
+  EXPECT_EQ("a", Name.get());
+
+  auto OpenedS = (*OpenedF)->status();
+  ASSERT_FALSE(OpenedS.getError());
+  EXPECT_EQ("a", OpenedS->getName());
+  EXPECT_FALSE(OpenedS->IsVFSMapped);
+
+  auto DirectS = RemappedFS->status("a");
+  ASSERT_FALSE(DirectS.getError());
+  EXPECT_EQ("a", DirectS->getName());
+  EXPECT_FALSE(DirectS->IsVFSMapped);
+
+  EXPECT_EQ(0, NumDiagnostics);
+}
+
+TEST_F(VFSFromYAMLTest, ReturnsExternalPathVFSHit) {
+  IntrusiveRefCntPtr BaseFS(
+  new vfs::InMemoryFileSystem);
+  BaseFS->addFile("//root/foo/realname", 0,
+  MemoryBuffer::getMemBuffer("contents of a"));
+  auto FS =
+  getFromYAMLString("{ 'use-external-names': true,\n"
+"  'roots': [\n"
+"{\n"
+"  'type': 'directory',\n"
+"  'name': '//root/foo',\n"
+"  'contents': [ {\n"
+"  'type': 'file',\n"
+"  'name': 'vfsname',\n"
+"  'external-contents': 'realname'\n"
+"}\n"
+"  ]\n"
+"}]}",
+BaseFS);
+  ASSERT_FALSE(FS->setCurrentWorkingDirectory("//root/foo"));
+
+  auto OpenedF = FS->openFileForRead("vfsname");
+  ASSERT_FALSE(OpenedF.getError());
+  llvm::ErrorOr Name = (*OpenedF)->getName();
+  ASSERT_FALSE(Name.getError());
+  EXPECT_EQ("realname", Name.get());
+
+  auto OpenedS = (*OpenedF)->status();
+  ASSERT_FALSE(OpenedS.getError());
+  EXPECT_EQ("realname", OpenedS->getName());
+  EXPECT_TRUE(OpenedS->IsVFSMapped);
+
+  auto DirectS = FS->status("vfsname");
+  ASSERT_FALSE(DirectS.getError());
+  EXPECT_EQ("realname", DirectS->getName());
+  EXPECT_TRUE(DirectS->IsVFSMapped);
+
+  EXPECT_EQ(0, NumDiagnostics);
+}
+
+TEST_F(VFSFromYAMLTest, ReturnsInternalPathVFSHit) {
+  IntrusiveRefCntPtr BaseFS(
+  new vfs::InMemoryFileSystem);
+  BaseFS->addFile("//root/foo/realname", 0,
+  MemoryBuffer::getMemBuffer("contents of a"));
+  auto FS =
+  getFromYAMLString("{ 'use-external-names': false,\n"
+"  'roots': [\n"
+"{\n"
+"  'type': 'directory',\n"
+"  'name': '//root/foo',\n"
+"  'contents': [ {\n"
+"  'type': 'file',\n"
+"  'name': 'vfsname',\n"
+"  'external-contents': 'realname'\n"
+"}\n"
+"  ]\n"
+"}]}",
+BaseFS);
+  ASSERT_FALSE(FS->setCurrentWorkingDirectory("//root/foo"));
+
+  auto OpenedF = FS->openFileForRead("vfsname");
+  ASSERT_FALSE(OpenedF.getError());
+  llvm::ErrorOr Name = (*OpenedF)->getName();
+  ASSERT_FALSE(Name.getError());
+  EXPECT_EQ("vfsname", Name.get());
+
+  auto OpenedS = (*OpenedF)->status();
+  ASSERT_FALSE(OpenedS.getError());
+  EXPECT_EQ("vfsname", OpenedS->getName());
+  EXPECT_TRUE(OpenedS->IsVFSMapped);
+
+  auto DirectS = FS->status("vfsname");
+  ASSERT_FALSE(DirectS.getError());
+  EXPECT_EQ("vfsname", DirectS->getName());
+  EXPECT_TRUE(DirectS->IsVFSMapped);
+
+  EXPECT_EQ(0, NumDiagnostics);
+}
+
 TEST_F(VFSFromYAMLTest, CaseInsensitive) {
   IntrusiveRefCntPtr Lower(new DummyFileSystem());
   Lower->addRegularFile("//root/foo/bar/a");
Index: llvm/lib/Support/VirtualFileSystem.cp

[PATCH] D109128: [VFS] Use original path when falling back to external FS

2021-10-29 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

@dexonsmith turns out the test I was adding is broken on main today too. If 
it's alright with you I will punt that to another diff to not increase the 
scope of this one.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109128

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


[PATCH] D112767: [clang][driver] Fix multiarch output name with -Wl arg

2021-10-29 Thread Keith Smiley via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbd8a9507ef8c: [clang][driver] Fix multiarch output name with 
-Wl arg (authored by keith).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112767

Files:
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/darwin-dsymutil.c


Index: clang/test/Driver/darwin-dsymutil.c
===
--- clang/test/Driver/darwin-dsymutil.c
+++ clang/test/Driver/darwin-dsymutil.c
@@ -51,6 +51,14 @@
 // CHECK-MULTIARCH-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Linker", 
inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.o"], output: 
"{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out"
 // CHECK-MULTIARCH-OUTPUT-NAME: "arm64-apple-darwin10" - "darwin::Linker", 
inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-arm64.o"], output: 
"{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"
 // CHECK-MULTIARCH-OUTPUT-NAME: "arm64-apple-darwin10" - "darwin::Lipo", 
inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out", 
"{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"], output: "a.out"
+//
+// RUN: %clang -target x86_64-apple-darwin10 \
+// RUN:   -Wl,-foo -arch x86_64 -arch arm64 -ccc-print-bindings %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG < %t %s
+//
+// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "x86_64-apple-darwin10" - 
"darwin::Linker", inputs: [(input arg), 
"{{.*}}{{/|\\}}darwin-dsymutil-x86_64.o"], output: 
"{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out"
+// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "arm64-apple-darwin10" - 
"darwin::Linker", inputs: [(input arg), 
"{{.*}}{{/|\\}}darwin-dsymutil-arm64.o"], output: 
"{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"
+// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "arm64-apple-darwin10" - 
"darwin::Lipo", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out", 
"{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"], output: "a.out"
 
 // Check that we only use dsymutil when needed.
 //
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -4697,8 +4697,14 @@
 CachedResults, A->getOffloadingDeviceKind()));
   }
 
-  // Always use the first input as the base input.
+  // Always use the first file input as the base input.
   const char *BaseInput = InputInfos[0].getBaseInput();
+  for (auto &Info : InputInfos) {
+if (Info.isFilename()) {
+  BaseInput = Info.getBaseInput();
+  break;
+}
+  }
 
   // ... except dsymutil actions, which use their actual input as the base
   // input.


Index: clang/test/Driver/darwin-dsymutil.c
===
--- clang/test/Driver/darwin-dsymutil.c
+++ clang/test/Driver/darwin-dsymutil.c
@@ -51,6 +51,14 @@
 // CHECK-MULTIARCH-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Linker", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out"
 // CHECK-MULTIARCH-OUTPUT-NAME: "arm64-apple-darwin10" - "darwin::Linker", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-arm64.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"
 // CHECK-MULTIARCH-OUTPUT-NAME: "arm64-apple-darwin10" - "darwin::Lipo", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out", "{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"], output: "a.out"
+//
+// RUN: %clang -target x86_64-apple-darwin10 \
+// RUN:   -Wl,-foo -arch x86_64 -arch arm64 -ccc-print-bindings %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG < %t %s
+//
+// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "x86_64-apple-darwin10" - "darwin::Linker", inputs: [(input arg), "{{.*}}{{/|\\}}darwin-dsymutil-x86_64.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out"
+// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "arm64-apple-darwin10" - "darwin::Linker", inputs: [(input arg), "{{.*}}{{/|\\}}darwin-dsymutil-arm64.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"
+// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "arm64-apple-darwin10" - "darwin::Lipo", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out", "{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"], output: "a.out"
 
 // Check that we only use dsymutil when needed.
 //
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -4697,8 +4697,14 @@
 CachedResults, A->getOffloadingDeviceKind()));
   }
 
-  // Always use the first input as the base input.
+  // Always use the first file input as the base input.
   const char *BaseInput = InputInfos[0].getBaseInput();
+  for (auto &Info : InputInfos) {
+if (Info.isFilename()) {
+  BaseInput = Info.getBaseInput();
+  break;
+}
+  }
 
   // ... except dsymutil actions, which use their actual input as the base
   // input.
___
cfe-commits mailing l

[PATCH] D109128: [VFS] Use original path when falling back to external FS

2021-11-05 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

@dexonsmith can you take another look?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109128

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


[PATCH] D109128: [VFS] Use original path when falling back to external FS

2021-11-10 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

@JDevlieghere can you take another pass?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109128

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


[PATCH] D113645: [clangd] Allow Unix config paths on Darwin

2021-11-10 Thread Keith Smiley via Phabricator via cfe-commits
keith created this revision.
Herald added subscribers: dexonsmith, usaxena95, kadircet, arphaman, hiraditya.
keith requested review of this revision.
Herald added subscribers: cfe-commits, llvm-commits, MaskRay, ilya-biryukov.
Herald added projects: LLVM, clang-tools-extra.

It's common for CLIs on macOS to read configuration files from more
unix-standard directories with either dotfiles directly in ~ or files in
~/.config. Previously macOS clangd configuration only read from
~/Library/Preferences on macOS, now it respects the other Unix
directories with XDG_CONFIG_HOME or just ~/.config as a fallback. This
is implemented by changing user_config_directory to
user_config_directories which sets a vector of paths to search,
maintaining the previous order of operations.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113645

Files:
  clang-tools-extra/clangd/tool/ClangdMain.cpp
  llvm/include/llvm/Support/Path.h
  llvm/lib/Support/Unix/Path.inc
  llvm/lib/Support/Windows/Path.inc
  llvm/unittests/Support/Path.cpp

Index: llvm/unittests/Support/Path.cpp
===
--- llvm/unittests/Support/Path.cpp
+++ llvm/unittests/Support/Path.cpp
@@ -509,9 +509,10 @@
 TEST(Support, ConfigDirectoryWithEnv) {
   WithEnv Env("XDG_CONFIG_HOME", "/xdg/config");
 
-  SmallString<128> ConfigDir;
-  EXPECT_TRUE(path::user_config_directory(ConfigDir));
-  EXPECT_EQ("/xdg/config", ConfigDir);
+  std::vector ConfigDirs;
+  EXPECT_TRUE(path::user_config_directories(ConfigDirs));
+  std::vector Expected = {"/xdg/config"};
+  EXPECT_EQ(Expected, ConfigDirs);
 }
 
 TEST(Support, ConfigDirectoryNoEnv) {
@@ -521,9 +522,10 @@
   ASSERT_TRUE(path::home_directory(Fallback));
   path::append(Fallback, ".config");
 
-  SmallString<128> CacheDir;
-  EXPECT_TRUE(path::user_config_directory(CacheDir));
-  EXPECT_EQ(Fallback, CacheDir);
+  std::vector ConfigDirs;
+  EXPECT_TRUE(path::user_config_directories(ConfigDirs));
+  std::vector Expected = {std::string(Fallback)};
+  EXPECT_EQ(Expected, ConfigDirs);
 }
 
 TEST(Support, CacheDirectoryWithEnv) {
@@ -549,13 +551,41 @@
 
 #ifdef __APPLE__
 TEST(Support, ConfigDirectory) {
-  SmallString<128> Fallback;
-  ASSERT_TRUE(path::home_directory(Fallback));
-  path::append(Fallback, "Library/Preferences");
+  WithEnv Env("XDG_CONFIG_HOME", nullptr);
 
-  SmallString<128> ConfigDir;
-  EXPECT_TRUE(path::user_config_directory(ConfigDir));
-  EXPECT_EQ(Fallback, ConfigDir);
+  SmallString<128> HomerDir;
+  ASSERT_TRUE(path::home_directory(HomerDir));
+
+  SmallString<128> Preferences = HomerDir;
+  path::append(Preferences, "Library/Preferences");
+
+  SmallString<128> ConfigDir = HomerDir;
+  path::append(ConfigDir, ".config");
+
+  std::vector ConfigDirs;
+  EXPECT_TRUE(path::user_config_directories(ConfigDirs));
+  std::vector Expected = {std::string(Preferences),
+   std::string(ConfigDir)};
+  EXPECT_TRUE(Expected == ConfigDirs);
+}
+
+TEST(Support, XDGConfigDirectory) {
+  WithEnv Env("XDG_CONFIG_HOME", "/xdg/config");
+
+  SmallString<128> HomerDir;
+  ASSERT_TRUE(path::home_directory(HomerDir));
+
+  SmallString<128> Preferences = HomerDir;
+  path::append(Preferences, "Library/Preferences");
+
+  SmallString<128> ConfigDir = HomerDir;
+  path::append(ConfigDir, ".config");
+
+  std::vector ConfigDirs;
+  EXPECT_TRUE(path::user_config_directories(ConfigDirs));
+  std::vector Expected = {std::string(Preferences), "/xdg/config",
+   std::string(ConfigDir)};
+  EXPECT_TRUE(Expected == ConfigDirs);
 }
 #endif
 
Index: llvm/lib/Support/Windows/Path.inc
===
--- llvm/lib/Support/Windows/Path.inc
+++ llvm/lib/Support/Windows/Path.inc
@@ -1434,10 +1434,13 @@
   return getKnownFolderPath(FOLDERID_Profile, result);
 }
 
-bool user_config_directory(SmallVectorImpl &result) {
+bool user_config_directories(std::vector &results) {
   // Either local or roaming appdata may be suitable in some cases, depending
   // on the data. Local is more conservative, Roaming may not always be correct.
-  return getKnownFolderPath(FOLDERID_LocalAppData, result);
+  SmallString result;
+  bool found = getKnownFolderPath(FOLDERID_LocalAppData, &result);
+  results.push_back(result.c_str());
+  return found;
 }
 
 bool cache_directory(SmallVectorImpl &result) {
Index: llvm/lib/Support/Unix/Path.inc
===
--- llvm/lib/Support/Unix/Path.inc
+++ llvm/lib/Support/Unix/Path.inc
@@ -1363,27 +1363,34 @@
   return false;
 }
 
-bool user_config_directory(SmallVectorImpl &result) {
+bool user_config_directories(std::vector &results) {
+  bool found = false;
+  SmallString<128> result;
 #ifdef __APPLE__
   // Mac: ~/Library/Preferences/
   if (home_directory(result)) {
 append(result, "Library", "Preferences");
-return true;
+results.push_back(result.c_str());

[PATCH] D97434: [Driver] Rename -fprofile-{prefix-map,compilation-dir} to -fcoverage-{prefix-map,compilation-dir}

2021-02-25 Thread Keith Smiley via Phabricator via cfe-commits
keith accepted this revision.
keith added a comment.
This revision is now accepted and ready to land.

I personally prefer this, and this is what I landed in swiftc a while back, but 
I changed to -fprofile-prefix-map based on feedback from you 😛 
https://reviews.llvm.org/D83154?id=275480#2146086

But I think the assumption there was it did apply to the other `profile` 
related flags


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97434

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


[PATCH] D97434: [Driver] Rename -fprofile-{prefix-map,compilation-dir} to -fcoverage-{prefix-map,compilation-dir}

2021-02-25 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

No worries! Makes sense, I think this is a good change


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97434

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


[PATCH] D113645: [clangd] Allow Unix config paths on Darwin

2021-11-12 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

In D113645#3126652 , @kadircet wrote:

> I got a couple of concerns about the general ideas in the change. Even though 
> the convenience of using ~/.config/clangd/config.yaml seems nice, I think 
> it'll just end up creating confusion in the long run.
>
> According to various macOS developer documentation & QAs, canonical user 
> config directory for applications are `~/Library/Preferences` (see 
> https://developer.apple.com/library/archive/qa/qa1170/_index.html#//apple_ref/doc/uid/DTS10001702-CH1-SECTION3
>  and various others).

While this makes sense, I think the practical realities today are that 
`~/.config` is always preferred by unix style tools, even when on macOS.

> Regarding XDG_CONFIG_HOME, AFAICT macOS doesn't really implement `XDG Base 
> Directory Specification`, so querying its existence in that platform seems 
> controversial.

Yea I considered still omitting that one, but figured it was fair to simplify 
the compiler conditionals and assume that if someone had that variable set on 
macOS it was intentional. But I think it would be fine to exclude.

> Another concern is around multiple user config files. Clangd's config 
> mechanism actually implements overriding of previous config options, and user 
> config file is the most authoritative one and in the case of multiple such 
> config files it's unclear which one should have precedence. So i don't think 
> we should ever use "multiple" user config files.

Yea this makes sense. Theoretically we could check these "search paths" to 
determine if the configs actually existed to make that more clear, but with 
`--log=verbose` the order of operations is clear where clangd is searching for 
these so I think that shouldn't be a common issue.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113645

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


[PATCH] D109128: [VFS] Use original path when falling back to external FS

2021-11-13 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 387030.
keith added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109128

Files:
  clang/test/VFS/relative-path-errors.c
  llvm/include/llvm/Support/VirtualFileSystem.h
  llvm/lib/Support/VirtualFileSystem.cpp
  llvm/unittests/Support/VirtualFileSystemTest.cpp

Index: llvm/unittests/Support/VirtualFileSystemTest.cpp
===
--- llvm/unittests/Support/VirtualFileSystemTest.cpp
+++ llvm/unittests/Support/VirtualFileSystemTest.cpp
@@ -1627,6 +1627,114 @@
   EXPECT_EQ(0, NumDiagnostics);
 }
 
+TEST_F(VFSFromYAMLTest, ReturnsRequestedPathVFSMiss) {
+  IntrusiveRefCntPtr BaseFS(
+  new vfs::InMemoryFileSystem);
+  BaseFS->addFile("//root/foo/a", 0,
+  MemoryBuffer::getMemBuffer("contents of a"));
+  ASSERT_FALSE(BaseFS->setCurrentWorkingDirectory("//root/foo"));
+  auto RemappedFS = vfs::RedirectingFileSystem::create(
+  {}, /*UseExternalNames=*/false, *BaseFS);
+
+  auto OpenedF = RemappedFS->openFileForRead("a");
+  ASSERT_FALSE(OpenedF.getError());
+  llvm::ErrorOr Name = (*OpenedF)->getName();
+  ASSERT_FALSE(Name.getError());
+  EXPECT_EQ("a", Name.get());
+
+  auto OpenedS = (*OpenedF)->status();
+  ASSERT_FALSE(OpenedS.getError());
+  EXPECT_EQ("a", OpenedS->getName());
+  EXPECT_FALSE(OpenedS->IsVFSMapped);
+
+  auto DirectS = RemappedFS->status("a");
+  ASSERT_FALSE(DirectS.getError());
+  EXPECT_EQ("a", DirectS->getName());
+  EXPECT_FALSE(DirectS->IsVFSMapped);
+
+  EXPECT_EQ(0, NumDiagnostics);
+}
+
+TEST_F(VFSFromYAMLTest, ReturnsExternalPathVFSHit) {
+  IntrusiveRefCntPtr BaseFS(
+  new vfs::InMemoryFileSystem);
+  BaseFS->addFile("//root/foo/realname", 0,
+  MemoryBuffer::getMemBuffer("contents of a"));
+  auto FS =
+  getFromYAMLString("{ 'use-external-names': true,\n"
+"  'roots': [\n"
+"{\n"
+"  'type': 'directory',\n"
+"  'name': '//root/foo',\n"
+"  'contents': [ {\n"
+"  'type': 'file',\n"
+"  'name': 'vfsname',\n"
+"  'external-contents': 'realname'\n"
+"}\n"
+"  ]\n"
+"}]}",
+BaseFS);
+  ASSERT_FALSE(FS->setCurrentWorkingDirectory("//root/foo"));
+
+  auto OpenedF = FS->openFileForRead("vfsname");
+  ASSERT_FALSE(OpenedF.getError());
+  llvm::ErrorOr Name = (*OpenedF)->getName();
+  ASSERT_FALSE(Name.getError());
+  EXPECT_EQ("realname", Name.get());
+
+  auto OpenedS = (*OpenedF)->status();
+  ASSERT_FALSE(OpenedS.getError());
+  EXPECT_EQ("realname", OpenedS->getName());
+  EXPECT_TRUE(OpenedS->IsVFSMapped);
+
+  auto DirectS = FS->status("vfsname");
+  ASSERT_FALSE(DirectS.getError());
+  EXPECT_EQ("realname", DirectS->getName());
+  EXPECT_TRUE(DirectS->IsVFSMapped);
+
+  EXPECT_EQ(0, NumDiagnostics);
+}
+
+TEST_F(VFSFromYAMLTest, ReturnsInternalPathVFSHit) {
+  IntrusiveRefCntPtr BaseFS(
+  new vfs::InMemoryFileSystem);
+  BaseFS->addFile("//root/foo/realname", 0,
+  MemoryBuffer::getMemBuffer("contents of a"));
+  auto FS =
+  getFromYAMLString("{ 'use-external-names': false,\n"
+"  'roots': [\n"
+"{\n"
+"  'type': 'directory',\n"
+"  'name': '//root/foo',\n"
+"  'contents': [ {\n"
+"  'type': 'file',\n"
+"  'name': 'vfsname',\n"
+"  'external-contents': 'realname'\n"
+"}\n"
+"  ]\n"
+"}]}",
+BaseFS);
+  ASSERT_FALSE(FS->setCurrentWorkingDirectory("//root/foo"));
+
+  auto OpenedF = FS->openFileForRead("vfsname");
+  ASSERT_FALSE(OpenedF.getError());
+  llvm::ErrorOr Name = (*OpenedF)->getName();
+  ASSERT_FALSE(Name.getError());
+  EXPECT_EQ("vfsname", Name.get());
+
+  auto OpenedS = (*OpenedF)->status();
+  ASSERT_FALSE(OpenedS.getError());
+  EXPECT_EQ("vfsname", OpenedS->getName());
+  EXPECT_TRUE(OpenedS->IsVFSMapped);
+
+  auto DirectS = FS->status("vfsname");
+  ASSERT_FALSE(DirectS.getError());
+  EXPECT_EQ("vfsname", DirectS->getName());
+  EXPECT_TRUE(DirectS->IsVFSMapped);
+
+  EXPECT_EQ(0, NumDiagnostics);
+}
+
 TEST_F(VFSFromYAMLTest, CaseInsensitive) {
   IntrusiveRefCntPtr Lower(new DummyFileSystem());
   Lower->addRegularFile("//root/foo/bar/a");
Index: llvm/lib/Support/VirtualFileSystem.cpp
===
--- llvm/lib/Support/Virt

[PATCH] D109128: [VFS] Use original path when falling back to external FS

2021-11-13 Thread Keith Smiley via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc972175649f4: [VFS] Use original path when falling back to 
external FS (authored by keith).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109128

Files:
  clang/test/VFS/relative-path-errors.c
  llvm/include/llvm/Support/VirtualFileSystem.h
  llvm/lib/Support/VirtualFileSystem.cpp
  llvm/unittests/Support/VirtualFileSystemTest.cpp

Index: llvm/unittests/Support/VirtualFileSystemTest.cpp
===
--- llvm/unittests/Support/VirtualFileSystemTest.cpp
+++ llvm/unittests/Support/VirtualFileSystemTest.cpp
@@ -1627,6 +1627,114 @@
   EXPECT_EQ(0, NumDiagnostics);
 }
 
+TEST_F(VFSFromYAMLTest, ReturnsRequestedPathVFSMiss) {
+  IntrusiveRefCntPtr BaseFS(
+  new vfs::InMemoryFileSystem);
+  BaseFS->addFile("//root/foo/a", 0,
+  MemoryBuffer::getMemBuffer("contents of a"));
+  ASSERT_FALSE(BaseFS->setCurrentWorkingDirectory("//root/foo"));
+  auto RemappedFS = vfs::RedirectingFileSystem::create(
+  {}, /*UseExternalNames=*/false, *BaseFS);
+
+  auto OpenedF = RemappedFS->openFileForRead("a");
+  ASSERT_FALSE(OpenedF.getError());
+  llvm::ErrorOr Name = (*OpenedF)->getName();
+  ASSERT_FALSE(Name.getError());
+  EXPECT_EQ("a", Name.get());
+
+  auto OpenedS = (*OpenedF)->status();
+  ASSERT_FALSE(OpenedS.getError());
+  EXPECT_EQ("a", OpenedS->getName());
+  EXPECT_FALSE(OpenedS->IsVFSMapped);
+
+  auto DirectS = RemappedFS->status("a");
+  ASSERT_FALSE(DirectS.getError());
+  EXPECT_EQ("a", DirectS->getName());
+  EXPECT_FALSE(DirectS->IsVFSMapped);
+
+  EXPECT_EQ(0, NumDiagnostics);
+}
+
+TEST_F(VFSFromYAMLTest, ReturnsExternalPathVFSHit) {
+  IntrusiveRefCntPtr BaseFS(
+  new vfs::InMemoryFileSystem);
+  BaseFS->addFile("//root/foo/realname", 0,
+  MemoryBuffer::getMemBuffer("contents of a"));
+  auto FS =
+  getFromYAMLString("{ 'use-external-names': true,\n"
+"  'roots': [\n"
+"{\n"
+"  'type': 'directory',\n"
+"  'name': '//root/foo',\n"
+"  'contents': [ {\n"
+"  'type': 'file',\n"
+"  'name': 'vfsname',\n"
+"  'external-contents': 'realname'\n"
+"}\n"
+"  ]\n"
+"}]}",
+BaseFS);
+  ASSERT_FALSE(FS->setCurrentWorkingDirectory("//root/foo"));
+
+  auto OpenedF = FS->openFileForRead("vfsname");
+  ASSERT_FALSE(OpenedF.getError());
+  llvm::ErrorOr Name = (*OpenedF)->getName();
+  ASSERT_FALSE(Name.getError());
+  EXPECT_EQ("realname", Name.get());
+
+  auto OpenedS = (*OpenedF)->status();
+  ASSERT_FALSE(OpenedS.getError());
+  EXPECT_EQ("realname", OpenedS->getName());
+  EXPECT_TRUE(OpenedS->IsVFSMapped);
+
+  auto DirectS = FS->status("vfsname");
+  ASSERT_FALSE(DirectS.getError());
+  EXPECT_EQ("realname", DirectS->getName());
+  EXPECT_TRUE(DirectS->IsVFSMapped);
+
+  EXPECT_EQ(0, NumDiagnostics);
+}
+
+TEST_F(VFSFromYAMLTest, ReturnsInternalPathVFSHit) {
+  IntrusiveRefCntPtr BaseFS(
+  new vfs::InMemoryFileSystem);
+  BaseFS->addFile("//root/foo/realname", 0,
+  MemoryBuffer::getMemBuffer("contents of a"));
+  auto FS =
+  getFromYAMLString("{ 'use-external-names': false,\n"
+"  'roots': [\n"
+"{\n"
+"  'type': 'directory',\n"
+"  'name': '//root/foo',\n"
+"  'contents': [ {\n"
+"  'type': 'file',\n"
+"  'name': 'vfsname',\n"
+"  'external-contents': 'realname'\n"
+"}\n"
+"  ]\n"
+"}]}",
+BaseFS);
+  ASSERT_FALSE(FS->setCurrentWorkingDirectory("//root/foo"));
+
+  auto OpenedF = FS->openFileForRead("vfsname");
+  ASSERT_FALSE(OpenedF.getError());
+  llvm::ErrorOr Name = (*OpenedF)->getName();
+  ASSERT_FALSE(Name.getError());
+  EXPECT_EQ("vfsname", Name.get());
+
+  auto OpenedS = (*OpenedF)->status();
+  ASSERT_FALSE(OpenedS.getError());
+  EXPECT_EQ("vfsname", OpenedS->getName());
+  EXPECT_TRUE(OpenedS->IsVFSMapped);
+
+  auto DirectS = FS->status("vfsname");
+  ASSERT_FALSE(DirectS.getError());
+  EXPECT_EQ("vfsname", DirectS->getName());
+  EXPECT_TRUE(DirectS->IsVFSMapped);
+
+  EXPECT_EQ(0, NumDiagnostics);
+}
+
 TEST_F(VFSFromYAMLTest, CaseInsensitive) {
   IntrusiveRefCntPtr Lower(new DummyFileSystem());
   Lower->addRegula

[PATCH] D113832: reland: [VFS] Use original path when falling back to external FS

2021-11-13 Thread Keith Smiley via Phabricator via cfe-commits
keith created this revision.
keith added a reviewer: dexonsmith.
Herald added subscribers: pengfei, hiraditya.
keith requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

This reverts commit f0cf544d6f6fe6cbca4c07772998272d6bb433d8 
.

Just a small change to fix:

  
/home/buildbot/as-builder-4/llvm-clang-x86_64-expensive-checks-ubuntu/llvm-project/llvm/lib/Support/VirtualFileSystem.cpp:
 In static member function ‘static 
llvm::ErrorOr > 
llvm::vfs::File::getWithPath(llvm::ErrorOr >, 
const llvm::Twine&)’:
  
/home/buildbot/as-builder-4/llvm-clang-x86_64-expensive-checks-ubuntu/llvm-project/llvm/lib/Support/VirtualFileSystem.cpp:2084:10:
 error: could not convert ‘F’ from ‘std::unique_ptr’ to 
‘llvm::ErrorOr >’
 return F;
^


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113832

Files:
  clang/test/VFS/relative-path-errors.c
  llvm/include/llvm/Support/VirtualFileSystem.h
  llvm/lib/Support/VirtualFileSystem.cpp
  llvm/unittests/Support/VirtualFileSystemTest.cpp

Index: llvm/unittests/Support/VirtualFileSystemTest.cpp
===
--- llvm/unittests/Support/VirtualFileSystemTest.cpp
+++ llvm/unittests/Support/VirtualFileSystemTest.cpp
@@ -1627,6 +1627,114 @@
   EXPECT_EQ(0, NumDiagnostics);
 }
 
+TEST_F(VFSFromYAMLTest, ReturnsRequestedPathVFSMiss) {
+  IntrusiveRefCntPtr BaseFS(
+  new vfs::InMemoryFileSystem);
+  BaseFS->addFile("//root/foo/a", 0,
+  MemoryBuffer::getMemBuffer("contents of a"));
+  ASSERT_FALSE(BaseFS->setCurrentWorkingDirectory("//root/foo"));
+  auto RemappedFS = vfs::RedirectingFileSystem::create(
+  {}, /*UseExternalNames=*/false, *BaseFS);
+
+  auto OpenedF = RemappedFS->openFileForRead("a");
+  ASSERT_FALSE(OpenedF.getError());
+  llvm::ErrorOr Name = (*OpenedF)->getName();
+  ASSERT_FALSE(Name.getError());
+  EXPECT_EQ("a", Name.get());
+
+  auto OpenedS = (*OpenedF)->status();
+  ASSERT_FALSE(OpenedS.getError());
+  EXPECT_EQ("a", OpenedS->getName());
+  EXPECT_FALSE(OpenedS->IsVFSMapped);
+
+  auto DirectS = RemappedFS->status("a");
+  ASSERT_FALSE(DirectS.getError());
+  EXPECT_EQ("a", DirectS->getName());
+  EXPECT_FALSE(DirectS->IsVFSMapped);
+
+  EXPECT_EQ(0, NumDiagnostics);
+}
+
+TEST_F(VFSFromYAMLTest, ReturnsExternalPathVFSHit) {
+  IntrusiveRefCntPtr BaseFS(
+  new vfs::InMemoryFileSystem);
+  BaseFS->addFile("//root/foo/realname", 0,
+  MemoryBuffer::getMemBuffer("contents of a"));
+  auto FS =
+  getFromYAMLString("{ 'use-external-names': true,\n"
+"  'roots': [\n"
+"{\n"
+"  'type': 'directory',\n"
+"  'name': '//root/foo',\n"
+"  'contents': [ {\n"
+"  'type': 'file',\n"
+"  'name': 'vfsname',\n"
+"  'external-contents': 'realname'\n"
+"}\n"
+"  ]\n"
+"}]}",
+BaseFS);
+  ASSERT_FALSE(FS->setCurrentWorkingDirectory("//root/foo"));
+
+  auto OpenedF = FS->openFileForRead("vfsname");
+  ASSERT_FALSE(OpenedF.getError());
+  llvm::ErrorOr Name = (*OpenedF)->getName();
+  ASSERT_FALSE(Name.getError());
+  EXPECT_EQ("realname", Name.get());
+
+  auto OpenedS = (*OpenedF)->status();
+  ASSERT_FALSE(OpenedS.getError());
+  EXPECT_EQ("realname", OpenedS->getName());
+  EXPECT_TRUE(OpenedS->IsVFSMapped);
+
+  auto DirectS = FS->status("vfsname");
+  ASSERT_FALSE(DirectS.getError());
+  EXPECT_EQ("realname", DirectS->getName());
+  EXPECT_TRUE(DirectS->IsVFSMapped);
+
+  EXPECT_EQ(0, NumDiagnostics);
+}
+
+TEST_F(VFSFromYAMLTest, ReturnsInternalPathVFSHit) {
+  IntrusiveRefCntPtr BaseFS(
+  new vfs::InMemoryFileSystem);
+  BaseFS->addFile("//root/foo/realname", 0,
+  MemoryBuffer::getMemBuffer("contents of a"));
+  auto FS =
+  getFromYAMLString("{ 'use-external-names': false,\n"
+"  'roots': [\n"
+"{\n"
+"  'type': 'directory',\n"
+"  'name': '//root/foo',\n"
+"  'contents': [ {\n"
+"  'type': 'file',\n"
+"  'name': 'vfsname',\n"
+"  'external-contents': 'realname'\n"
+"}\n"
+"  ]\n"
+"}]}",
+BaseFS);
+  ASSERT_FALSE(FS->setCurrentWorkingDirectory("//root/foo"));
+
+  auto OpenedF = FS->openFileForRead("vfsname");
+  ASSERT_FALSE(OpenedF.getError());
+  llvm::ErrorO

[PATCH] D113832: reland: [VFS] Use original path when falling back to external FS

2021-11-13 Thread Keith Smiley via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG86e2af8043c7: reland: [VFS] Use original path when falling 
back to external FS (authored by keith).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113832

Files:
  clang/test/VFS/relative-path-errors.c
  llvm/include/llvm/Support/VirtualFileSystem.h
  llvm/lib/Support/VirtualFileSystem.cpp
  llvm/unittests/Support/VirtualFileSystemTest.cpp

Index: llvm/unittests/Support/VirtualFileSystemTest.cpp
===
--- llvm/unittests/Support/VirtualFileSystemTest.cpp
+++ llvm/unittests/Support/VirtualFileSystemTest.cpp
@@ -1627,6 +1627,114 @@
   EXPECT_EQ(0, NumDiagnostics);
 }
 
+TEST_F(VFSFromYAMLTest, ReturnsRequestedPathVFSMiss) {
+  IntrusiveRefCntPtr BaseFS(
+  new vfs::InMemoryFileSystem);
+  BaseFS->addFile("//root/foo/a", 0,
+  MemoryBuffer::getMemBuffer("contents of a"));
+  ASSERT_FALSE(BaseFS->setCurrentWorkingDirectory("//root/foo"));
+  auto RemappedFS = vfs::RedirectingFileSystem::create(
+  {}, /*UseExternalNames=*/false, *BaseFS);
+
+  auto OpenedF = RemappedFS->openFileForRead("a");
+  ASSERT_FALSE(OpenedF.getError());
+  llvm::ErrorOr Name = (*OpenedF)->getName();
+  ASSERT_FALSE(Name.getError());
+  EXPECT_EQ("a", Name.get());
+
+  auto OpenedS = (*OpenedF)->status();
+  ASSERT_FALSE(OpenedS.getError());
+  EXPECT_EQ("a", OpenedS->getName());
+  EXPECT_FALSE(OpenedS->IsVFSMapped);
+
+  auto DirectS = RemappedFS->status("a");
+  ASSERT_FALSE(DirectS.getError());
+  EXPECT_EQ("a", DirectS->getName());
+  EXPECT_FALSE(DirectS->IsVFSMapped);
+
+  EXPECT_EQ(0, NumDiagnostics);
+}
+
+TEST_F(VFSFromYAMLTest, ReturnsExternalPathVFSHit) {
+  IntrusiveRefCntPtr BaseFS(
+  new vfs::InMemoryFileSystem);
+  BaseFS->addFile("//root/foo/realname", 0,
+  MemoryBuffer::getMemBuffer("contents of a"));
+  auto FS =
+  getFromYAMLString("{ 'use-external-names': true,\n"
+"  'roots': [\n"
+"{\n"
+"  'type': 'directory',\n"
+"  'name': '//root/foo',\n"
+"  'contents': [ {\n"
+"  'type': 'file',\n"
+"  'name': 'vfsname',\n"
+"  'external-contents': 'realname'\n"
+"}\n"
+"  ]\n"
+"}]}",
+BaseFS);
+  ASSERT_FALSE(FS->setCurrentWorkingDirectory("//root/foo"));
+
+  auto OpenedF = FS->openFileForRead("vfsname");
+  ASSERT_FALSE(OpenedF.getError());
+  llvm::ErrorOr Name = (*OpenedF)->getName();
+  ASSERT_FALSE(Name.getError());
+  EXPECT_EQ("realname", Name.get());
+
+  auto OpenedS = (*OpenedF)->status();
+  ASSERT_FALSE(OpenedS.getError());
+  EXPECT_EQ("realname", OpenedS->getName());
+  EXPECT_TRUE(OpenedS->IsVFSMapped);
+
+  auto DirectS = FS->status("vfsname");
+  ASSERT_FALSE(DirectS.getError());
+  EXPECT_EQ("realname", DirectS->getName());
+  EXPECT_TRUE(DirectS->IsVFSMapped);
+
+  EXPECT_EQ(0, NumDiagnostics);
+}
+
+TEST_F(VFSFromYAMLTest, ReturnsInternalPathVFSHit) {
+  IntrusiveRefCntPtr BaseFS(
+  new vfs::InMemoryFileSystem);
+  BaseFS->addFile("//root/foo/realname", 0,
+  MemoryBuffer::getMemBuffer("contents of a"));
+  auto FS =
+  getFromYAMLString("{ 'use-external-names': false,\n"
+"  'roots': [\n"
+"{\n"
+"  'type': 'directory',\n"
+"  'name': '//root/foo',\n"
+"  'contents': [ {\n"
+"  'type': 'file',\n"
+"  'name': 'vfsname',\n"
+"  'external-contents': 'realname'\n"
+"}\n"
+"  ]\n"
+"}]}",
+BaseFS);
+  ASSERT_FALSE(FS->setCurrentWorkingDirectory("//root/foo"));
+
+  auto OpenedF = FS->openFileForRead("vfsname");
+  ASSERT_FALSE(OpenedF.getError());
+  llvm::ErrorOr Name = (*OpenedF)->getName();
+  ASSERT_FALSE(Name.getError());
+  EXPECT_EQ("vfsname", Name.get());
+
+  auto OpenedS = (*OpenedF)->status();
+  ASSERT_FALSE(OpenedS.getError());
+  EXPECT_EQ("vfsname", OpenedS->getName());
+  EXPECT_TRUE(OpenedS->IsVFSMapped);
+
+  auto DirectS = FS->status("vfsname");
+  ASSERT_FALSE(DirectS.getError());
+  EXPECT_EQ("vfsname", DirectS->getName());
+  EXPECT_TRUE(DirectS->IsVFSMapped);
+
+  EXPECT_EQ(0, NumDiagnostics);
+}
+
 TEST_F(VFSFromYAMLTest, CaseInsensitive) {
   IntrusiveRefCntPtr Lower(new Dumm

[PATCH] D114842: [lld-macho] Remove old macho darwin lld

2021-11-30 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

I chose to remove the darwinnew / darwinold symlinks here as well. Let me know 
if you all think we should leave those around for a while for some reason


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114842

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


[PATCH] D114842: [lld-macho] Remove old macho darwin lld

2021-11-30 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

In D114842#3163232 , @MaskRay wrote:

> Consider moving the clang driver change to a separate change so that the 
> removal is a more pure file deletion (other than some build system changes)

Fair enough, I'll submit as a follow up


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114842

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


[PATCH] D114842: [lld-macho] Remove old macho darwin lld

2021-11-30 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

In D114842#3163229 , @int3 wrote:

> lgtm. Could you make a post to llvm-dev before landing this? Thanks!

Sent!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114842

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


[PATCH] D114842: [lld-macho] Remove old macho darwin lld

2021-11-30 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 390908.
keith added a comment.
Herald added subscribers: dang, sstefan1, mgrang.
Herald added a reviewer: jdoerfert.
Herald added a project: lld-macho.
Herald added a reviewer: lld-macho.

More deletions


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114842

Files:
  lld/CMakeLists.txt
  lld/include/lld/ReaderWriter/MachOLinkingContext.h
  lld/include/lld/ReaderWriter/YamlContext.h
  lld/lib/CMakeLists.txt
  lld/lib/Driver/CMakeLists.txt
  lld/lib/Driver/DarwinLdDriver.cpp
  lld/lib/Driver/DarwinLdOptions.td
  lld/lib/ReaderWriter/CMakeLists.txt
  lld/lib/ReaderWriter/FileArchive.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler.h
  lld/lib/ReaderWriter/MachO/ArchHandler_arm.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler_x86.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp
  lld/lib/ReaderWriter/MachO/Atoms.h
  lld/lib/ReaderWriter/MachO/CMakeLists.txt
  lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
  lld/lib/ReaderWriter/MachO/DebugInfo.h
  lld/lib/ReaderWriter/MachO/ExecutableAtoms.h
  lld/lib/ReaderWriter/MachO/File.h
  lld/lib/ReaderWriter/MachO/FlatNamespaceFile.h
  lld/lib/ReaderWriter/MachO/GOTPass.cpp
  lld/lib/ReaderWriter/MachO/LayoutPass.cpp
  lld/lib/ReaderWriter/MachO/LayoutPass.h
  lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFile.h
  lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h
  lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
  lld/lib/ReaderWriter/MachO/MachOPasses.h
  lld/lib/ReaderWriter/MachO/ObjCPass.cpp
  lld/lib/ReaderWriter/MachO/SectCreateFile.h
  lld/lib/ReaderWriter/MachO/ShimPass.cpp
  lld/lib/ReaderWriter/MachO/StubsPass.cpp
  lld/lib/ReaderWriter/MachO/TLVPass.cpp
  lld/lib/ReaderWriter/MachO/WriterMachO.cpp
  lld/lib/ReaderWriter/YAML/CMakeLists.txt
  lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
  lld/test/CMakeLists.txt
  lld/test/darwin/Inputs/native-and-mach-o.objtxt
  lld/test/darwin/Inputs/native-and-mach-o2.objtxt
  lld/test/darwin/cmdline-lto_library.objtxt
  lld/test/darwin/cmdline-objc_gc.objtxt
  lld/test/darwin/cmdline-objc_gc_compaction.objtxt
  lld/test/darwin/cmdline-objc_gc_only.objtxt
  lld/test/darwin/native-and-mach-o.objtxt
  lld/test/mach-o/Inputs/DependencyDump.py
  lld/test/mach-o/Inputs/MacOSX.sdk/usr/lib/libSystem.tbd
  lld/test/mach-o/Inputs/PIE.yaml
  lld/test/mach-o/Inputs/arm-interworking.yaml
  lld/test/mach-o/Inputs/arm-shims.yaml
  lld/test/mach-o/Inputs/arm64/libSystem.yaml
  lld/test/mach-o/Inputs/armv7/libSystem.yaml
  lld/test/mach-o/Inputs/bar.yaml
  lld/test/mach-o/Inputs/cstring-sections.yaml
  lld/test/mach-o/Inputs/exported_symbols_list.exp
  lld/test/mach-o/Inputs/full.filelist
  lld/test/mach-o/Inputs/got-order.yaml
  lld/test/mach-o/Inputs/got-order2.yaml
  lld/test/mach-o/Inputs/hello-world-arm64.yaml
  lld/test/mach-o/Inputs/hello-world-armv6.yaml
  lld/test/mach-o/Inputs/hello-world-armv7.yaml
  lld/test/mach-o/Inputs/hello-world-x86.yaml
  lld/test/mach-o/Inputs/hello-world-x86_64.yaml
  lld/test/mach-o/Inputs/hw.raw_bytes
  lld/test/mach-o/Inputs/interposing-section.yaml
  lld/test/mach-o/Inputs/lazy-bind-x86_64-2.yaml
  lld/test/mach-o/Inputs/lazy-bind-x86_64-3.yaml
  lld/test/mach-o/Inputs/lazy-bind-x86_64.yaml
  lld/test/mach-o/Inputs/lib-search-paths/usr/lib/libmyshared.dylib
  lld/test/mach-o/Inputs/lib-search-paths/usr/lib/libmystatic.a
  lld/test/mach-o/Inputs/lib-search-paths/usr/local/lib/file.o
  lld/test/mach-o/Inputs/libbar.a
  lld/test/mach-o/Inputs/libfoo.a
  lld/test/mach-o/Inputs/no-version-min-load-command-object.yaml
  lld/test/mach-o/Inputs/order_file-basic.order
  lld/test/mach-o/Inputs/partial.filelist
  lld/test/mach-o/Inputs/re-exported-dylib-ordinal.yaml
  lld/test/mach-o/Inputs/re-exported-dylib-ordinal2.yaml
  lld/test/mach-o/Inputs/re-exported-dylib-ordinal3.yaml
  lld/test/mach-o/Inputs/swift-version-1.yaml
  lld/test/mach-o/Inputs/unwind-info-simple-arm64.yaml
  lld/test/mach-o/Inputs/use-dylib-install-names.yaml
  lld/test/mach-o/Inputs/use-simple-dylib.yaml
  lld/test/mach-o/Inputs/write-final-sections.yaml
  lld/test/mach-o/Inputs/wrong-arch-error.yaml
  lld/test/mach-o/Inputs/x86/libSystem.yaml
  lld/test/mach-o/Inputs/x86_64/libSystem.yaml
  lld/test/mach-o/PIE.yaml
  lld/test/mach-o/align_text.yaml
  lld/test/mach-o/arm-interworking-movw.yaml
  lld/test/mach-o/arm-interworking.yaml
  lld/test/mach-o/arm-shims.yaml
  lld/test/mach-o/arm-subsections-via-symbols.yaml
  lld/test/mach-o/arm64-reloc-negDelta32-fixup.yaml
  lld/test/mach-o/arm64-relocs-errors-delt

[PATCH] D114842: [lld-macho] Remove old macho darwin lld

2021-11-30 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 390910.
keith added a comment.

Stragglers


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114842

Files:
  lld/CMakeLists.txt
  lld/include/lld/Common/Driver.h
  lld/include/lld/Core/Reference.h
  lld/include/lld/ReaderWriter/MachOLinkingContext.h
  lld/include/lld/ReaderWriter/YamlContext.h
  lld/lib/CMakeLists.txt
  lld/lib/Driver/CMakeLists.txt
  lld/lib/Driver/DarwinLdDriver.cpp
  lld/lib/Driver/DarwinLdOptions.td
  lld/lib/ReaderWriter/CMakeLists.txt
  lld/lib/ReaderWriter/FileArchive.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler.h
  lld/lib/ReaderWriter/MachO/ArchHandler_arm.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler_x86.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp
  lld/lib/ReaderWriter/MachO/Atoms.h
  lld/lib/ReaderWriter/MachO/CMakeLists.txt
  lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
  lld/lib/ReaderWriter/MachO/DebugInfo.h
  lld/lib/ReaderWriter/MachO/ExecutableAtoms.h
  lld/lib/ReaderWriter/MachO/File.h
  lld/lib/ReaderWriter/MachO/FlatNamespaceFile.h
  lld/lib/ReaderWriter/MachO/GOTPass.cpp
  lld/lib/ReaderWriter/MachO/LayoutPass.cpp
  lld/lib/ReaderWriter/MachO/LayoutPass.h
  lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFile.h
  lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h
  lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
  lld/lib/ReaderWriter/MachO/MachOPasses.h
  lld/lib/ReaderWriter/MachO/ObjCPass.cpp
  lld/lib/ReaderWriter/MachO/SectCreateFile.h
  lld/lib/ReaderWriter/MachO/ShimPass.cpp
  lld/lib/ReaderWriter/MachO/StubsPass.cpp
  lld/lib/ReaderWriter/MachO/TLVPass.cpp
  lld/lib/ReaderWriter/MachO/WriterMachO.cpp
  lld/lib/ReaderWriter/YAML/CMakeLists.txt
  lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
  lld/test/CMakeLists.txt
  lld/test/darwin/Inputs/native-and-mach-o.objtxt
  lld/test/darwin/Inputs/native-and-mach-o2.objtxt
  lld/test/darwin/cmdline-lto_library.objtxt
  lld/test/darwin/cmdline-objc_gc.objtxt
  lld/test/darwin/cmdline-objc_gc_compaction.objtxt
  lld/test/darwin/cmdline-objc_gc_only.objtxt
  lld/test/darwin/native-and-mach-o.objtxt
  lld/test/mach-o/Inputs/DependencyDump.py
  lld/test/mach-o/Inputs/MacOSX.sdk/usr/lib/libSystem.tbd
  lld/test/mach-o/Inputs/PIE.yaml
  lld/test/mach-o/Inputs/arm-interworking.yaml
  lld/test/mach-o/Inputs/arm-shims.yaml
  lld/test/mach-o/Inputs/arm64/libSystem.yaml
  lld/test/mach-o/Inputs/armv7/libSystem.yaml
  lld/test/mach-o/Inputs/bar.yaml
  lld/test/mach-o/Inputs/cstring-sections.yaml
  lld/test/mach-o/Inputs/exported_symbols_list.exp
  lld/test/mach-o/Inputs/full.filelist
  lld/test/mach-o/Inputs/got-order.yaml
  lld/test/mach-o/Inputs/got-order2.yaml
  lld/test/mach-o/Inputs/hello-world-arm64.yaml
  lld/test/mach-o/Inputs/hello-world-armv6.yaml
  lld/test/mach-o/Inputs/hello-world-armv7.yaml
  lld/test/mach-o/Inputs/hello-world-x86.yaml
  lld/test/mach-o/Inputs/hello-world-x86_64.yaml
  lld/test/mach-o/Inputs/hw.raw_bytes
  lld/test/mach-o/Inputs/interposing-section.yaml
  lld/test/mach-o/Inputs/lazy-bind-x86_64-2.yaml
  lld/test/mach-o/Inputs/lazy-bind-x86_64-3.yaml
  lld/test/mach-o/Inputs/lazy-bind-x86_64.yaml
  lld/test/mach-o/Inputs/lib-search-paths/usr/lib/libmyshared.dylib
  lld/test/mach-o/Inputs/lib-search-paths/usr/lib/libmystatic.a
  lld/test/mach-o/Inputs/lib-search-paths/usr/local/lib/file.o
  lld/test/mach-o/Inputs/libbar.a
  lld/test/mach-o/Inputs/libfoo.a
  lld/test/mach-o/Inputs/no-version-min-load-command-object.yaml
  lld/test/mach-o/Inputs/order_file-basic.order
  lld/test/mach-o/Inputs/partial.filelist
  lld/test/mach-o/Inputs/re-exported-dylib-ordinal.yaml
  lld/test/mach-o/Inputs/re-exported-dylib-ordinal2.yaml
  lld/test/mach-o/Inputs/re-exported-dylib-ordinal3.yaml
  lld/test/mach-o/Inputs/swift-version-1.yaml
  lld/test/mach-o/Inputs/unwind-info-simple-arm64.yaml
  lld/test/mach-o/Inputs/use-dylib-install-names.yaml
  lld/test/mach-o/Inputs/use-simple-dylib.yaml
  lld/test/mach-o/Inputs/write-final-sections.yaml
  lld/test/mach-o/Inputs/wrong-arch-error.yaml
  lld/test/mach-o/Inputs/x86/libSystem.yaml
  lld/test/mach-o/Inputs/x86_64/libSystem.yaml
  lld/test/mach-o/PIE.yaml
  lld/test/mach-o/align_text.yaml
  lld/test/mach-o/arm-interworking-movw.yaml
  lld/test/mach-o/arm-interworking.yaml
  lld/test/mach-o/arm-shims.yaml
  lld/test/mach-o/arm-subsections-via-symbols.yaml
  lld/test/mach-o/arm64-reloc-negDelta32-fixup.yaml
  lld/test/mach-o/arm64-relocs-errors-delta64-offset.yaml
  lld/test/mach-o/arm64-section-order.yaml
  lld/test/mach-o/bind-opcodes.ya

[PATCH] D114842: [lld-macho] Remove old macho darwin lld

2021-11-30 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 390911.
keith added a comment.

Formatting


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114842

Files:
  lld/CMakeLists.txt
  lld/include/lld/Common/Driver.h
  lld/include/lld/Core/Reference.h
  lld/include/lld/ReaderWriter/MachOLinkingContext.h
  lld/include/lld/ReaderWriter/YamlContext.h
  lld/lib/CMakeLists.txt
  lld/lib/Driver/CMakeLists.txt
  lld/lib/Driver/DarwinLdDriver.cpp
  lld/lib/Driver/DarwinLdOptions.td
  lld/lib/ReaderWriter/CMakeLists.txt
  lld/lib/ReaderWriter/FileArchive.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler.h
  lld/lib/ReaderWriter/MachO/ArchHandler_arm.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler_x86.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp
  lld/lib/ReaderWriter/MachO/Atoms.h
  lld/lib/ReaderWriter/MachO/CMakeLists.txt
  lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
  lld/lib/ReaderWriter/MachO/DebugInfo.h
  lld/lib/ReaderWriter/MachO/ExecutableAtoms.h
  lld/lib/ReaderWriter/MachO/File.h
  lld/lib/ReaderWriter/MachO/FlatNamespaceFile.h
  lld/lib/ReaderWriter/MachO/GOTPass.cpp
  lld/lib/ReaderWriter/MachO/LayoutPass.cpp
  lld/lib/ReaderWriter/MachO/LayoutPass.h
  lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFile.h
  lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h
  lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
  lld/lib/ReaderWriter/MachO/MachOPasses.h
  lld/lib/ReaderWriter/MachO/ObjCPass.cpp
  lld/lib/ReaderWriter/MachO/SectCreateFile.h
  lld/lib/ReaderWriter/MachO/ShimPass.cpp
  lld/lib/ReaderWriter/MachO/StubsPass.cpp
  lld/lib/ReaderWriter/MachO/TLVPass.cpp
  lld/lib/ReaderWriter/MachO/WriterMachO.cpp
  lld/lib/ReaderWriter/YAML/CMakeLists.txt
  lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
  lld/test/CMakeLists.txt
  lld/test/darwin/Inputs/native-and-mach-o.objtxt
  lld/test/darwin/Inputs/native-and-mach-o2.objtxt
  lld/test/darwin/cmdline-lto_library.objtxt
  lld/test/darwin/cmdline-objc_gc.objtxt
  lld/test/darwin/cmdline-objc_gc_compaction.objtxt
  lld/test/darwin/cmdline-objc_gc_only.objtxt
  lld/test/darwin/native-and-mach-o.objtxt
  lld/test/mach-o/Inputs/DependencyDump.py
  lld/test/mach-o/Inputs/MacOSX.sdk/usr/lib/libSystem.tbd
  lld/test/mach-o/Inputs/PIE.yaml
  lld/test/mach-o/Inputs/arm-interworking.yaml
  lld/test/mach-o/Inputs/arm-shims.yaml
  lld/test/mach-o/Inputs/arm64/libSystem.yaml
  lld/test/mach-o/Inputs/armv7/libSystem.yaml
  lld/test/mach-o/Inputs/bar.yaml
  lld/test/mach-o/Inputs/cstring-sections.yaml
  lld/test/mach-o/Inputs/exported_symbols_list.exp
  lld/test/mach-o/Inputs/full.filelist
  lld/test/mach-o/Inputs/got-order.yaml
  lld/test/mach-o/Inputs/got-order2.yaml
  lld/test/mach-o/Inputs/hello-world-arm64.yaml
  lld/test/mach-o/Inputs/hello-world-armv6.yaml
  lld/test/mach-o/Inputs/hello-world-armv7.yaml
  lld/test/mach-o/Inputs/hello-world-x86.yaml
  lld/test/mach-o/Inputs/hello-world-x86_64.yaml
  lld/test/mach-o/Inputs/hw.raw_bytes
  lld/test/mach-o/Inputs/interposing-section.yaml
  lld/test/mach-o/Inputs/lazy-bind-x86_64-2.yaml
  lld/test/mach-o/Inputs/lazy-bind-x86_64-3.yaml
  lld/test/mach-o/Inputs/lazy-bind-x86_64.yaml
  lld/test/mach-o/Inputs/lib-search-paths/usr/lib/libmyshared.dylib
  lld/test/mach-o/Inputs/lib-search-paths/usr/lib/libmystatic.a
  lld/test/mach-o/Inputs/lib-search-paths/usr/local/lib/file.o
  lld/test/mach-o/Inputs/libbar.a
  lld/test/mach-o/Inputs/libfoo.a
  lld/test/mach-o/Inputs/no-version-min-load-command-object.yaml
  lld/test/mach-o/Inputs/order_file-basic.order
  lld/test/mach-o/Inputs/partial.filelist
  lld/test/mach-o/Inputs/re-exported-dylib-ordinal.yaml
  lld/test/mach-o/Inputs/re-exported-dylib-ordinal2.yaml
  lld/test/mach-o/Inputs/re-exported-dylib-ordinal3.yaml
  lld/test/mach-o/Inputs/swift-version-1.yaml
  lld/test/mach-o/Inputs/unwind-info-simple-arm64.yaml
  lld/test/mach-o/Inputs/use-dylib-install-names.yaml
  lld/test/mach-o/Inputs/use-simple-dylib.yaml
  lld/test/mach-o/Inputs/write-final-sections.yaml
  lld/test/mach-o/Inputs/wrong-arch-error.yaml
  lld/test/mach-o/Inputs/x86/libSystem.yaml
  lld/test/mach-o/Inputs/x86_64/libSystem.yaml
  lld/test/mach-o/PIE.yaml
  lld/test/mach-o/align_text.yaml
  lld/test/mach-o/arm-interworking-movw.yaml
  lld/test/mach-o/arm-interworking.yaml
  lld/test/mach-o/arm-shims.yaml
  lld/test/mach-o/arm-subsections-via-symbols.yaml
  lld/test/mach-o/arm64-reloc-negDelta32-fixup.yaml
  lld/test/mach-o/arm64-relocs-errors-delta64-offset.yaml
  lld/test/mach-o/arm64-section-order.yaml
  lld/test/mach-o/bind-opcodes.ya

[PATCH] D114842: [lld-macho] Remove old macho darwin lld

2021-12-01 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 391065.
keith marked an inline comment as done.
keith added a comment.

Remove lld/lib directory


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114842

Files:
  lld/CMakeLists.txt
  lld/include/lld/Common/Driver.h
  lld/include/lld/Core/Reference.h
  lld/include/lld/ReaderWriter/MachOLinkingContext.h
  lld/include/lld/ReaderWriter/YamlContext.h
  lld/lib/CMakeLists.txt
  lld/lib/Core/CMakeLists.txt
  lld/lib/Core/DefinedAtom.cpp
  lld/lib/Core/Error.cpp
  lld/lib/Core/File.cpp
  lld/lib/Core/LinkingContext.cpp
  lld/lib/Core/Reader.cpp
  lld/lib/Core/Resolver.cpp
  lld/lib/Core/SymbolTable.cpp
  lld/lib/Core/Writer.cpp
  lld/lib/Driver/CMakeLists.txt
  lld/lib/Driver/DarwinLdDriver.cpp
  lld/lib/Driver/DarwinLdOptions.td
  lld/lib/ReaderWriter/CMakeLists.txt
  lld/lib/ReaderWriter/FileArchive.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler.h
  lld/lib/ReaderWriter/MachO/ArchHandler_arm.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler_x86.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp
  lld/lib/ReaderWriter/MachO/Atoms.h
  lld/lib/ReaderWriter/MachO/CMakeLists.txt
  lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
  lld/lib/ReaderWriter/MachO/DebugInfo.h
  lld/lib/ReaderWriter/MachO/ExecutableAtoms.h
  lld/lib/ReaderWriter/MachO/File.h
  lld/lib/ReaderWriter/MachO/FlatNamespaceFile.h
  lld/lib/ReaderWriter/MachO/GOTPass.cpp
  lld/lib/ReaderWriter/MachO/LayoutPass.cpp
  lld/lib/ReaderWriter/MachO/LayoutPass.h
  lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFile.h
  lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h
  lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
  lld/lib/ReaderWriter/MachO/MachOPasses.h
  lld/lib/ReaderWriter/MachO/ObjCPass.cpp
  lld/lib/ReaderWriter/MachO/SectCreateFile.h
  lld/lib/ReaderWriter/MachO/ShimPass.cpp
  lld/lib/ReaderWriter/MachO/StubsPass.cpp
  lld/lib/ReaderWriter/MachO/TLVPass.cpp
  lld/lib/ReaderWriter/MachO/WriterMachO.cpp
  lld/lib/ReaderWriter/YAML/CMakeLists.txt
  lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
  lld/test/CMakeLists.txt
  lld/test/darwin/Inputs/native-and-mach-o.objtxt
  lld/test/darwin/Inputs/native-and-mach-o2.objtxt
  lld/test/darwin/cmdline-lto_library.objtxt
  lld/test/darwin/cmdline-objc_gc.objtxt
  lld/test/darwin/cmdline-objc_gc_compaction.objtxt
  lld/test/darwin/cmdline-objc_gc_only.objtxt
  lld/test/darwin/native-and-mach-o.objtxt
  lld/test/mach-o/Inputs/DependencyDump.py
  lld/test/mach-o/Inputs/MacOSX.sdk/usr/lib/libSystem.tbd
  lld/test/mach-o/Inputs/PIE.yaml
  lld/test/mach-o/Inputs/arm-interworking.yaml
  lld/test/mach-o/Inputs/arm-shims.yaml
  lld/test/mach-o/Inputs/arm64/libSystem.yaml
  lld/test/mach-o/Inputs/armv7/libSystem.yaml
  lld/test/mach-o/Inputs/bar.yaml
  lld/test/mach-o/Inputs/cstring-sections.yaml
  lld/test/mach-o/Inputs/exported_symbols_list.exp
  lld/test/mach-o/Inputs/full.filelist
  lld/test/mach-o/Inputs/got-order.yaml
  lld/test/mach-o/Inputs/got-order2.yaml
  lld/test/mach-o/Inputs/hello-world-arm64.yaml
  lld/test/mach-o/Inputs/hello-world-armv6.yaml
  lld/test/mach-o/Inputs/hello-world-armv7.yaml
  lld/test/mach-o/Inputs/hello-world-x86.yaml
  lld/test/mach-o/Inputs/hello-world-x86_64.yaml
  lld/test/mach-o/Inputs/hw.raw_bytes
  lld/test/mach-o/Inputs/interposing-section.yaml
  lld/test/mach-o/Inputs/lazy-bind-x86_64-2.yaml
  lld/test/mach-o/Inputs/lazy-bind-x86_64-3.yaml
  lld/test/mach-o/Inputs/lazy-bind-x86_64.yaml
  lld/test/mach-o/Inputs/lib-search-paths/usr/lib/libmyshared.dylib
  lld/test/mach-o/Inputs/lib-search-paths/usr/lib/libmystatic.a
  lld/test/mach-o/Inputs/lib-search-paths/usr/local/lib/file.o
  lld/test/mach-o/Inputs/libbar.a
  lld/test/mach-o/Inputs/libfoo.a
  lld/test/mach-o/Inputs/no-version-min-load-command-object.yaml
  lld/test/mach-o/Inputs/order_file-basic.order
  lld/test/mach-o/Inputs/partial.filelist
  lld/test/mach-o/Inputs/re-exported-dylib-ordinal.yaml
  lld/test/mach-o/Inputs/re-exported-dylib-ordinal2.yaml
  lld/test/mach-o/Inputs/re-exported-dylib-ordinal3.yaml
  lld/test/mach-o/Inputs/swift-version-1.yaml
  lld/test/mach-o/Inputs/unwind-info-simple-arm64.yaml
  lld/test/mach-o/Inputs/use-dylib-install-names.yaml
  lld/test/mach-o/Inputs/use-simple-dylib.yaml
  lld/test/mach-o/Inputs/write-final-sections.yaml
  lld/test/mach-o/Inputs/wrong-arch-error.yaml
  lld/test/mach-o/Inputs/x86/libSystem.yaml
  lld/test/mach-o/Inputs/x86_64/libSystem.yaml
  lld/test/mach-o/PIE.yaml
  lld/test/mach-o/align_text.yaml
  lld/test/mach-o/arm-interworking-movw.yaml
 

[PATCH] D114842: [lld-macho] Remove old macho darwin lld

2021-12-02 Thread Keith Smiley via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9e3552523ebd: [lld-macho] Remove old macho darwin lld 
(authored by keith).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114842

Files:
  lld/CMakeLists.txt
  lld/include/lld/Common/Driver.h
  lld/include/lld/Core/Reference.h
  lld/include/lld/ReaderWriter/MachOLinkingContext.h
  lld/include/lld/ReaderWriter/YamlContext.h
  lld/lib/CMakeLists.txt
  lld/lib/Core/CMakeLists.txt
  lld/lib/Core/DefinedAtom.cpp
  lld/lib/Core/Error.cpp
  lld/lib/Core/File.cpp
  lld/lib/Core/LinkingContext.cpp
  lld/lib/Core/Reader.cpp
  lld/lib/Core/Resolver.cpp
  lld/lib/Core/SymbolTable.cpp
  lld/lib/Core/Writer.cpp
  lld/lib/Driver/CMakeLists.txt
  lld/lib/Driver/DarwinLdDriver.cpp
  lld/lib/Driver/DarwinLdOptions.td
  lld/lib/ReaderWriter/CMakeLists.txt
  lld/lib/ReaderWriter/FileArchive.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler.h
  lld/lib/ReaderWriter/MachO/ArchHandler_arm.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler_x86.cpp
  lld/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp
  lld/lib/ReaderWriter/MachO/Atoms.h
  lld/lib/ReaderWriter/MachO/CMakeLists.txt
  lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
  lld/lib/ReaderWriter/MachO/DebugInfo.h
  lld/lib/ReaderWriter/MachO/ExecutableAtoms.h
  lld/lib/ReaderWriter/MachO/File.h
  lld/lib/ReaderWriter/MachO/FlatNamespaceFile.h
  lld/lib/ReaderWriter/MachO/GOTPass.cpp
  lld/lib/ReaderWriter/MachO/LayoutPass.cpp
  lld/lib/ReaderWriter/MachO/LayoutPass.h
  lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFile.h
  lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h
  lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
  lld/lib/ReaderWriter/MachO/MachOPasses.h
  lld/lib/ReaderWriter/MachO/ObjCPass.cpp
  lld/lib/ReaderWriter/MachO/SectCreateFile.h
  lld/lib/ReaderWriter/MachO/ShimPass.cpp
  lld/lib/ReaderWriter/MachO/StubsPass.cpp
  lld/lib/ReaderWriter/MachO/TLVPass.cpp
  lld/lib/ReaderWriter/MachO/WriterMachO.cpp
  lld/lib/ReaderWriter/YAML/CMakeLists.txt
  lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
  lld/test/CMakeLists.txt
  lld/test/darwin/Inputs/native-and-mach-o.objtxt
  lld/test/darwin/Inputs/native-and-mach-o2.objtxt
  lld/test/darwin/cmdline-lto_library.objtxt
  lld/test/darwin/cmdline-objc_gc.objtxt
  lld/test/darwin/cmdline-objc_gc_compaction.objtxt
  lld/test/darwin/cmdline-objc_gc_only.objtxt
  lld/test/darwin/native-and-mach-o.objtxt
  lld/test/mach-o/Inputs/DependencyDump.py
  lld/test/mach-o/Inputs/MacOSX.sdk/usr/lib/libSystem.tbd
  lld/test/mach-o/Inputs/PIE.yaml
  lld/test/mach-o/Inputs/arm-interworking.yaml
  lld/test/mach-o/Inputs/arm-shims.yaml
  lld/test/mach-o/Inputs/arm64/libSystem.yaml
  lld/test/mach-o/Inputs/armv7/libSystem.yaml
  lld/test/mach-o/Inputs/bar.yaml
  lld/test/mach-o/Inputs/cstring-sections.yaml
  lld/test/mach-o/Inputs/exported_symbols_list.exp
  lld/test/mach-o/Inputs/full.filelist
  lld/test/mach-o/Inputs/got-order.yaml
  lld/test/mach-o/Inputs/got-order2.yaml
  lld/test/mach-o/Inputs/hello-world-arm64.yaml
  lld/test/mach-o/Inputs/hello-world-armv6.yaml
  lld/test/mach-o/Inputs/hello-world-armv7.yaml
  lld/test/mach-o/Inputs/hello-world-x86.yaml
  lld/test/mach-o/Inputs/hello-world-x86_64.yaml
  lld/test/mach-o/Inputs/hw.raw_bytes
  lld/test/mach-o/Inputs/interposing-section.yaml
  lld/test/mach-o/Inputs/lazy-bind-x86_64-2.yaml
  lld/test/mach-o/Inputs/lazy-bind-x86_64-3.yaml
  lld/test/mach-o/Inputs/lazy-bind-x86_64.yaml
  lld/test/mach-o/Inputs/lib-search-paths/usr/lib/libmyshared.dylib
  lld/test/mach-o/Inputs/lib-search-paths/usr/lib/libmystatic.a
  lld/test/mach-o/Inputs/lib-search-paths/usr/local/lib/file.o
  lld/test/mach-o/Inputs/libbar.a
  lld/test/mach-o/Inputs/libfoo.a
  lld/test/mach-o/Inputs/no-version-min-load-command-object.yaml
  lld/test/mach-o/Inputs/order_file-basic.order
  lld/test/mach-o/Inputs/partial.filelist
  lld/test/mach-o/Inputs/re-exported-dylib-ordinal.yaml
  lld/test/mach-o/Inputs/re-exported-dylib-ordinal2.yaml
  lld/test/mach-o/Inputs/re-exported-dylib-ordinal3.yaml
  lld/test/mach-o/Inputs/swift-version-1.yaml
  lld/test/mach-o/Inputs/unwind-info-simple-arm64.yaml
  lld/test/mach-o/Inputs/use-dylib-install-names.yaml
  lld/test/mach-o/Inputs/use-simple-dylib.yaml
  lld/test/mach-o/Inputs/write-final-sections.yaml
  lld/test/mach-o/Inputs/wrong-arch-error.yaml
  lld/test/mach-o/Inputs/x86/libSystem.yaml
  lld/test/mach-o/Inputs/x86_64/libSystem.yaml
  lld/test/mach-

[PATCH] D114974: [clang][Darwin] Remove old lld implementation handling

2021-12-02 Thread Keith Smiley via Phabricator via cfe-commits
keith created this revision.
keith added reviewers: int3, MaskRay, oontvoo, thakis.
keith requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This now assumes that for the darwin driver any lld is the "new" macho
lld implementation.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114974

Files:
  clang/include/clang/Driver/ToolChain.h
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/Darwin.cpp
  clang/lib/Driver/ToolChains/Darwin.h
  clang/test/Driver/darwin-ld-demangle-lld.c
  clang/test/Driver/darwin-ld-platform-version-ios.c
  clang/test/Driver/darwin-ld-platform-version-macos.c
  clang/test/Driver/darwin-ld-platform-version-tvos.c
  clang/test/Driver/darwin-ld-platform-version-watchos.c

Index: clang/test/Driver/darwin-ld-platform-version-watchos.c
===
--- clang/test/Driver/darwin-ld-platform-version-watchos.c
+++ clang/test/Driver/darwin-ld-platform-version-watchos.c
@@ -1,9 +1,5 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld=lld.darwinold \
-// RUN:   -isysroot %S/Inputs/WatchOS6.0.sdk -mlinker-version=0 \
-// RUN:   -### %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=LINKER-OLD %s
 // RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld= \
 // RUN:   -isysroot %S/Inputs/WatchOS6.0.sdk -mlinker-version=400 \
 // RUN:   -### %t.o 2>&1 \
Index: clang/test/Driver/darwin-ld-platform-version-tvos.c
===
--- clang/test/Driver/darwin-ld-platform-version-tvos.c
+++ clang/test/Driver/darwin-ld-platform-version-tvos.c
@@ -1,9 +1,5 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target arm64-apple-tvos12.3 -fuse-ld=lld.darwinold \
-// RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=0 \
-// RUN:   -### %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=LINKER-OLD %s
 // RUN: %clang -target arm64-apple-tvos12.3 -fuse-ld= \
 // RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=400 \
 // RUN:   -### %t.o 2>&1 \
Index: clang/test/Driver/darwin-ld-platform-version-macos.c
===
--- clang/test/Driver/darwin-ld-platform-version-macos.c
+++ clang/test/Driver/darwin-ld-platform-version-macos.c
@@ -1,9 +1,5 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target x86_64-apple-macos10.13 -fuse-ld=lld.darwinold \
-// RUN:   -isysroot %S/Inputs/MacOSX10.14.sdk -mlinker-version=0 \
-// RUN:   -### %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=LINKER-OLD %s
 // RUN: %clang -target x86_64-apple-macos10.13 -fuse-ld=lld \
 // RUN:   -isysroot %S/Inputs/MacOSX10.14.sdk -mlinker-version=0 \
 // RUN:   -### %t.o -B%S/Inputs/lld 2>&1 \
Index: clang/test/Driver/darwin-ld-platform-version-ios.c
===
--- clang/test/Driver/darwin-ld-platform-version-ios.c
+++ clang/test/Driver/darwin-ld-platform-version-ios.c
@@ -1,9 +1,5 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target arm64-apple-ios12.3 -fuse-ld=lld.darwinold \
-// RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=0 \
-// RUN:   -### %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=LINKER-OLD %s
 // RUN: %clang -target arm64-apple-ios12.3 -fuse-ld= \
 // RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=400 \
 // RUN:   -### %t.o 2>&1 \
Index: clang/test/Driver/darwin-ld-demangle-lld.c
===
--- clang/test/Driver/darwin-ld-demangle-lld.c
+++ clang/test/Driver/darwin-ld-demangle-lld.c
@@ -1,11 +1,6 @@
 // With -fuse-ld=lld, -demangle is always passed to the linker on Darwin.
 // REQUIRES: shell
 
-// FIXME: Remove this test case when we remove the lld.darwinold backend.
-// RUN: %clang --target=x86_64-apple-darwin -### \
-// RUN:   -fuse-ld=lld.darwinold -B%S/Inputs/lld -mlinker-version=0 %s 2>&1 \
-// RUN:   | FileCheck %s
-
 // RUN: %clang --target=x86_64-apple-darwin -### \
 // RUN:   -fuse-ld=lld -B%S/Inputs/lld -mlinker-version=0 %s 2>&1 \
 // RUN:   | FileCheck %s
Index: clang/lib/Driver/ToolChains/Darwin.h
===
--- clang/lib/Driver/ToolChains/Darwin.h
+++ clang/lib/Driver/ToolChains/Darwin.h
@@ -64,7 +64,7 @@
   void AddLinkArgs(Compilation &C, const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs,
const InputInfoList &Inputs, unsigned Version[5],
-   bool LinkerIsLLD, bool LinkerIsLLDDarwinNew) const;
+   bool LinkerIsLLD) const;
 
 public:
   Linker(const ToolChain &TC) : MachOTool("darwin::Linker", "linker", TC) {}
Index: clang/lib/Driver/ToolChains/Darwin.cpp
===
--- clang/lib/Driver/ToolChains/Darwin.cpp
+++ clang/lib/Driver/ToolChains/Darwin.cpp
@@ -209,8 +209,7 @@
 void darwin::Linker::AddLinkA

[PATCH] D114974: [clang][Darwin] Remove old lld implementation handling

2021-12-02 Thread Keith Smiley via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGace03d0df4fa: [clang][Darwin] Remove old lld implementation 
handling (authored by keith).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114974

Files:
  clang/include/clang/Driver/ToolChain.h
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/Darwin.cpp
  clang/lib/Driver/ToolChains/Darwin.h
  clang/test/Driver/darwin-ld-demangle-lld.c
  clang/test/Driver/darwin-ld-platform-version-ios.c
  clang/test/Driver/darwin-ld-platform-version-macos.c
  clang/test/Driver/darwin-ld-platform-version-tvos.c
  clang/test/Driver/darwin-ld-platform-version-watchos.c

Index: clang/test/Driver/darwin-ld-platform-version-watchos.c
===
--- clang/test/Driver/darwin-ld-platform-version-watchos.c
+++ clang/test/Driver/darwin-ld-platform-version-watchos.c
@@ -1,9 +1,5 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld=lld.darwinold \
-// RUN:   -isysroot %S/Inputs/WatchOS6.0.sdk -mlinker-version=0 \
-// RUN:   -### %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=LINKER-OLD %s
 // RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld= \
 // RUN:   -isysroot %S/Inputs/WatchOS6.0.sdk -mlinker-version=400 \
 // RUN:   -### %t.o 2>&1 \
Index: clang/test/Driver/darwin-ld-platform-version-tvos.c
===
--- clang/test/Driver/darwin-ld-platform-version-tvos.c
+++ clang/test/Driver/darwin-ld-platform-version-tvos.c
@@ -1,9 +1,5 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target arm64-apple-tvos12.3 -fuse-ld=lld.darwinold \
-// RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=0 \
-// RUN:   -### %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=LINKER-OLD %s
 // RUN: %clang -target arm64-apple-tvos12.3 -fuse-ld= \
 // RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=400 \
 // RUN:   -### %t.o 2>&1 \
Index: clang/test/Driver/darwin-ld-platform-version-macos.c
===
--- clang/test/Driver/darwin-ld-platform-version-macos.c
+++ clang/test/Driver/darwin-ld-platform-version-macos.c
@@ -1,9 +1,5 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target x86_64-apple-macos10.13 -fuse-ld=lld.darwinold \
-// RUN:   -isysroot %S/Inputs/MacOSX10.14.sdk -mlinker-version=0 \
-// RUN:   -### %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=LINKER-OLD %s
 // RUN: %clang -target x86_64-apple-macos10.13 -fuse-ld=lld \
 // RUN:   -isysroot %S/Inputs/MacOSX10.14.sdk -mlinker-version=0 \
 // RUN:   -### %t.o -B%S/Inputs/lld 2>&1 \
Index: clang/test/Driver/darwin-ld-platform-version-ios.c
===
--- clang/test/Driver/darwin-ld-platform-version-ios.c
+++ clang/test/Driver/darwin-ld-platform-version-ios.c
@@ -1,9 +1,5 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target arm64-apple-ios12.3 -fuse-ld=lld.darwinold \
-// RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=0 \
-// RUN:   -### %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=LINKER-OLD %s
 // RUN: %clang -target arm64-apple-ios12.3 -fuse-ld= \
 // RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=400 \
 // RUN:   -### %t.o 2>&1 \
Index: clang/test/Driver/darwin-ld-demangle-lld.c
===
--- clang/test/Driver/darwin-ld-demangle-lld.c
+++ clang/test/Driver/darwin-ld-demangle-lld.c
@@ -1,11 +1,6 @@
 // With -fuse-ld=lld, -demangle is always passed to the linker on Darwin.
 // REQUIRES: shell
 
-// FIXME: Remove this test case when we remove the lld.darwinold backend.
-// RUN: %clang --target=x86_64-apple-darwin -### \
-// RUN:   -fuse-ld=lld.darwinold -B%S/Inputs/lld -mlinker-version=0 %s 2>&1 \
-// RUN:   | FileCheck %s
-
 // RUN: %clang --target=x86_64-apple-darwin -### \
 // RUN:   -fuse-ld=lld -B%S/Inputs/lld -mlinker-version=0 %s 2>&1 \
 // RUN:   | FileCheck %s
Index: clang/lib/Driver/ToolChains/Darwin.h
===
--- clang/lib/Driver/ToolChains/Darwin.h
+++ clang/lib/Driver/ToolChains/Darwin.h
@@ -64,7 +64,7 @@
   void AddLinkArgs(Compilation &C, const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs,
const InputInfoList &Inputs, unsigned Version[5],
-   bool LinkerIsLLD, bool LinkerIsLLDDarwinNew) const;
+   bool LinkerIsLLD) const;
 
 public:
   Linker(const ToolChain &TC) : MachOTool("darwin::Linker", "linker", TC) {}
Index: clang/lib/Driver/ToolChains/Darwin.cpp
===
--- clang/lib/Driver/ToolChains/Darwin.cpp
+++ clang/lib/Driver/ToolChains/Darwin.cpp
@@ -209,8 +209,7 @@
 void darwin::Linker::AddLinkArgs(Compilation &C, const ArgList &Arg

[PATCH] D126598: Fixed typo in hmaptool CMakeLists.txt

2022-05-28 Thread Keith Smiley via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG50f2e4992456: [clang][cmake] Fixed typo in hmaptool 
CMakeLists.txt (authored by danielh2942, committed by keith).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126598

Files:
  clang/utils/hmaptool/CMakeLists.txt


Index: clang/utils/hmaptool/CMakeLists.txt
===
--- clang/utils/hmaptool/CMakeLists.txt
+++ clang/utils/hmaptool/CMakeLists.txt
@@ -2,7 +2,7 @@
COMMAND "${CMAKE_COMMAND}" -E copy 
"${CMAKE_CURRENT_SOURCE_DIR}/hmaptool" "${LLVM_TOOLS_BINARY_DIR}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/hmaptool")
 
-install(PROGRAMS hmaptool DESTINATION "${LLVM_UTILS_INSTALL_DIR}}" COMPONENT 
hmaptool)
+install(PROGRAMS hmaptool DESTINATION "${LLVM_UTILS_INSTALL_DIR}" COMPONENT 
hmaptool)
 add_custom_target(hmaptool ALL DEPENDS "${LLVM_TOOLS_BINARY_DIR}/hmaptool")
 set_target_properties(hmaptool PROPERTIES FOLDER "Utils")
 


Index: clang/utils/hmaptool/CMakeLists.txt
===
--- clang/utils/hmaptool/CMakeLists.txt
+++ clang/utils/hmaptool/CMakeLists.txt
@@ -2,7 +2,7 @@
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/hmaptool" "${LLVM_TOOLS_BINARY_DIR}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/hmaptool")
 
-install(PROGRAMS hmaptool DESTINATION "${LLVM_UTILS_INSTALL_DIR}}" COMPONENT hmaptool)
+install(PROGRAMS hmaptool DESTINATION "${LLVM_UTILS_INSTALL_DIR}" COMPONENT hmaptool)
 add_custom_target(hmaptool ALL DEPENDS "${LLVM_TOOLS_BINARY_DIR}/hmaptool")
 set_target_properties(hmaptool PROPERTIES FOLDER "Utils")
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147561: [clang] don't serialize MODULE_DIRECTORY with ModuleFileHomeIsCwd

2023-04-04 Thread Keith Smiley via Phabricator via cfe-commits
keith accepted this revision.
keith added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/test/Modules/module-file-home-is-cwd.m:7-8
 // RUN: -o %t/mod.pcm
 // RUN: llvm-bcanalyzer --dump --disable-histogram %t/mod.pcm | FileCheck %s
+// RUN: llvm-bcanalyzer --dump --disable-histogram %t/mod.pcm | FileCheck %s 
--check-prefix=INPUT
 

Instead of doing 2 invocations you can do `--check-prefixes=CHECK,INPUT`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147561

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


  1   2   >