LLVM: lib/Testing/Support/SupportHelpers.cpp Source File (original) (raw)
1
3
9
10#include "gtest/gtest.h"
11
12using namespace llvm;
14
17
19
22
24 return std::make_pair(true, std::move(PathInSameDir));
25
27
30 return std::make_pair(true, std::move(PathInParentDir));
31
32 return std::pair<bool, SmallString<128>>(false, {});
33}
34
36 bool Found = false;
38 std::tie(Found, InputFilePath) = findSrcDirMap(Argv0);
39
40 EXPECT_TRUE(Found) << "Unit test source directory file does not exist.";
41
43
44 EXPECT_TRUE(static_cast<bool>(File))
45 << "Could not open unit test source directory file.";
46
47 InputFilePath.clear();
48 InputFilePath.append((*File)->getBuffer().trim());
51 return InputFilePath;
52}
This file defines the SmallString class.
static std::pair< bool, SmallString< 128 > > findSrcDirMap(StringRef Argv0)
Definition SupportHelpers.cpp:15
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFile(const Twine &Filename, bool IsText=false, bool RequiresNullTerminator=true, bool IsVolatile=false, std::optional< Align > Alignment=std::nullopt)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful,...
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
void append(StringRef RHS)
Append from a StringRef.
StringRef - Represent a constant reference to a string, i.e.
LLVM_ABI bool is_regular_file(const basic_file_status &status)
Does status represent a regular file?
LLVM_ABI std::error_code make_absolute(SmallVectorImpl< char > &path)
Make path an absolute path.
LLVM_ABI StringRef parent_path(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get parent path.
LLVM_ABI void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
SmallString< 128 > getInputFileDirectory(const char *Argv0)
Definition SupportHelpers.cpp:35
This is an optimization pass for GlobalISel generic memory operations.