-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang][deps] Teach dep directive scanner about _Pragma
While we cannot handle `_Pragma` used inside macros, we can handle this at the top level, and it some projects use the `_Pragma("once")` spelling like that, which was causing spurious failures in the scanner. Limitations * Cannot handle #define ONCE _Pragma("once"), same issue as using @import in a macro -- ideally we should diagnose this in obvious cases * Our LangOpts are currently fixed, so we are not handling u"" strings or R"()" strings that require C11/C++11. rdar://108629982 Differential Revision: https://reviews.llvm.org/D149884
- Loading branch information
1 parent
ec77d1f
commit ee8ed0b
Showing
5 changed files
with
271 additions
and
41 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
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,24 @@ | ||
// Test scanning deps works with _Pragma syntax when not inside a macro. | ||
|
||
// RUN: rm -rf %t | ||
// RUN: split-file %s %t | ||
// RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json | ||
|
||
// RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 | ||
|
||
//--- cdb.json.template | ||
[{ | ||
"directory": "DIR", | ||
"command": "clang -fsyntax-only DIR/tu.c", | ||
"file": "DIR/tu.c" | ||
}] | ||
|
||
//--- a.h | ||
_Pragma("once") | ||
#include "b.h" | ||
|
||
//--- b.h | ||
#include "a.h" | ||
|
||
//--- tu.c | ||
#include "a.h" |
Oops, something went wrong.