Added simple regression test for modularize.

llvm-svn: 177960
This commit is contained in:
John Thompson 2013-03-26 01:18:28 +00:00
parent a2de1088b7
commit 333ec6ceb7
11 changed files with 65 additions and 1 deletions

View File

@ -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"

View File

@ -0,0 +1,5 @@
// Declare a couple of functions - no modules problems.
void FuncOne();
int FuncTwo(int arg);

View File

@ -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;
};

View File

@ -0,0 +1,2 @@
// Same decl as in Header2.h.
typedef int TypeInt;

View File

@ -0,0 +1,2 @@
// Same decl as in Header1.h.
typedef int TypeInt;

View File

@ -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"

View File

@ -0,0 +1,3 @@
// Set up so the declaration in SubHeader.h is not defined.
#define SYMBOL2 1
#include "SubHeader.h"

View File

@ -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

View File

@ -0,0 +1,5 @@
# RUN: modularize %s -x c++
# RUN: modularize -prefix=%p %s -x c++
InputNoProblems/SomeTypes.h
InputNoProblems/SomeDecls.h

View File

@ -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

View File

@ -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