-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
179 additions
and
86 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,2 @@ | ||
#define MY_DEFINE | ||
#define THE_ANSWER 42 |
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,13 @@ | ||
#include "src/analyze_includes/test/data/some_defines.h" | ||
|
||
#ifdef MY_DEFINE | ||
#include "expected/include_a.h" | ||
#else | ||
#include "bad/include_a.h" | ||
#endif | ||
|
||
#if THE_ANSWER > 40 | ||
#include "expected/include_b.h" | ||
#else | ||
#include "bad/include_b.h" | ||
#endif |
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 |
---|---|---|
@@ -1,11 +1,2 @@ | ||
Defines can influence which include statements are relevant. | ||
|
||
These tests concentrate on parsing single files based on defines: | ||
|
||
- specified in the parsed file itself | ||
- coming from the C/C++ toolchain | ||
- defined by the Bazel target attributes `defines`, `local_defines` or `cops` | ||
|
||
Defines can also be imported into a file via an included header which specifies a define. | ||
This use case is not yet supported. | ||
We might add it at a later stage. | ||
In these test we ensure our preprocessor behaves as expected and chooses the desired code parts for analysis. |
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 |
---|---|---|
@@ -1,17 +1,17 @@ | ||
#ifdef SOME_DEFINE | ||
#include "test/aspect/defines/lib/a.h" | ||
#include "test/aspect/defines/support/a.h" | ||
#else | ||
#include "test/aspect/defines/lib/b.h" | ||
#include "test/aspect/defines/support/b.h" | ||
#endif | ||
|
||
#ifdef LOCAL_DEFINE | ||
#include "test/aspect/defines/lib/a.h" | ||
#include "test/aspect/defines/support/a.h" | ||
#else | ||
#include "test/aspect/defines/lib/b.h" | ||
#include "test/aspect/defines/support/b.h" | ||
#endif | ||
|
||
#if SOME_COPT > 40 | ||
#include "test/aspect/defines/lib/a.h" | ||
#include "test/aspect/defines/support/a.h" | ||
#else | ||
#include "test/aspect/defines/lib/b.h" | ||
#include "test/aspect/defines/support/b.h" | ||
#endif |
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 |
---|---|---|
@@ -1,19 +1,19 @@ | ||
#define USE_A | ||
|
||
#ifdef USE_A | ||
#include "test/aspect/defines/lib/a.h" | ||
#include "test/aspect/defines/support/a.h" | ||
#else | ||
#include "test/aspect/defines/lib/b.h" | ||
#include "test/aspect/defines/support/b.h" | ||
#endif | ||
|
||
#ifdef NON_EXISTING_DEFINE | ||
#include "test/aspect/defines/lib/b.h" | ||
#include "test/aspect/defines/support/b.h" | ||
#endif | ||
|
||
#define SOME_VALUE 42 | ||
|
||
#if SOME_VALUE > 40 | ||
#include "test/aspect/defines/lib/a.h" | ||
#include "test/aspect/defines/support/a.h" | ||
#else | ||
#include "test/aspect/defines/lib/b.h" | ||
#include "test/aspect/defines/support/b.h" | ||
#endif |
This file was deleted.
Oops, something went wrong.
Empty file.
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 |
---|---|---|
@@ -1,7 +1,34 @@ | ||
package(default_visibility = ["//test/aspect/defines:__pkg__"]) | ||
|
||
cc_library( | ||
name = "transitive_define", | ||
copts = ["-DLOCAL_COPT"], # should not influence other targets | ||
defines = ["TRANSITIVE_DEFINE"], | ||
local_defines = ["LOCAL_DEFINE"], # should not influence other targets | ||
visibility = ["//test/aspect/defines:__pkg__"], | ||
) | ||
|
||
cc_library( | ||
name = "conditional_defines", | ||
hdrs = ["conditional_defines.h"], | ||
deps = [":some_defines"], | ||
) | ||
|
||
cc_library( | ||
name = "some_defines", | ||
hdrs = ["some_defines.h"], | ||
) | ||
|
||
cc_library( | ||
name = "lib_a", | ||
hdrs = ["a.h"], | ||
) | ||
|
||
cc_library( | ||
name = "lib_b", | ||
hdrs = ["b.h"], | ||
) | ||
|
||
cc_library( | ||
name = "lib_c", | ||
hdrs = ["c.h"], | ||
) |
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 @@ | ||
// some content |
File renamed without changes.
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 @@ | ||
// some content |
Oops, something went wrong.