mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-23 22:00:10 +00:00
[test] Split out Annotations from TestingSupport
The Annotations helper class does not have a gtest or gmock dependency, but because it's bundled with the rest of TestingSupport, it gets one. By splitting it out, a target can use it without being forced to use LLVM's copy of gtest. Reviewed By: GMNGeoffrey, sammccall, gribozavr2 Differential Revision: https://reviews.llvm.org/D141175
This commit is contained in:
parent
cfa5fd4849
commit
3432f4bf86
@ -5,7 +5,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
// A clangd-specific version of llvm/Testing/Support/Annotations.h, replaces
|
||||
// A clangd-specific version of llvm/Testing/Annotations/Annotations.h, replaces
|
||||
// offsets and offset-based ranges with types from the LSP protocol.
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_UNITTESTS_ANNOTATIONS_H
|
||||
|
||||
#include "Protocol.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
|
||||
namespace clang {
|
||||
namespace clangd {
|
||||
|
@ -5,7 +5,12 @@ set(LLVM_LINK_COMPONENTS
|
||||
)
|
||||
|
||||
if(CLANG_BUILT_STANDALONE)
|
||||
# LLVMTestingSupport library is needed for clangd tests.
|
||||
# LLVMTestingSupport and LLVMTestingAnnotations are needed for clangd tests.
|
||||
if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Annotations
|
||||
AND NOT TARGET LLVMTestingAnnotations)
|
||||
add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Annotations
|
||||
lib/Testing/Annotations)
|
||||
endif()
|
||||
if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
|
||||
AND NOT TARGET LLVMTestingSupport)
|
||||
add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
|
||||
@ -162,6 +167,7 @@ target_link_libraries(ClangdTests
|
||||
clangDaemon
|
||||
clangdSupport
|
||||
clangTidy
|
||||
LLVMTestingAnnotations
|
||||
LLVMTestingSupport
|
||||
)
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "llvm/Testing/Support/Error.h"
|
||||
#include "llvm/Testing/Support/SupportHelpers.h"
|
||||
#include "gmock/gmock.h"
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <initializer_list>
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "clang/Basic/TokenKinds.h"
|
||||
#include "clang/Format/Format.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "llvm/Testing/Support/Error.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "index/Index.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <memory>
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/Support/ScopedPrinter.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <cstddef>
|
||||
|
@ -31,6 +31,7 @@ target_link_libraries(ClangIncludeCleanerTests
|
||||
PRIVATE
|
||||
clangIncludeCleaner
|
||||
clangTesting
|
||||
LLVMTestingAnnotations
|
||||
LLVMTestingSupport
|
||||
)
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "clang/Testing/TestAST.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <memory>
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "clang/Testing/TestAST.h"
|
||||
#include "clang/Tooling/Inclusions/StandardLibrary.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <cstddef>
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "clang/Testing/TestAST.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/ScopedPrinter.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <cstddef>
|
||||
#include <unordered_map>
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "clang-pseudo/Bracket.h"
|
||||
#include "clang-pseudo/Token.h"
|
||||
#include "clang/Basic/LangOptions.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
@ -26,5 +26,6 @@ target_link_libraries(ClangPseudoTests
|
||||
clangPseudo
|
||||
clangPseudoCXX
|
||||
clangPseudoGrammar
|
||||
LLVMTestingAnnotations
|
||||
LLVMTestingSupport
|
||||
)
|
||||
|
@ -57,5 +57,6 @@ target_link_libraries(ClangTidyTests
|
||||
clangTidyObjCModule
|
||||
clangTidyReadabilityModule
|
||||
clangTidyUtils
|
||||
LLVMTestingAnnotations
|
||||
LLVMTestingSupport
|
||||
)
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "ClangTidyDiagnosticConsumer.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Support/ScopedPrinter.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <optional>
|
||||
|
@ -5536,7 +5536,7 @@ llvm/include/llvm/TableGen/Parser.h
|
||||
llvm/include/llvm/TableGen/StringToOffsetTable.h
|
||||
llvm/include/llvm/Target/CGPassBuilderOption.h
|
||||
llvm/include/llvm/Target/CodeGenCWrappers.h
|
||||
llvm/include/llvm/Testing/Support/Annotations.h
|
||||
llvm/include/llvm/Testing/Annotations/Annotations.h
|
||||
llvm/include/llvm/Testing/Support/SupportHelpers.h
|
||||
llvm/include/llvm/TextAPI/Architecture.h
|
||||
llvm/include/llvm/TextAPI/ArchitectureSet.h
|
||||
@ -6839,7 +6839,7 @@ llvm/lib/Target/XCore/MCTargetDesc/XCoreMCAsmInfo.h
|
||||
llvm/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.cpp
|
||||
llvm/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.h
|
||||
llvm/lib/Target/XCore/TargetInfo/XCoreTargetInfo.cpp
|
||||
llvm/lib/Testing/Support/Annotations.cpp
|
||||
llvm/lib/Testing/Annotations/Annotations.cpp
|
||||
llvm/lib/Testing/Support/Error.cpp
|
||||
llvm/lib/Testing/Support/SupportHelpers.cpp
|
||||
llvm/lib/TextAPI/ArchitectureSet.cpp
|
||||
|
@ -50,5 +50,6 @@ clang_target_link_libraries(ASTTests
|
||||
target_link_libraries(ASTTests
|
||||
PRIVATE
|
||||
clangTesting
|
||||
LLVMTestingAnnotations
|
||||
LLVMTestingSupport
|
||||
)
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "clang/Lex/Lexer.h"
|
||||
#include "clang/Tooling/Tooling.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace clang::ast_matchers;
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "clang/ASTMatchers/ASTMatchFinder.h"
|
||||
#include "clang/ASTMatchers/ASTMatchers.h"
|
||||
#include "clang/Tooling/Tooling.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace clang;
|
||||
|
@ -41,5 +41,6 @@ clang_target_link_libraries(ClangAnalysisFlowSensitiveTests
|
||||
target_link_libraries(ClangAnalysisFlowSensitiveTests
|
||||
PRIVATE
|
||||
clangTesting
|
||||
LLVMTestingAnnotations
|
||||
LLVMTestingSupport
|
||||
)
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "clang/Analysis/FlowSensitive/DataflowAnalysis.h"
|
||||
#include "clang/Analysis/FlowSensitive/NoopLattice.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "llvm/Testing/Support/Error.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <memory>
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Testing/ADT/StringMapEntry.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "llvm/Testing/Support/Error.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/StringSet.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include <cassert>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/Errc.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
|
||||
namespace clang {
|
||||
namespace dataflow {
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "clang/Tooling/Tooling.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "llvm/Testing/Support/Error.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
@ -25,5 +25,6 @@ clang_target_link_libraries(SemaTests
|
||||
target_link_libraries(SemaTests
|
||||
PRIVATE
|
||||
clangTesting
|
||||
LLVMTestingAnnotations
|
||||
LLVMTestingSupport
|
||||
)
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "clang/Sema/Sema.h"
|
||||
#include "clang/Sema/SemaDiagnostic.h"
|
||||
#include "clang/Tooling/Tooling.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <cstddef>
|
||||
|
@ -90,6 +90,7 @@ clang_target_link_libraries(ToolingTests
|
||||
|
||||
target_link_libraries(ToolingTests
|
||||
PRIVATE
|
||||
LLVMTestingAnnotations
|
||||
LLVMTestingSupport
|
||||
clangTesting
|
||||
)
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "clang/Basic/Diagnostic.h"
|
||||
#include "clang/Basic/SourceLocation.h"
|
||||
#include "clang/Lex/Lexer.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "llvm/Testing/Support/Error.h"
|
||||
#include "llvm/Testing/Support/SupportHelpers.h"
|
||||
#include <gmock/gmock.h>
|
||||
|
@ -26,5 +26,6 @@ clang_target_link_libraries(SyntaxTests
|
||||
target_link_libraries(SyntaxTests
|
||||
PRIVATE
|
||||
clangTesting
|
||||
LLVMTestingAnnotations
|
||||
LLVMTestingSupport
|
||||
)
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include "llvm/Support/VirtualFileSystem.h"
|
||||
#include "llvm/Support/raw_os_ostream.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "llvm/Testing/Support/SupportHelpers.h"
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace clang;
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "clang/Tooling/Syntax/Tree.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/ScopedPrinter.h"
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Support/FormatVariadic.h"
|
15
llvm/lib/Testing/Annotations/CMakeLists.txt
Normal file
15
llvm/lib/Testing/Annotations/CMakeLists.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# Do not build unittest libraries automatically, they will be pulled in
|
||||
# by unittests if these are built.
|
||||
set(EXCLUDE_FROM_ALL ON)
|
||||
|
||||
add_llvm_library(LLVMTestingAnnotations
|
||||
Annotations.cpp
|
||||
|
||||
BUILDTREE_ONLY
|
||||
|
||||
ADDITIONAL_HEADER_DIRS
|
||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/Testing/Support
|
||||
|
||||
LINK_COMPONENTS
|
||||
Support
|
||||
)
|
@ -1 +1,2 @@
|
||||
add_subdirectory(Annotations)
|
||||
add_subdirectory(Support)
|
||||
|
@ -3,7 +3,6 @@
|
||||
set(EXCLUDE_FROM_ALL ON)
|
||||
|
||||
add_llvm_library(LLVMTestingSupport
|
||||
Annotations.cpp
|
||||
Error.cpp
|
||||
SupportHelpers.cpp
|
||||
|
||||
|
@ -8,7 +8,6 @@ add_llvm_unittest(SupportTests
|
||||
AlignmentTest.cpp
|
||||
AlignOfTest.cpp
|
||||
AllocatorTest.cpp
|
||||
AnnotationsTest.cpp
|
||||
ARMAttributeParser.cpp
|
||||
ArrayRecyclerTest.cpp
|
||||
Base64Test.cpp
|
||||
|
@ -5,7 +5,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#include "llvm/Testing/Support/Annotations.h"
|
||||
#include "llvm/Testing/Annotations/Annotations.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
10
llvm/unittests/Testing/Annotations/CMakeLists.txt
Normal file
10
llvm/unittests/Testing/Annotations/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
||||
set(LLVM_LINK_COMPONENTS
|
||||
Support
|
||||
TestingAnnotations
|
||||
)
|
||||
|
||||
add_llvm_unittest(TestingAnnotationTests
|
||||
AnnotationsTest.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(TestingAnnotationTests PRIVATE LLVMTestingAnnotations)
|
@ -1,2 +1,3 @@
|
||||
add_subdirectory(ADT)
|
||||
add_subdirectory(Annotations)
|
||||
add_subdirectory(Support)
|
||||
|
@ -29,6 +29,7 @@ cc_test(
|
||||
"//clang:tooling",
|
||||
"//llvm:Core",
|
||||
"//llvm:Support",
|
||||
"//llvm:TestingAnnotations",
|
||||
"//llvm:TestingSupport",
|
||||
"//third-party/unittest:gmock",
|
||||
"//third-party/unittest:gtest",
|
||||
@ -136,6 +137,7 @@ cc_test(
|
||||
"//clang:tooling",
|
||||
"//llvm:Support",
|
||||
"//llvm:TestingADT",
|
||||
"//llvm:TestingAnnotations",
|
||||
"//llvm:TestingSupport",
|
||||
"//third-party/unittest:gmock",
|
||||
"//third-party/unittest:gtest",
|
||||
@ -342,6 +344,7 @@ cc_test(
|
||||
"//clang:parse",
|
||||
"//clang:sema",
|
||||
"//clang:tooling",
|
||||
"//llvm:TestingAnnotations",
|
||||
"//llvm:TestingSupport",
|
||||
"//third-party/unittest:gmock",
|
||||
"//third-party/unittest:gtest",
|
||||
@ -420,6 +423,7 @@ cc_test(
|
||||
"//clang:tooling_refactoring",
|
||||
"//clang:transformer",
|
||||
"//llvm:Support",
|
||||
"//llvm:TestingAnnotations",
|
||||
"//llvm:TestingSupport",
|
||||
"//third-party/unittest:gmock",
|
||||
"//third-party/unittest:gtest",
|
||||
@ -495,6 +499,7 @@ cc_test(
|
||||
"//clang:tooling_core",
|
||||
"//clang:tooling_syntax",
|
||||
"//llvm:Support",
|
||||
"//llvm:TestingAnnotations",
|
||||
"//llvm:TestingSupport",
|
||||
"//third-party/unittest:gmock",
|
||||
"//third-party/unittest:gtest",
|
||||
|
@ -4516,9 +4516,7 @@ cc_library(
|
||||
"lib/Testing/Support/*.cpp",
|
||||
"lib/Testing/Support/*.h",
|
||||
]),
|
||||
hdrs = glob([
|
||||
"include/llvm/Testing/Support/*.h",
|
||||
]),
|
||||
hdrs = glob(["include/llvm/Testing/Support/*.h"]),
|
||||
copts = llvm_copts,
|
||||
deps = [
|
||||
":Support",
|
||||
@ -4528,6 +4526,15 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "TestingAnnotations",
|
||||
testonly = True,
|
||||
srcs = ["lib/Testing/Annotations/Annotations.cpp"],
|
||||
hdrs = ["include/llvm/Testing/Annotations/Annotations.h"],
|
||||
copts = llvm_copts,
|
||||
deps = [":Support"],
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Begin testonly binary utilities
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user