diff options
author | John Thompson <John.Thompson.JTSoftware@gmail.com> | 2013-03-26 01:18:28 +0000 |
---|---|---|
committer | John Thompson <John.Thompson.JTSoftware@gmail.com> | 2013-03-26 01:18:28 +0000 |
commit | 0a0804049e8015f2ea069ada2c2f45c55efaaab5 (patch) | |
tree | e379efcc43cefe707a60ffe5f5bf2fe86c548197 /test/modularize | |
parent | 7adc7026d6da1f02447a4c30b44bf7e060653449 (diff) |
Added simple regression test for modularize.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@177960 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/modularize')
-rw-r--r-- | test/modularize/InputNoProblems/SomeDecls.h | 5 | ||||
-rw-r--r-- | test/modularize/InputNoProblems/SomeTypes.h | 16 | ||||
-rw-r--r-- | test/modularize/InputProblemsDuplicate/Header1.h | 2 | ||||
-rw-r--r-- | test/modularize/InputProblemsDuplicate/Header2.h | 2 | ||||
-rw-r--r-- | test/modularize/InputProblemsInconsistent/Header1.h | 4 | ||||
-rw-r--r-- | test/modularize/InputProblemsInconsistent/Header2.h | 3 | ||||
-rw-r--r-- | test/modularize/InputProblemsInconsistent/SubHeader.h | 11 | ||||
-rw-r--r-- | test/modularize/NoProblems.cpp | 5 | ||||
-rw-r--r-- | test/modularize/ProblemsDuplicate.cpp | 6 | ||||
-rw-r--r-- | test/modularize/ProblemsInconsistent.cpp | 10 |
10 files changed, 64 insertions, 0 deletions
diff --git a/test/modularize/InputNoProblems/SomeDecls.h b/test/modularize/InputNoProblems/SomeDecls.h new file mode 100644 index 00000000..af4d994d --- /dev/null +++ b/test/modularize/InputNoProblems/SomeDecls.h @@ -0,0 +1,5 @@ +// Declare a couple of functions - no modules problems. + +void FuncOne(); + +int FuncTwo(int arg); diff --git a/test/modularize/InputNoProblems/SomeTypes.h b/test/modularize/InputNoProblems/SomeTypes.h new file mode 100644 index 00000000..46c4316f --- /dev/null +++ b/test/modularize/InputNoProblems/SomeTypes.h @@ -0,0 +1,16 @@ +// Define a few different kinds of types - no modules problems. + +typedef int TypeInt; + +typedef TypeInt NestedTypeInt; + +struct TypeStruct { + int Member; +}; + +class TypeClass { +public: + TypeClass() : Member(0) {} +private: + int Member; +}; diff --git a/test/modularize/InputProblemsDuplicate/Header1.h b/test/modularize/InputProblemsDuplicate/Header1.h new file mode 100644 index 00000000..ad41bb13 --- /dev/null +++ b/test/modularize/InputProblemsDuplicate/Header1.h @@ -0,0 +1,2 @@ +// Same decl as in Header2.h. +typedef int TypeInt; diff --git a/test/modularize/InputProblemsDuplicate/Header2.h b/test/modularize/InputProblemsDuplicate/Header2.h new file mode 100644 index 00000000..938bb22f --- /dev/null +++ b/test/modularize/InputProblemsDuplicate/Header2.h @@ -0,0 +1,2 @@ +// Same decl as in Header1.h. +typedef int TypeInt; diff --git a/test/modularize/InputProblemsInconsistent/Header1.h b/test/modularize/InputProblemsInconsistent/Header1.h new file mode 100644 index 00000000..67629829 --- /dev/null +++ b/test/modularize/InputProblemsInconsistent/Header1.h @@ -0,0 +1,4 @@ +// Define symbol such that a declaration exists when this header +// is included, but not when Header2.h is included. +#define SYMBOL1 1 +#include "SubHeader.h" diff --git a/test/modularize/InputProblemsInconsistent/Header2.h b/test/modularize/InputProblemsInconsistent/Header2.h new file mode 100644 index 00000000..aa59ff91 --- /dev/null +++ b/test/modularize/InputProblemsInconsistent/Header2.h @@ -0,0 +1,3 @@ +// Set up so the declaration in SubHeader.h is not defined. +#define SYMBOL2 1 +#include "SubHeader.h" diff --git a/test/modularize/InputProblemsInconsistent/SubHeader.h b/test/modularize/InputProblemsInconsistent/SubHeader.h new file mode 100644 index 00000000..1395e489 --- /dev/null +++ b/test/modularize/InputProblemsInconsistent/SubHeader.h @@ -0,0 +1,11 @@ +// Set up so TypeInt only defined during Header1.h include. +#ifdef SYMBOL1 +#define SYMBOL 1 +#endif +#ifdef SYMBOL2 +#define SYMBOL 2 +#endif + +#if SYMBOL == 1 +typedef int TypeInt; +#endif diff --git a/test/modularize/NoProblems.cpp b/test/modularize/NoProblems.cpp new file mode 100644 index 00000000..ad0a314f --- /dev/null +++ b/test/modularize/NoProblems.cpp @@ -0,0 +1,5 @@ +# RUN: modularize %s -x c++ +# RUN: modularize -prefix=%p %s -x c++ + +InputNoProblems/SomeTypes.h +InputNoProblems/SomeDecls.h diff --git a/test/modularize/ProblemsDuplicate.cpp b/test/modularize/ProblemsDuplicate.cpp new file mode 100644 index 00000000..85a29bf4 --- /dev/null +++ b/test/modularize/ProblemsDuplicate.cpp @@ -0,0 +1,6 @@ +# RUN: modularize %s -x c++ 2>&1 | FileCheck %s + +InputProblemsDuplicate/Header1.h +InputProblemsDuplicate/Header2.h + +# CHECK: error: 'TypeInt' defined at both {{.*}}{{[/\\]}}InputProblemsDuplicate{{[/\\]}}Header1.h:2:13 and {{.*}}{{[/\\]}}InputProblemsDuplicate{{[/\\]}}Header2.h:2:13 diff --git a/test/modularize/ProblemsInconsistent.cpp b/test/modularize/ProblemsInconsistent.cpp new file mode 100644 index 00000000..d7960141 --- /dev/null +++ b/test/modularize/ProblemsInconsistent.cpp @@ -0,0 +1,10 @@ +# RUN: modularize %s -x c++ 2>&1 | FileCheck %s + +InputProblemsInconsistent/Header1.h +InputProblemsInconsistent/Header2.h + +# CHECK: error: 'SYMBOL' defined at both {{.*}}{{[/\\]}}InputProblemsInconsistent{{[/\\]}}SubHeader.h:3:9 and {{.*}}{{[/\\]}}InputProblemsInconsistent/SubHeader.h:6:9 +# CHECK-NEXT: error: header '{{.*}}{{[/\\]}}InputProblemsInconsistent{{[/\\]}}SubHeader.h' has different contents dependening on how it was included +# CHECK-NEXT: note: 'SYMBOL' in {{.*}}{{[/\\]}}InputProblemsInconsistent{{[/\\]}}SubHeader.h at 3:9 not always provided +# CHECK-NEXT: note: 'SYMBOL' in {{.*}}{{[/\\]}}InputProblemsInconsistent{{[/\\]}}SubHeader.h at 6:9 not always provided +# CHECK-NEXT: note: 'TypeInt' in {{.*}}{{[/\\]}}InputProblemsInconsistent{{[/\\]}}SubHeader.h at 10:13 not always provided |