diff options
author | John Thompson <John.Thompson.JTSoftware@gmail.com> | 2013-09-18 18:19:43 +0000 |
---|---|---|
committer | John Thompson <John.Thompson.JTSoftware@gmail.com> | 2013-09-18 18:19:43 +0000 |
commit | 740839260b15c75ef1503683cac19c40e9bd1b66 (patch) | |
tree | 042862ea58573abe22e4698c751587220d3fd984 /clang-tools-extra/test | |
parent | 0742ce9cf7f6b1cb60db2cca9cb551b4b98bedf3 (diff) | |
download | bcm5719-llvm-740839260b15c75ef1503683cac19c40e9bd1b66.tar.gz bcm5719-llvm-740839260b15c75ef1503683cac19c40e9bd1b66.zip |
Check for #include in extern and namespace blocks.
llvm-svn: 190950
Diffstat (limited to 'clang-tools-extra/test')
5 files changed, 31 insertions, 0 deletions
diff --git a/clang-tools-extra/test/modularize/Inputs/Empty.h b/clang-tools-extra/test/modularize/Inputs/Empty.h new file mode 100644 index 00000000000..d74d27d937f --- /dev/null +++ b/clang-tools-extra/test/modularize/Inputs/Empty.h @@ -0,0 +1 @@ +// Empty header for testing #include directives in blocks. diff --git a/clang-tools-extra/test/modularize/Inputs/IncludeInExtern.h b/clang-tools-extra/test/modularize/Inputs/IncludeInExtern.h new file mode 100644 index 00000000000..da7de8faf2a --- /dev/null +++ b/clang-tools-extra/test/modularize/Inputs/IncludeInExtern.h @@ -0,0 +1,3 @@ +extern "C" { + #include "Empty.h" +} diff --git a/clang-tools-extra/test/modularize/Inputs/IncludeInNamespace.h b/clang-tools-extra/test/modularize/Inputs/IncludeInNamespace.h new file mode 100644 index 00000000000..212252882a1 --- /dev/null +++ b/clang-tools-extra/test/modularize/Inputs/IncludeInNamespace.h @@ -0,0 +1,3 @@ +namespace MyNamespace { + #include "Empty.h" +} diff --git a/clang-tools-extra/test/modularize/ProblemsExternC.modularize b/clang-tools-extra/test/modularize/ProblemsExternC.modularize new file mode 100644 index 00000000000..e16dcfdb62d --- /dev/null +++ b/clang-tools-extra/test/modularize/ProblemsExternC.modularize @@ -0,0 +1,12 @@ +# RUN: not modularize %s -x c++ 2>&1 | FileCheck %s + +Inputs/IncludeInExtern.h + +# CHECK: {{.*}}{{[/\\]}}Inputs{{[/\\]}}IncludeInExtern.h:2:3 +# CHECK-NEXT: #include "Empty.h" +# CHECK-NEXT: ^ +# CHECK-NEXT: error: Include directive within extern "C" {}. +# CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}IncludeInExtern.h:1:1 +# CHECK-NEXT: extern "C" { +# CHECK-NEXT: ^ +# CHECK-NEXT: The "extern "C" {}" block is here. diff --git a/clang-tools-extra/test/modularize/ProblemsNamespace.modularize b/clang-tools-extra/test/modularize/ProblemsNamespace.modularize new file mode 100644 index 00000000000..193402b966c --- /dev/null +++ b/clang-tools-extra/test/modularize/ProblemsNamespace.modularize @@ -0,0 +1,12 @@ +# RUN: not modularize %s -x c++ 2>&1 | FileCheck %s + +Inputs/IncludeInNamespace.h + +# CHECK: {{.*}}{{[/\\]}}Inputs{{[/\\]}}IncludeInNamespace.h:2:3 +# CHECK-NEXT: #include "Empty.h" +# CHECK-NEXT: ^ +# CHECK-NEXT: error: Include directive within namespace MyNamespace {}. +# CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}IncludeInNamespace.h:1:1 +# CHECK-NEXT: namespace MyNamespace { +# CHECK-NEXT: ^ +# CHECK-NEXT: The "namespace MyNamespace {}" block is here. |