Index: llvm/utils/gn/secondary/clang/lib/ASTMatchers/Dynamic/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/lib/ASTMatchers/Dynamic/BUILD.gn @@ -0,0 +1,18 @@ +static_library("Dynamic") { + output_name = "clangDynamicASTMatchers" + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + "//clang/lib/AST", + "//clang/lib/ASTMatchers", + "//clang/lib/Basic", + "//llvm/lib/Support", + ] + sources = [ + "Diagnostics.cpp", + "Parser.cpp", + "Registry.cpp", + "VariantValue.cpp", + ] + + # FIXME: if msvc cflags += /bigobj +} Index: llvm/utils/gn/secondary/clang/test/BUILD.gn =================================================================== --- llvm/utils/gn/secondary/clang/test/BUILD.gn +++ llvm/utils/gn/secondary/clang/test/BUILD.gn @@ -125,6 +125,7 @@ "//clang/tools/clang-rename", "//clang/tools/diagtool", "//clang/tools/driver:symlinks", + "//clang/unittests", "//clang/utils/TableGen:clang-tblgen", "//clang/utils/hmaptool", "//llvm/tools/llc", @@ -159,7 +160,6 @@ ] } - # FIXME: dep on "//clang/unittests" once it exists # FIXME: clang_build_examples testonly = true } Index: llvm/utils/gn/secondary/clang/unittests/AST/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/unittests/AST/BUILD.gn @@ -0,0 +1,36 @@ +executable("ASTTests") { + # test/Unit/lit.cfg expects unittests in CLANG_BINARY_DIR/unittest + output_dir = target_out_dir + + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + "//clang/lib/AST", + "//clang/lib/ASTMatchers", + "//clang/lib/Analysis", + "//clang/lib/Basic", + "//clang/lib/Frontend", + "//clang/lib/Tooling", + "//llvm/lib/Support", + "//llvm/utils/unittest/UnitTestMain", + ] + sources = [ + "ASTContextParentMapTest.cpp", + "ASTImporterTest.cpp", + "ASTTypeTraitsTest.cpp", + "ASTVectorTest.cpp", + "CommentLexer.cpp", + "CommentParser.cpp", + "CommentTextTest.cpp", + "DataCollectionTest.cpp", + "DeclPrinterTest.cpp", + "DeclTest.cpp", + "EvaluateAsRValueTest.cpp", + "ExternalASTSourceTest.cpp", + "Language.cpp", + "NamedDeclPrinterTest.cpp", + "SourceLocationTest.cpp", + "StmtPrinterTest.cpp", + "StructuralEquivalenceTest.cpp", + ] + testonly = true +} Index: llvm/utils/gn/secondary/clang/unittests/ASTMatchers/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/unittests/ASTMatchers/BUILD.gn @@ -0,0 +1,22 @@ +executable("ASTMatchersTests") { + # test/Unit/lit.cfg expects unittests in CLANG_BINARY_DIR/unittest + output_dir = target_out_dir + + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + "//clang/lib/AST", + "//clang/lib/ASTMatchers", + "//clang/lib/Basic", + "//clang/lib/Frontend", + "//clang/lib/Tooling", + "//llvm/lib/Support", + "//llvm/utils/unittest/UnitTestMain", + ] + sources = [ + "ASTMatchersInternalTest.cpp", + "ASTMatchersNarrowingTest.cpp", + "ASTMatchersNodeTest.cpp", + "ASTMatchersTraversalTest.cpp", + ] + testonly = true +} Index: llvm/utils/gn/secondary/clang/unittests/ASTMatchers/Dynamic/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/unittests/ASTMatchers/Dynamic/BUILD.gn @@ -0,0 +1,22 @@ +executable("DynamicASTMatchersTests") { + # test/Unit/lit.cfg expects unittests in CLANG_BINARY_DIR/unittest + output_dir = target_out_dir + + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + "//clang/lib/AST", + "//clang/lib/ASTMatchers", + "//clang/lib/ASTMatchers/Dynamic", + "//clang/lib/Basic", + "//clang/lib/Frontend", + "//clang/lib/Tooling", + "//llvm/lib/Support", + "//llvm/utils/unittest/UnitTestMain", + ] + sources = [ + "ParserTest.cpp", + "RegistryTest.cpp", + "VariantValueTest.cpp", + ] + testonly = true +} Index: llvm/utils/gn/secondary/clang/unittests/Analysis/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/unittests/Analysis/BUILD.gn @@ -0,0 +1,22 @@ +executable("ClangAnalysisTests") { + # test/Unit/lit.cfg expects unittests in CLANG_BINARY_DIR/unittest + output_dir = target_out_dir + + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + "//clang/lib/AST", + "//clang/lib/ASTMatchers", + "//clang/lib/Analysis", + "//clang/lib/Basic", + "//clang/lib/Frontend", + "//clang/lib/Tooling", + "//llvm/lib/Support", + "//llvm/utils/unittest/UnitTestMain", + ] + sources = [ + "CFGTest.cpp", + "CloneDetectionTest.cpp", + "ExprMutationAnalyzerTest.cpp", + ] + testonly = true +} Index: llvm/utils/gn/secondary/clang/unittests/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/unittests/BUILD.gn @@ -0,0 +1,35 @@ +import("//clang/lib/StaticAnalyzer/Frontend/enable.gni") + +group("unittests") { + deps = [ + "AST:ASTTests", + "ASTMatchers:ASTMatchersTests", + "ASTMatchers/Dynamic:DynamicASTMatchersTests", + "Basic:BasicTests", + "CodeGen:ClangCodeGenTests", + "CrossTU:CrossTUTests", + "Driver:ClangDriverTests", + "Format:FormatTests", + "Index:IndexTests", + "Lex:LexTests", + "Rename:ClangRenameTests", + "Rewrite:RewriteTests", + "Sema:SemaTests", + "Tooling:ToolingTests", + ] + if (clang_enable_static_analyzer) { + deps += [ + "Analysis:ClangAnalysisTests", + "Frontend:FrontendTests", + "StaticAnalyzer:StaticAnalysisTests", + ] + } + if (host_os != "win") { + # FIXME: libclang unit tests are disabled on Windows due + # to failures, mostly in libclang.VirtualFileOverlay_*. + # FIXME: Also, the executable can't find libclang.dll since that's + # in a different directory. + deps += [ "libclang:libclangTests" ] + } + testonly = true +} Index: llvm/utils/gn/secondary/clang/unittests/Basic/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/unittests/Basic/BUILD.gn @@ -0,0 +1,21 @@ +executable("BasicTests") { + # test/Unit/lit.cfg expects unittests in CLANG_BINARY_DIR/unittest + output_dir = target_out_dir + + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + "//clang/lib/Basic", + "//clang/lib/Lex", + "//llvm/lib/Support", + "//llvm/utils/unittest/UnitTestMain", + ] + sources = [ + "CharInfoTest.cpp", + "DiagnosticTest.cpp", + "FileManagerTest.cpp", + "FixedPointTest.cpp", + "MemoryBufferCacheTest.cpp", + "SourceManagerTest.cpp", + ] + testonly = true +} Index: llvm/utils/gn/secondary/clang/unittests/CodeGen/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/unittests/CodeGen/BUILD.gn @@ -0,0 +1,24 @@ +executable("ClangCodeGenTests") { + # test/Unit/lit.cfg expects unittests in CLANG_BINARY_DIR/unittest + output_dir = target_out_dir + + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + "//clang/lib/AST", + "//clang/lib/Basic", + "//clang/lib/CodeGen", + "//clang/lib/Frontend", + "//clang/lib/Lex", + "//clang/lib/Parse", + "//llvm/lib/IR", + "//llvm/lib/Support", + "//llvm/utils/unittest/UnitTestMain", + ] + sources = [ + "BufferSourceTest.cpp", + "CodeGenExternalTest.cpp", + "IncrementalProcessingTest.cpp", + "TBAAMetadataTest.cpp", + ] + testonly = true +} Index: llvm/utils/gn/secondary/clang/unittests/CrossTU/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/unittests/CrossTU/BUILD.gn @@ -0,0 +1,20 @@ +executable("CrossTUTests") { + # test/Unit/lit.cfg expects unittests in CLANG_BINARY_DIR/unittest + output_dir = target_out_dir + + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + "//clang/lib/AST", + "//clang/lib/Basic", + "//clang/lib/CrossTU", + "//clang/lib/Frontend", + "//clang/lib/Tooling", + "//llvm/lib/Support", + "//llvm/lib/Target:TargetsToBuild", + "//llvm/utils/unittest/UnitTestMain", + ] + sources = [ + "CrossTranslationUnitTest.cpp", + ] + testonly = true +} Index: llvm/utils/gn/secondary/clang/unittests/Driver/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/unittests/Driver/BUILD.gn @@ -0,0 +1,21 @@ +executable("ClangDriverTests") { + # test/Unit/lit.cfg expects unittests in CLANG_BINARY_DIR/unittest + output_dir = target_out_dir + + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + "//clang/lib/Basic", + "//clang/lib/Driver", + "//llvm/lib/Option", + "//llvm/lib/Support", + "//llvm/lib/Target:TargetsToBuild", + "//llvm/utils/unittest/UnitTestMain", + ] + sources = [ + "DistroTest.cpp", + "ModuleCacheTest.cpp", + "MultilibTest.cpp", + "ToolChainTest.cpp", + ] + testonly = true +} Index: llvm/utils/gn/secondary/clang/unittests/Format/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/unittests/Format/BUILD.gn @@ -0,0 +1,34 @@ +executable("FormatTests") { + # test/Unit/lit.cfg expects unittests in CLANG_BINARY_DIR/unittest + output_dir = target_out_dir + + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + "//clang/lib/Basic", + "//clang/lib/Format", + "//clang/lib/Frontend", + "//clang/lib/Rewrite", + "//clang/lib/Tooling/Core", + "//llvm/lib/Support", + "//llvm/utils/unittest/UnitTestMain", + ] + sources = [ + "CleanupTest.cpp", + "FormatTest.cpp", + "FormatTestComments.cpp", + "FormatTestJS.cpp", + "FormatTestJava.cpp", + "FormatTestObjC.cpp", + "FormatTestProto.cpp", + "FormatTestRawStrings.cpp", + "FormatTestSelective.cpp", + "FormatTestTableGen.cpp", + "FormatTestTextProto.cpp", + "NamespaceEndCommentsFixerTest.cpp", + "SortImportsTestJS.cpp", + "SortImportsTestJava.cpp", + "SortIncludesTest.cpp", + "UsingDeclarationsSorterTest.cpp", + ] + testonly = true +} Index: llvm/utils/gn/secondary/clang/unittests/Frontend/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/unittests/Frontend/BUILD.gn @@ -0,0 +1,28 @@ +executable("FrontendTests") { + # test/Unit/lit.cfg expects unittests in CLANG_BINARY_DIR/unittest + output_dir = target_out_dir + + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + "//clang/lib/AST", + "//clang/lib/Basic", + "//clang/lib/CodeGen", + "//clang/lib/Frontend", + "//clang/lib/FrontendTool", + "//clang/lib/Lex", + "//clang/lib/Sema", + "//llvm/lib/Support", + "//llvm/utils/unittest/UnitTestMain", + ] + sources = [ + "ASTUnitTest.cpp", + "CodeGenActionTest.cpp", + "CompilerInstanceTest.cpp", + "FixedPointString.cpp", + "FrontendActionTest.cpp", + "OutputStreamTest.cpp", + "PCHPreambleTest.cpp", + "ParsedSourceLocationTest.cpp", + ] + testonly = true +} Index: llvm/utils/gn/secondary/clang/unittests/Index/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/unittests/Index/BUILD.gn @@ -0,0 +1,21 @@ +executable("IndexTests") { + # test/Unit/lit.cfg expects unittests in CLANG_BINARY_DIR/unittest + output_dir = target_out_dir + + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + "//clang/lib/AST", + "//clang/lib/Basic", + "//clang/lib/Frontend", + "//clang/lib/Index", + "//clang/lib/Lex", + "//clang/lib/Serialization", + "//clang/lib/Tooling", + "//llvm/lib/Support", + "//llvm/utils/unittest/UnitTestMain", + ] + sources = [ + "IndexTests.cpp", + ] + testonly = true +} Index: llvm/utils/gn/secondary/clang/unittests/Lex/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/unittests/Lex/BUILD.gn @@ -0,0 +1,23 @@ +executable("LexTests") { + # test/Unit/lit.cfg expects unittests in CLANG_BINARY_DIR/unittest + output_dir = target_out_dir + + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + "//clang/lib/AST", + "//clang/lib/Basic", + "//clang/lib/Lex", + "//clang/lib/Parse", + "//clang/lib/Sema", + "//llvm/lib/Support", + "//llvm/utils/unittest/UnitTestMain", + ] + sources = [ + "HeaderMapTest.cpp", + "HeaderSearchTest.cpp", + "LexerTest.cpp", + "PPCallbacksTest.cpp", + "PPConditionalDirectiveRecordTest.cpp", + ] + testonly = true +} Index: llvm/utils/gn/secondary/clang/unittests/Rename/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/unittests/Rename/BUILD.gn @@ -0,0 +1,31 @@ +executable("ClangRenameTests") { + # test/Unit/lit.cfg expects unittests in CLANG_BINARY_DIR/unittest + output_dir = target_out_dir + + configs += [ "//llvm/utils/gn/build:clang_code" ] + + # We'd like clang/unittests/Tooling/RewriterTestContext.h in the test. + include_dirs = [ "../.." ] + + deps = [ + "//clang/lib/AST", + "//clang/lib/ASTMatchers", + "//clang/lib/Basic", + "//clang/lib/Format", + "//clang/lib/Frontend", + "//clang/lib/Rewrite", + "//clang/lib/Tooling", + "//clang/lib/Tooling/Core", + "//clang/lib/Tooling/Refactoring", + "//llvm/lib/Support", + "//llvm/utils/unittest/UnitTestMain", + ] + sources = [ + "RenameAliasTest.cpp", + "RenameClassTest.cpp", + "RenameEnumTest.cpp", + "RenameFunctionTest.cpp", + "RenameMemberTest.cpp", + ] + testonly = true +} Index: llvm/utils/gn/secondary/clang/unittests/Rewrite/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/unittests/Rewrite/BUILD.gn @@ -0,0 +1,15 @@ +executable("RewriteTests") { + # test/Unit/lit.cfg expects unittests in CLANG_BINARY_DIR/unittest + output_dir = target_out_dir + + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + "//clang/lib/Rewrite", + "//llvm/lib/Support", + "//llvm/utils/unittest/UnitTestMain", + ] + sources = [ + "RewriteBufferTest.cpp", + ] + testonly = true +} Index: llvm/utils/gn/secondary/clang/unittests/Sema/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/unittests/Sema/BUILD.gn @@ -0,0 +1,21 @@ +executable("SemaTests") { + # test/Unit/lit.cfg expects unittests in CLANG_BINARY_DIR/unittest + output_dir = target_out_dir + + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + "//clang/lib/AST", + "//clang/lib/Basic", + "//clang/lib/Frontend", + "//clang/lib/Parse", + "//clang/lib/Sema", + "//clang/lib/Tooling", + "//llvm/lib/Support", + "//llvm/utils/unittest/UnitTestMain", + ] + sources = [ + "CodeCompleteTest.cpp", + "ExternalSemaSourceTest.cpp", + ] + testonly = true +} Index: llvm/utils/gn/secondary/clang/unittests/StaticAnalyzer/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/unittests/StaticAnalyzer/BUILD.gn @@ -0,0 +1,20 @@ +executable("StaticAnalysisTests") { + # test/Unit/lit.cfg expects unittests in CLANG_BINARY_DIR/unittest + output_dir = target_out_dir + + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + "//clang/lib/Analysis", + "//clang/lib/Basic", + "//clang/lib/StaticAnalyzer/Core", + "//clang/lib/StaticAnalyzer/Frontend", + "//clang/lib/Tooling", + "//llvm/lib/Support", + "//llvm/utils/unittest/UnitTestMain", + ] + sources = [ + "AnalyzerOptionsTest.cpp", + "RegisterCustomCheckersTest.cpp", + ] + testonly = true +} Index: llvm/utils/gn/secondary/clang/unittests/Tooling/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/unittests/Tooling/BUILD.gn @@ -0,0 +1,64 @@ +executable("ToolingTests") { + # test/Unit/lit.cfg expects unittests in CLANG_BINARY_DIR/unittest + output_dir = target_out_dir + + configs += [ "//llvm/utils/gn/build:clang_code" ] + include_dirs = [ "." ] + deps = [ + "//clang/lib/AST", + "//clang/lib/ASTMatchers", + "//clang/lib/Basic", + "//clang/lib/Format", + "//clang/lib/Frontend", + "//clang/lib/Lex", + "//clang/lib/Rewrite", + "//clang/lib/Tooling", + "//clang/lib/Tooling/Core", + "//clang/lib/Tooling/Refactoring", + "//llvm/lib/Support", + "//llvm/lib/Target:TargetsToBuild", + "//llvm/utils/unittest/UnitTestMain", + ] + sources = [ + "ASTSelectionTest.cpp", + "CastExprTest.cpp", + "CommentHandlerTest.cpp", + "CompilationDatabaseTest.cpp", + "DiagnosticsYamlTest.cpp", + "ExecutionTest.cpp", + "FixItTest.cpp", + "HeaderIncludesTest.cpp", + "LexicallyOrderedRecursiveASTVisitorTest.cpp", + "LookupTest.cpp", + "QualTypeNamesTest.cpp", + "RecursiveASTVisitorTestDeclVisitor.cpp", + "RecursiveASTVisitorTestPostOrderVisitor.cpp", + "RecursiveASTVisitorTestTypeLocVisitor.cpp", + "RecursiveASTVisitorTests/Attr.cpp", + "RecursiveASTVisitorTests/CXXBoolLiteralExpr.cpp", + "RecursiveASTVisitorTests/CXXMemberCall.cpp", + "RecursiveASTVisitorTests/CXXOperatorCallExprTraverser.cpp", + "RecursiveASTVisitorTests/Class.cpp", + "RecursiveASTVisitorTests/ConstructExpr.cpp", + "RecursiveASTVisitorTests/DeclRefExpr.cpp", + "RecursiveASTVisitorTests/ImplicitCtor.cpp", + "RecursiveASTVisitorTests/InitListExprPostOrder.cpp", + "RecursiveASTVisitorTests/InitListExprPostOrderNoQueue.cpp", + "RecursiveASTVisitorTests/InitListExprPreOrder.cpp", + "RecursiveASTVisitorTests/InitListExprPreOrderNoQueue.cpp", + "RecursiveASTVisitorTests/IntegerLiteral.cpp", + "RecursiveASTVisitorTests/LambdaDefaultCapture.cpp", + "RecursiveASTVisitorTests/LambdaExpr.cpp", + "RecursiveASTVisitorTests/NestedNameSpecifiers.cpp", + "RecursiveASTVisitorTests/ParenExpr.cpp", + "RecursiveASTVisitorTests/TemplateArgumentLocTraverser.cpp", + "RecursiveASTVisitorTests/TraversalScope.cpp", + "RefactoringActionRulesTest.cpp", + "RefactoringCallbacksTest.cpp", + "RefactoringTest.cpp", + "ReplacementsYamlTest.cpp", + "RewriterTest.cpp", + "ToolingTest.cpp", + ] + testonly = true +} Index: llvm/utils/gn/secondary/clang/unittests/libclang/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/clang/unittests/libclang/BUILD.gn @@ -0,0 +1,17 @@ +executable("libclangTests") { + # test/Unit/lit.cfg expects unittests in CLANG_BINARY_DIR/unittest + output_dir = target_out_dir + + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + "//clang/tools/libclang", + "//llvm/utils/unittest/UnitTestMain", + ] + sources = [ + "LibclangTest.cpp", + ] + if (host_os == "mac") { + ldflags = [ "-Wl,-rpath," + rebase_path("$root_out_dir/lib") ] + } + testonly = true +}