Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Mar 28, 2020. It is now read-only.
/swift-clangPublic archive

Commit680e510

Browse files
zmodemJDevlieghere
authored andcommitted
Fix the 'directory' field in DumpCompilationDatabase and add test
This broke in r371027 due to a missing negation(llvm::sys::fs::current_path returns false on success).git-svn-id:https://llvm.org/svn/llvm-project/cfe/trunk@373049 91177308-0d34-0410-b5e6-96231b3b80d8(cherry picked from commit0f7791e)
1 parent59d80e7 commit680e510

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

‎lib/Driver/ToolChains/Clang.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2016,7 +2016,7 @@ void Clang::DumpCompilationDatabase(Compilation &C, StringRef Filename,
20162016
}
20172017
auto &CDB = *CompilationDatabase;
20182018
SmallString<128> Buf;
2019-
if (!llvm::sys::fs::current_path(Buf))
2019+
if (llvm::sys::fs::current_path(Buf))
20202020
Buf =".";
20212021
CDB <<"{\"directory\":\"" <<escape(Buf) <<"\"";
20222022
CDB <<",\"file\":\"" <<escape(Input.getFilename()) <<"\"";

‎test/Driver/compilation_database.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// RUN: mkdir -p %t && cd %t
1+
// RUN: mkdir -p %t.workdir && cd %t.workdir
22
// RUN: %clang -MD -MP --sysroot=somewhere -c -x c %s -xc++ %s -Wall -MJ - -no-canonical-prefixes 2>&1 | FileCheck %s
33
// RUN: not %clang -c -x c %s -MJ %s/non-existant -no-canonical-prefixes 2>&1 | FileCheck --check-prefix=ERROR %s
44

5-
// CHECK: { "directory": "{{.*}}", "file": "[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": "compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc", "[[SRC]]", "--sysroot=somewhere", "-c", "-Wall",{{.*}} "--target={{[^"]+}}"]},
5+
// CHECK: { "directory": "{{[^"]*}}workdir", "file": "[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": "compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc", "[[SRC]]", "--sysroot=somewhere", "-c", "-Wall",{{.*}} "--target={{[^"]+}}"]},
66
// CHECK: { "directory": "{{.*}}", "file": "[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": "compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc++", "[[SRC]]", "--sysroot=somewhere", "-c", "-Wall",{{.*}} "--target={{[^"]+}}"]},
77
// ERROR: error: compilation database '{{.*}}/non-existant' could not be opened:
88

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp