1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-21 18:22:53 +01:00

Reland [FileCheck] Move FileCheck implementation out of LLVMSupport into its own library

This relands e9a3d1a401b07cbf7b11695637f1b549782a26cd 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:
Raphael Isemann 2020-09-01 13:21:18 +02:00
parent 30fe55a858
commit c3c7a59967
21 changed files with 59 additions and 17 deletions

View File

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

View File

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

View File

@ -3,6 +3,7 @@
add_subdirectory(IR)
add_subdirectory(FuzzMutate)
add_subdirectory(FileCheck)
add_subdirectory(InterfaceStub)
add_subdirectory(IRReader)
add_subdirectory(CodeGen)

View 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)

View File

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

View File

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

View File

@ -134,7 +134,6 @@ add_llvm_component_library(LLVMSupport
Error.cpp
ErrorHandling.cpp
ExtensibleRTTI.cpp
FileCheck.cpp
FileCollector.cpp
FileUtilities.cpp
FileOutputBuffer.cpp

View File

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

View File

@ -2,6 +2,7 @@ set(LLVM_LINK_COMPONENTS
${LLVM_TARGETS_TO_BUILD}
CodeGen
Core
FileCheck
GlobalISel
MC
MIRParser

View File

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

View File

@ -0,0 +1,10 @@
set(LLVM_LINK_COMPONENTS
FileCheck
Support
)
add_llvm_unittest(FileCheckTests
FileCheckTest.cpp
)
target_link_libraries(FileCheckTests PRIVATE LLVMTestingSupport)

View File

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

View File

@ -33,7 +33,6 @@ add_llvm_unittest(SupportTests
ErrorOrTest.cpp
ErrorTest.cpp
ExtensibleRTTITest.cpp
FileCheckTest.cpp
FileCollectorTest.cpp
FileOutputBufferTest.cpp
FileUtilitiesTest.cpp

View File

@ -2,4 +2,4 @@ add_llvm_utility(FileCheck
FileCheck.cpp
)
target_link_libraries(FileCheck PRIVATE LLVMSupport)
target_link_libraries(FileCheck PRIVATE LLVMFileCheck LLVMSupport)

View File

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

View File

@ -0,0 +1,7 @@
static_library("FileCheck") {
output_name = "LLVMFileCheck"
deps = [ "//llvm/lib/Support" ]
sources = [
"FileCheck.cpp",
]
}

View File

@ -71,7 +71,6 @@ static_library("Support") {
"Error.cpp",
"ErrorHandling.cpp",
"ExtensibleRTTI.cpp",
"FileCheck.cpp",
"FileCollector.cpp",
"FileOutputBuffer.cpp",
"FileUtilities.cpp",

View File

@ -20,6 +20,7 @@ group("unittests") {
"ExecutionEngine/JITLink:JITLinkTests",
"ExecutionEngine/MCJIT:MCJITTests",
"ExecutionEngine/Orc:OrcJITTests",
"FileCheck:FileCheckTests",
"Frontend:LLVMFrontendTests",
"FuzzMutate:FuzzMutateTests",
"IR:IRTests",

View File

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

View File

@ -0,0 +1,9 @@
import("//llvm/utils/unittest/unittest.gni")
unittest("FileCheckTests") {
deps = [
"//llvm/lib/FileCheck",
"//llvm/lib/Support",
]
sources = [ "FileCheckTest.cpp" ]
}

View File

@ -36,7 +36,6 @@ unittest("SupportTests") {
"ErrorOrTest.cpp",
"ErrorTest.cpp",
"ExtensibleRTTITest.cpp",
"FileCheckTest.cpp",
"FileCollectorTest.cpp",
"FileOutputBufferTest.cpp",
"FileUtilitiesTest.cpp",