[clang-tools-extra] r177960 - Added simple regression test for modularize.

Richard Smith richard at metafoo.co.uk
Mon Mar 25 18:32:57 PDT 2013


On Mon, Mar 25, 2013 at 6:18 PM, John Thompson <
John.Thompson.JTSoftware at gmail.com> wrote:

> Author: jtsoftware
> Date: Mon Mar 25 20:18:28 2013
> New Revision: 177960
>
> URL: http://llvm.org/viewvc/llvm-project?rev=177960&view=rev
> Log:
> Added simple regression test for modularize.
>
> Added:
>     clang-tools-extra/trunk/test/modularize/
>     clang-tools-extra/trunk/test/modularize/InputNoProblems/
>     clang-tools-extra/trunk/test/modularize/InputNoProblems/SomeDecls.h
>     clang-tools-extra/trunk/test/modularize/InputNoProblems/SomeTypes.h
>     clang-tools-extra/trunk/test/modularize/InputProblemsDuplicate/
>
> clang-tools-extra/trunk/test/modularize/InputProblemsDuplicate/Header1.h
>
> clang-tools-extra/trunk/test/modularize/InputProblemsDuplicate/Header2.h
>     clang-tools-extra/trunk/test/modularize/InputProblemsInconsistent/
>
> clang-tools-extra/trunk/test/modularize/InputProblemsInconsistent/Header1.h
>
> clang-tools-extra/trunk/test/modularize/InputProblemsInconsistent/Header2.h
>
> clang-tools-extra/trunk/test/modularize/InputProblemsInconsistent/SubHeader.h
>

Please move these to a subdirectory named exactly "Inputs".


>     clang-tools-extra/trunk/test/modularize/NoProblems.cpp
>     clang-tools-extra/trunk/test/modularize/ProblemsDuplicate.cpp
>     clang-tools-extra/trunk/test/modularize/ProblemsInconsistent.cpp
>

Please give these files an extension other than .cpp -- they aren't C++!
You can set the extensions which lit will look at in test/lit.cfg.


