diff options
author | Julie Hockett <juliehockett@google.com> | 2018-05-11 21:08:59 +0000 |
---|---|---|
committer | Julie Hockett <juliehockett@google.com> | 2018-05-11 21:08:59 +0000 |
commit | f108a8fee10fb189faff4b2edbecbec8b6322a58 (patch) | |
tree | 2aff4c3438817a39992396a6db4dc983870e0b55 /clang-tools-extra/test/clang-tidy/fuchsia-restrict-system-includes.cpp | |
parent | 66a0b774937a616ee9f6dac4015263f8f7c83fc0 (diff) | |
download | bcm5719-llvm-f108a8fee10fb189faff4b2edbecbec8b6322a58.tar.gz bcm5719-llvm-f108a8fee10fb189faff4b2edbecbec8b6322a58.zip |
Reland "[clang-tidy] Adding RestrictSystemIncludes check to Fuchsia module"
This relands r332125 with a fixed test.
llvm-svn: 332141
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/fuchsia-restrict-system-includes.cpp')
-rw-r--r-- | clang-tools-extra/test/clang-tidy/fuchsia-restrict-system-includes.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/fuchsia-restrict-system-includes.cpp b/clang-tools-extra/test/clang-tidy/fuchsia-restrict-system-includes.cpp new file mode 100644 index 00000000000..e2ba71060c3 --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/fuchsia-restrict-system-includes.cpp @@ -0,0 +1,25 @@ +// RUN: %check_clang_tidy %s fuchsia-restrict-system-includes %t \ +// RUN: -- -config="{CheckOptions: [{key: fuchsia-restrict-system-includes.Includes, value: 's.h'}]}" \ +// RUN: -- -std=c++11 -I %S/Inputs/fuchsia-restrict-system-includes -isystem %S/Inputs/fuchsia-restrict-system-includes/system + +#include "a.h" + +#include <s.h> +#include <t.h> +// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: system include t.h not allowed +// CHECK-FIXES-NOT: #include <t.h> + +#include "s.h" +#include "t.h" +// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: system include t.h not allowed +// CHECK-FIXES-NOT: #include "t.h" + +#define foo <j.h> + +#include foo +// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: system include j.h not allowed +// CHECK-FIXES-NOT: #include foo + +#/* comment */ include /* comment */ foo +// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: system include j.h not allowed +// CHECK-FIXES-NOT: # /* comment */ include /* comment */ foo |