Move unittest helpers to a shared location

Summary:
unittests/AST/Language.h defines some helpers that we would like to
reuse in other tests, for example, in tests for syntax trees.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: mgorny, martong, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D80792
This commit is contained in:
Dmitri Gribenko 2020-05-29 16:47:23 +02:00
parent 16506d7890
commit 0e265e3157
9 changed files with 25 additions and 15 deletions

View File

@ -1,4 +1,4 @@
//===------ unittest/AST/Language.h - AST unit test support ---------------===//
//===--- CommandLineArgs.h ------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@ -6,15 +6,15 @@
//
//===----------------------------------------------------------------------===//
//
// This file defines language options for AST unittests.
// This file defines language options for Clang unittests.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_UNITTESTS_AST_LANGUAGE_H
#define LLVM_CLANG_UNITTESTS_AST_LANGUAGE_H
#ifndef LLVM_CLANG_TESTING_COMMANDLINEARGS_H
#define LLVM_CLANG_TESTING_COMMANDLINEARGS_H
#include <vector>
#include <string>
#include <vector>
namespace clang {

View File

@ -152,6 +152,12 @@ module Clang_StaticAnalyzer_Frontend {
module * { export * }
}
module Clang_Testing {
requires cplusplus
umbrella "Testing"
module * { export * }
}
module Clang_Tooling {
requires cplusplus umbrella "Tooling" module * { export * }
// FIXME: Exclude these headers to avoid pulling all of the AST matchers

View File

@ -24,3 +24,4 @@ if(CLANG_ENABLE_STATIC_ANALYZER)
add_subdirectory(StaticAnalyzer)
endif()
add_subdirectory(Format)
add_subdirectory(Testing)

View File

@ -0,0 +1,7 @@
set(LLVM_LINK_COMPONENTS
Support
)
add_clang_library(clangTesting
CommandLineArgs.cpp
)

View File

@ -1,16 +1,12 @@
//===------ unittest/AST/Language.cpp - AST unit test support -------------===//
//===--- CommandLineArgs.cpp ----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file defines language options for AST unittests.
//
//===----------------------------------------------------------------------===//
#include "Language.h"
#include "clang/Testing/CommandLineArgs.h"
#include "llvm/Support/ErrorHandling.h"
namespace clang {

View File

@ -19,11 +19,11 @@
#include "clang/AST/ASTImporter.h"
#include "clang/AST/ASTImporterSharedState.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/Testing/CommandLineArgs.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "DeclMatcher.h"
#include "Language.h"
#include <sstream>

View File

@ -26,7 +26,6 @@ add_clang_unittest(ASTTests
DeclTest.cpp
EvaluateAsRValueTest.cpp
ExternalASTSourceTest.cpp
Language.cpp
NamedDeclPrinterTest.cpp
RecursiveASTVisitorTest.cpp
SizelessTypesTest.cpp
@ -42,6 +41,7 @@ clang_target_link_libraries(ASTTests
clangBasic
clangFrontend
clangSerialization
clangTesting
clangTooling
)

View File

@ -21,8 +21,8 @@
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/Testing/CommandLineArgs.h"
#include "clang/Tooling/Tooling.h"
#include "Language.h"
#include "gtest/gtest.h"
namespace clang {

View File

@ -2,10 +2,10 @@
#include "clang/AST/ASTStructuralEquivalence.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/Testing/CommandLineArgs.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/Support/Host.h"
#include "Language.h"
#include "DeclMatcher.h"
#include "gtest/gtest.h"