> Modified:
>     clang-tools-extra/trunk/test/CMakeLists.txt
>
> Modified: clang-tools-extra/trunk/test/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/CMakeLists.txt?rev=177960&r1=177959&r2=177960&view=diff
>
> ==============================================================================
> --- clang-tools-extra/trunk/test/CMakeLists.txt (original)
> +++ clang-tools-extra/trunk/test/CMakeLists.txt Mon Mar 25 20:18:28 2013
> @@ -22,7 +22,7 @@ set(CLANG_TOOLS_TEST_DEPS
>    clang clang-headers FileCheck count not
>
>    # Individual tools we test.
> -  remove-cstr-calls cpp11-migrate
> +  remove-cstr-calls cpp11-migrate modularize
>    )
>
>  add_lit_testsuite(check-clang-tools "Running the Clang extra tools'
> regression tests"
>
> Added: clang-tools-extra/trunk/test/modularize/InputNoProblems/SomeDecls.h
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/modularize/InputNoProblems/SomeDecls.h?rev=177960&view=auto
>
> ==============================================================================
> --- clang-tools-extra/trunk/test/modularize/InputNoProblems/SomeDecls.h
> (added)
> +++ clang-tools-extra/trunk/test/modularize/InputNoProblems/SomeDecls.h
> Mon Mar 25 20:18:28 2013
> @@ -0,0 +1,5 @@
> +// Declare a couple of functions - no modules problems.
> +
> +void FuncOne();
> +
> +int FuncTwo(int arg);
>
> Added: clang-tools-extra/trunk/test/modularize/InputNoProblems/SomeTypes.h
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/modularize/InputNoProblems/SomeTypes.h?rev=177960&view=auto
>
> ==============================================================================
> --- clang-tools-extra/trunk/test/modularize/InputNoProblems/SomeTypes.h
> (added)
> +++ clang-tools-extra/trunk/test/modularize/InputNoProblems/SomeTypes.h
> Mon Mar 25 20:18:28 2013
> @@ -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;
> +};
>
> Added:
> clang-tools-extra/trunk/test/modularize/InputProblemsDuplicate/Header1.h
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/modularize/InputProblemsDuplicate/Header1.h?rev=177960&view=auto
>
> ==============================================================================
> ---
> clang-tools-extra/trunk/test/modularize/InputProblemsDuplicate/Header1.h
> (added)
> +++
> clang-tools-extra/trunk/test/modularize/InputProblemsDuplicate/Header1.h
> Mon Mar 25 20:18:28 2013
> @@ -0,0 +1,2 @@
> +// Same decl as in Header2.h.
> +typedef int TypeInt;
>
> Added:
> clang-tools-extra/trunk/test/modularize/InputProblemsDuplicate/Header2.h
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/modularize/InputProblemsDuplicate/Header2.h?rev=177960&view=auto
>
> ==============================================================================
> ---
> clang-tools-extra/trunk/test/modularize/InputProblemsDuplicate/Header2.h
> (added)
> +++
> clang-tools-extra/trunk/test/modularize/InputProblemsDuplicate/Header2.h
> Mon Mar 25 20:18:28 2013
> @@ -0,0 +1,2 @@
> +// Same decl as in Header1.h.
> +typedef int TypeInt;
>
> Added:
> clang-tools-extra/trunk/test/modularize/InputProblemsInconsistent/Header1.h
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/modularize/InputProblemsInconsistent/Header1.h?rev=177960&view=auto
>
> ==============================================================================
> ---
> clang-tools-extra/trunk/test/modularize/InputProblemsInconsistent/Header1.h
> (added)
> +++
> clang-tools-extra/trunk/test/modularize/InputProblemsInconsistent/Header1.h
> Mon Mar 25 20:18:28 2013
> @@ -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"
>
> Added:
> clang-tools-extra/trunk/test/modularize/InputProblemsInconsistent/Header2.h
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/modularize/InputProblemsInconsistent/Header2.h?rev=177960&view=auto
>
> ==============================================================================
> ---
> clang-tools-extra/trunk/test/modularize/InputProblemsInconsistent/Header2.h
> (added)
> +++
> clang-tools-extra/trunk/test/modularize/InputProblemsInconsistent/Header2.h
> Mon Mar 25 20:18:28 2013
> @@ -0,0 +1,3 @@
> +// Set up so the declaration in SubHeader.h is not defined.
> +#define SYMBOL2 1
> +#include "SubHeader.h"
>
> Added:
> clang-tools-extra/trunk/test/modularize/InputProblemsInconsistent/SubHeader.h
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/modularize/InputProblemsInconsistent/SubHeader.h?rev=177960&view=auto
>
> ==============================================================================
> ---
> clang-tools-extra/trunk/test/modularize/InputProblemsInconsistent/SubHeader.h
> (added)
> +++
> clang-tools-extra/trunk/test/modularize/InputProblemsInconsistent/SubHeader.h
> Mon Mar 25 20:18:28 2013
> @@ -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
>
> Added: clang-tools-extra/trunk/test/modularize/NoProblems.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/modularize/NoProblems.cpp?rev=177960&view=auto
>
> ==============================================================================
> --- clang-tools-extra/trunk/test/modularize/NoProblems.cpp (added)
> +++ clang-tools-extra/trunk/test/modularize/NoProblems.cpp Mon Mar 25
> 20:18:28 2013
> @@ -0,0 +1,5 @@
> +# RUN: modularize %s -x c++
> +# RUN: modularize -prefix=%p %s -x c++
> +
> +InputNoProblems/SomeTypes.h
> +InputNoProblems/SomeDecls.h
>
> Added: clang-tools-extra/trunk/test/modularize/ProblemsDuplicate.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/modularize/ProblemsDuplicate.cpp?rev=177960&view=auto
>
> ==============================================================================
> --- clang-tools-extra/trunk/test/modularize/ProblemsDuplicate.cpp (added)
> +++ clang-tools-extra/trunk/test/modularize/ProblemsDuplicate.cpp Mon Mar
> 25 20:18:28 2013
> @@ -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
>
> Added: clang-tools-extra/trunk/test/modularize/ProblemsInconsistent.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/modularize/ProblemsInconsistent.cpp?rev=177960&view=auto
>
> ==============================================================================
> --- clang-tools-extra/trunk/test/modularize/ProblemsInconsistent.cpp
> (added)
> +++ clang-tools-extra/trunk/test/modularize/ProblemsInconsistent.cpp Mon
> Mar 25 20:18:28 2013
> @@ -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
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130325/61f6b154/attachment.html>


More information about the cfe-commits mailing list