mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-14 03:29:57 +00:00
Reland [FileCheck] Move FileCheck implementation out of LLVMSupport into its own library
This relands e9a3d1a401
which was originally
missing linking LLVMSupport into LLMVFileCheck which broke the SHARED_LIBS build.
Original summary:
The actual FileCheck logic seems to be implemented in LLVMSupport. I don't see a
good reason for having FileCheck implemented there as it has a very specific use
while LLVMSupport is a dependency of pretty much every LLVM tool there is. In
fact, the only use of FileCheck I could find (outside the FileCheck tool and the
FileCheck unit test) is a single call in GISelMITest.h.
This moves the FileCheck logic to its own LLVMFileCheck library. This way only
FileCheck and the GlobalISelTests now have a dependency on this code.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D86344
This commit is contained in:
parent
2114f71aaa
commit
5ffd940ac0
@ -1,4 +1,4 @@
|
||||
//==-- llvm/Support/FileCheck.h ---------------------------*- C++ -*-==//
|
||||
//==-- llvm/FileCheck/FileCheck.h --------------------------------*- C++ -*-==//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
@ -10,8 +10,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_SUPPORT_FILECHECK_H
|
||||
#define LLVM_SUPPORT_FILECHECK_H
|
||||
#ifndef LLVM_FILECHECK_FILECHECK_H
|
||||
#define LLVM_FILECHECK_FILECHECK_H
|
||||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
@ -195,6 +195,13 @@ module LLVM_ExecutionEngine {
|
||||
|
||||
}
|
||||
|
||||
module LLVM_FileCheck {
|
||||
requires cplusplus
|
||||
|
||||
umbrella "FileCheck"
|
||||
module * { export * }
|
||||
}
|
||||
|
||||
// Orc utilities that don't depend only on Support (not ExecutionEngine or
|
||||
// IR). This is a workaround for ExecutionEngine's broken layering, and will
|
||||
// be removed in the future.
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
add_subdirectory(IR)
|
||||
add_subdirectory(FuzzMutate)
|
||||
add_subdirectory(FileCheck)
|
||||
add_subdirectory(InterfaceStub)
|
||||
add_subdirectory(IRReader)
|
||||
add_subdirectory(CodeGen)
|
||||
|
8
llvm/lib/FileCheck/CMakeLists.txt
Normal file
8
llvm/lib/FileCheck/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
add_llvm_component_library(LLVMFileCheck
|
||||
FileCheck.cpp
|
||||
|
||||
ADDITIONAL_HEADER_DIRS
|
||||
"${LLVM_MAIN_INCLUDE_DIR}/llvm/FileCheck"
|
||||
)
|
||||
|
||||
target_link_libraries(LLVMFileCheck LLVMSupport)
|
@ -13,7 +13,7 @@
|
||||
// as well as various unittests.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Support/FileCheck.h"
|
||||
#include "llvm/FileCheck/FileCheck.h"
|
||||
#include "FileCheckImpl.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringSet.h"
|
@ -12,13 +12,13 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIB_SUPPORT_FILECHECKIMPL_H
|
||||
#define LLVM_LIB_SUPPORT_FILECHECKIMPL_H
|
||||
#ifndef LLVM_LIB_FILECHECK_FILECHECKIMPL_H
|
||||
#define LLVM_LIB_FILECHECK_FILECHECKIMPL_H
|
||||
|
||||
#include "llvm/Support/FileCheck.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/FileCheck/FileCheck.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/SourceMgr.h"
|
||||
#include <map>
|
@ -134,7 +134,6 @@ add_llvm_component_library(LLVMSupport
|
||||
Error.cpp
|
||||
ErrorHandling.cpp
|
||||
ExtensibleRTTI.cpp
|
||||
FileCheck.cpp
|
||||
FileCollector.cpp
|
||||
FileUtilities.cpp
|
||||
FileOutputBuffer.cpp
|
||||
|
@ -24,6 +24,7 @@ add_subdirectory(CodeGen)
|
||||
add_subdirectory(DebugInfo)
|
||||
add_subdirectory(Demangle)
|
||||
add_subdirectory(ExecutionEngine)
|
||||
add_subdirectory(FileCheck)
|
||||
add_subdirectory(Frontend)
|
||||
add_subdirectory(FuzzMutate)
|
||||
add_subdirectory(InterfaceStub)
|
||||
|
@ -2,6 +2,7 @@ set(LLVM_LINK_COMPONENTS
|
||||
${LLVM_TARGETS_TO_BUILD}
|
||||
CodeGen
|
||||
Core
|
||||
FileCheck
|
||||
GlobalISel
|
||||
MC
|
||||
MIRParser
|
||||
|
@ -21,8 +21,8 @@
|
||||
#include "llvm/CodeGen/TargetInstrInfo.h"
|
||||
#include "llvm/CodeGen/TargetLowering.h"
|
||||
#include "llvm/CodeGen/TargetSubtargetInfo.h"
|
||||
#include "llvm/FileCheck/FileCheck.h"
|
||||
#include "llvm/InitializePasses.h"
|
||||
#include "llvm/Support/FileCheck.h"
|
||||
#include "llvm/Support/SourceMgr.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
#include "llvm/Support/TargetSelect.h"
|
||||
|
10
llvm/unittests/FileCheck/CMakeLists.txt
Normal file
10
llvm/unittests/FileCheck/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
||||
set(LLVM_LINK_COMPONENTS
|
||||
FileCheck
|
||||
Support
|
||||
)
|
||||
|
||||
add_llvm_unittest(FileCheckTests
|
||||
FileCheckTest.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(FileCheckTests PRIVATE LLVMTestingSupport)
|
@ -1,4 +1,4 @@
|
||||
//===- llvm/unittest/Support/FileCheckTest.cpp - FileCheck tests --===//
|
||||
//===- llvm/unittest/FileCheck/FileCheckTest.cpp - FileCheck tests --------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
@ -6,8 +6,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Support/FileCheck.h"
|
||||
#include "../lib/Support/FileCheckImpl.h"
|
||||
#include "llvm/FileCheck/FileCheck.h"
|
||||
#include "../lib/FileCheck/FileCheckImpl.h"
|
||||
#include "llvm/Support/Regex.h"
|
||||
#include "llvm/Testing/Support/Error.h"
|
||||
#include "gtest/gtest.h"
|
@ -33,7 +33,6 @@ add_llvm_unittest(SupportTests
|
||||
ErrorOrTest.cpp
|
||||
ErrorTest.cpp
|
||||
ExtensibleRTTITest.cpp
|
||||
FileCheckTest.cpp
|
||||
FileCollectorTest.cpp
|
||||
FileOutputBufferTest.cpp
|
||||
FileUtilitiesTest.cpp
|
||||
|
@ -2,4 +2,4 @@ add_llvm_utility(FileCheck
|
||||
FileCheck.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(FileCheck PRIVATE LLVMSupport)
|
||||
target_link_libraries(FileCheck PRIVATE LLVMFileCheck LLVMSupport)
|
||||
|
@ -15,12 +15,12 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/FileCheck/FileCheck.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/InitLLVM.h"
|
||||
#include "llvm/Support/Process.h"
|
||||
#include "llvm/Support/WithColor.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Support/FileCheck.h"
|
||||
#include <cmath>
|
||||
using namespace llvm;
|
||||
|
||||
|
7
llvm/utils/gn/secondary/llvm/lib/FileCheck/BUILD.gn
Normal file
7
llvm/utils/gn/secondary/llvm/lib/FileCheck/BUILD.gn
Normal file
@ -0,0 +1,7 @@
|
||||
static_library("FileCheck") {
|
||||
output_name = "LLVMFileCheck"
|
||||
deps = [ "//llvm/lib/Support" ]
|
||||
sources = [
|
||||
"FileCheck.cpp",
|
||||
]
|
||||
}
|
@ -71,7 +71,6 @@ static_library("Support") {
|
||||
"Error.cpp",
|
||||
"ErrorHandling.cpp",
|
||||
"ExtensibleRTTI.cpp",
|
||||
"FileCheck.cpp",
|
||||
"FileCollector.cpp",
|
||||
"FileOutputBuffer.cpp",
|
||||
"FileUtilities.cpp",
|
||||
|
@ -20,6 +20,7 @@ group("unittests") {
|
||||
"ExecutionEngine/JITLink:JITLinkTests",
|
||||
"ExecutionEngine/MCJIT:MCJITTests",
|
||||
"ExecutionEngine/Orc:OrcJITTests",
|
||||
"FileCheck:FileCheckTests",
|
||||
"Frontend:LLVMFrontendTests",
|
||||
"FuzzMutate:FuzzMutateTests",
|
||||
"IR:IRTests",
|
||||
|
@ -5,6 +5,7 @@ unittest("GlobalISelTests") {
|
||||
"//llvm/lib/CodeGen",
|
||||
"//llvm/lib/CodeGen/GlobalISel",
|
||||
"//llvm/lib/CodeGen/MIRParser",
|
||||
"//llvm/lib/FileCheck",
|
||||
"//llvm/lib/IR",
|
||||
"//llvm/lib/MC",
|
||||
"//llvm/lib/Support",
|
||||
|
@ -0,0 +1,9 @@
|
||||
import("//llvm/utils/unittest/unittest.gni")
|
||||
|
||||
unittest("FileCheckTests") {
|
||||
deps = [
|
||||
"//llvm/lib/FileCheck",
|
||||
"//llvm/lib/Support",
|
||||
]
|
||||
sources = [ "FileCheckTest.cpp" ]
|
||||
}
|
@ -36,7 +36,6 @@ unittest("SupportTests") {
|
||||
"ErrorOrTest.cpp",
|
||||
"ErrorTest.cpp",
|
||||
"ExtensibleRTTITest.cpp",
|
||||
"FileCheckTest.cpp",
|
||||
"FileCollectorTest.cpp",
|
||||
"FileOutputBufferTest.cpp",
|
||||
"FileUtilitiesTest.cpp",
|
||||
|
Loading…
Reference in New Issue
Block a user