forked from llvm-mirror/clang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang-scan-deps] Fix for headers having the same name as a directory
Scan deps tool crashes when called on a C++ file, containing an include that has the same name as a directory. The tool crashes since it finds foo/dir and tries to read that as a file and fails. Patch by: kousikk (Kousik Kumar) Differential Revision: https://reviews.llvm.org/D67091 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371903 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
5 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// A C++ header with same name as that of a directory in the include path. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[ | ||
{ | ||
"directory": "DIR", | ||
"command": "clang -c -IDIR -IDIR/foodir -IInputs DIR/headerwithdirname_input.cpp", | ||
"file": "DIR/headerwithdirname_input.cpp" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// RUN: rm -rf %t.dir | ||
// RUN: rm -rf %t.dir/foodir | ||
// RUN: rm -rf %t.cdb | ||
// RUN: mkdir -p %t.dir | ||
// RUN: mkdir -p %t.dir/foodir | ||
// RUN: cp %s %t.dir/headerwithdirname_input.cpp | ||
// RUN: mkdir %t.dir/Inputs | ||
// RUN: cp %S/Inputs/foodir %t.dir/Inputs/foodir | ||
// RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/headerwithdirname.json > %t.cdb | ||
// | ||
// RUN: clang-scan-deps -compilation-database %t.cdb -j 1 | FileCheck %s | ||
|
||
#include <foodir> | ||
|
||
// CHECK: headerwithdirname_input.o | ||
// CHECK-NEXT: headerwithdirname_input.cpp | ||
// CHECK-NEXT: Inputs{{/|\\}}foodir |