1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/unittests/Support
Zachary Turner fbbe67869c [Support] Add support for unique_ptr<> to Casting.h.
Often you have a unique_ptr<T> where T supports LLVM's
casting methods, and you wish to cast it to a unique_ptr<U>.
Prior to this patch, this requires doing hacky things like:

unique_ptr<U> Casted;
if (isa<U>(Orig.get()))
  Casted.reset(cast<U>(Orig.release()));

This is overly verbose, and it would be nice to just be able
to use unique_ptr directly with cast and dyn_cast.  To this end,
this patch updates cast<> to work directly with unique_ptr<T>,
so you can now write:

auto Casted = cast<U>(std::move(Orig));

Since it's possible for dyn_cast<> to fail, however, we choose
to use a slightly different API here, because it's awkward to
write

if (auto Casted = dyn_cast<U>(std::move(Orig))) {}

when Orig may end up not having been moved at all.  So the
interface for dyn_cast is

if (auto Casted = unique_dyn_cast<U>(Orig)) {}

Where the inclusion of `unique` in the name of the cast operator
re-affirms that regardless of success of or fail of the casting,
exactly one of the input value and the return value will contain
a non-null result.

Differential Revision: https://reviews.llvm.org/D31890

llvm-svn: 300098
2017-04-12 19:59:37 +00:00
..
AlignOfTest.cpp Revert r291503, "Lift the 10-type limit for AlignedCharArrayUnion", and followings. 2017-01-13 01:13:10 +00:00
AllocatorTest.cpp [unittest] Explicitly specify alignment when using BumpPtrAllocator. 2017-03-11 01:24:56 +00:00
ARMAttributeParser.cpp [ARM] const cast fix for ARMAttributeParser test 2017-02-01 12:58:57 +00:00
ArrayRecyclerTest.cpp
BinaryStreamTest.cpp [unittest] Explicitly specify alignment when using BumpPtrAllocator. 2017-03-11 01:24:56 +00:00
BlockFrequencyTest.cpp
BranchProbabilityTest.cpp
CachePruningTest.cpp Support: Add a cache pruning policy parser. 2017-03-16 03:42:00 +00:00
Casting.cpp [Support] Add support for unique_ptr<> to Casting.h. 2017-04-12 19:59:37 +00:00
Chrono.cpp [Support] Add FormatVariadic support for chrono types 2017-02-07 18:11:33 +00:00
CMakeLists.txt Support: Add a cache pruning policy parser. 2017-03-16 03:42:00 +00:00
CommandLineTest.cpp [Support][CommandLine] Make it possible to get error messages from ParseCommandLineOptions when ignoring errors. 2017-03-15 08:41:00 +00:00
CompressionTest.cpp Recommit r292214 "[Support/Compression] - Change zlib API to return Error instead of custom status" 2017-01-17 15:45:07 +00:00
ConvertUTFTest.cpp
DataExtractorTest.cpp
DebugTest.cpp
DwarfTest.cpp
EndianStreamTest.cpp
EndianTest.cpp
ErrorOrTest.cpp
ErrorTest.cpp [Support][Error] Add a 'cantFail' utility function for known-safe calls to 2017-02-27 21:09:47 +00:00
FileOutputBufferTest.cpp
formatted_raw_ostream_test.cpp
FormatVariadicTest.cpp [Support] Add formatv support for StringLiteral 2017-02-14 16:35:56 +00:00
GlobPatternTest.cpp
Host.cpp Implement host CPU detection for AArch64 2017-04-04 19:06:04 +00:00
LEB128Test.cpp [Support] Extend SLEB128 encoding support. 2017-02-10 00:02:58 +00:00
LineIteratorTest.cpp
LockFileManagerTest.cpp
ManagedStatic.cpp
MathExtrasTest.cpp
MD5Test.cpp Add a function to MD5 a file's contents. 2017-03-20 23:33:18 +00:00
MemoryBufferTest.cpp
MemoryTest.cpp
NativeFormatTests.cpp
Path.cpp Make the home_directory test a little more resilient. 2017-03-22 16:30:06 +00:00
ProcessTest.cpp
ProgramTest.cpp Remove unused lambda captures. NFC 2017-01-13 17:12:16 +00:00
raw_ostream_test.cpp Bring back r297624. 2017-03-13 20:00:25 +00:00
raw_pwrite_stream_test.cpp
raw_sha1_ostream_test.cpp
RegexTest.cpp
ReplaceFileTest.cpp
ScaledNumberTest.cpp
SourceMgrTest.cpp
SpecialCaseListTest.cpp
StringPool.cpp
SwapByteOrderTest.cpp
TargetParserTest.cpp [AArch64] Vulcan is now ThunderXT99 2017-03-07 19:42:40 +00:00
TarWriterTest.cpp Use EXPECT_EQ instead of ASSERT_EQ in a unit test. 2017-01-11 22:02:51 +00:00
Threading.cpp
ThreadLocalTest.cpp
ThreadPool.cpp Remove unused lambda captures. NFC 2017-01-13 17:12:16 +00:00
TimerTest.cpp
TrailingObjectsTest.cpp Workaround MSVC bug when using TrailingObjects from a template. 2017-02-28 18:05:41 +00:00
TrigramIndexTest.cpp
TypeNameTest.cpp
UnicodeTest.cpp
xxhashTest.cpp
YAMLIOTest.cpp Align all scalar numbers to LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR 2017-04-04 06:02:32 +00:00
YAMLParserTest.cpp