llvm/unittests/Support
Pavel Labath d11d167713 Improve format member detection in llvm::formatv
Summary:
The existing detection of a format member function has a couple of deficiencies:
- the member function does not get detected if one calls formatv with an lvalue,
  because the template parameter gets deduced as T&, which fails the is_class
  check.
- it also did not work if the function was called with a const variable because
  the template parameter would get deduced as const T&, again failing the
  is_class check.

This fixes the problem by stripping the references in the uses_format_member
template, to make sure the type is correctly detected as class. It also provides
specializations of the has_FormatMember template for const and non-const members
of the types in order to enable declaring the format member as a "const"
function. I have added tests that verify that formatv can be now called in these
scenarios. As some scenarios could not be verified at runtime (e.g. making sure
that calling a non-const format member on a const object does *not* compile), I
have also added some static_asserts which test the behaviour of the template
classes used internally by formatv().

Reviewers: zturner

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289040 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 11:31:19 +00:00
..
AlignOfTest.cpp [Support] Fix AlignOf test on i386-linux. 2016-10-21 09:15:57 +00:00
AllocatorTest.cpp
ArrayRecyclerTest.cpp
BlockFrequencyTest.cpp
BranchProbabilityTest.cpp
Casting.cpp
Chrono.cpp Reapply "Add Chrono.h - std::chrono support header" 2016-10-20 12:05:50 +00:00
CMakeLists.txt Use trigrams to speed up SpecialCaseList. 2016-12-01 02:54:54 +00:00
CommandLineTest.cpp Attempt to pacify buildbot 2016-11-01 07:52:10 +00:00
CompressionTest.cpp
ConvertUTFTest.cpp
DataExtractorTest.cpp
DwarfTest.cpp Re-commit "Use StringRef in Support/Darf APIs (NFC)" 2016-10-05 05:59:29 +00:00
EndianStreamTest.cpp
EndianTest.cpp
ErrorOrTest.cpp
ErrorTest.cpp Fix macro check for ABI breacking check: should use #if instead of #ifndef 2016-11-30 19:08:41 +00:00
FileOutputBufferTest.cpp Fix a real temp file leak in FileOutputBuffer 2016-09-02 01:10:53 +00:00
formatted_raw_ostream_test.cpp
FormatVariadicTest.cpp Improve format member detection in llvm::formatv 2016-12-08 11:31:19 +00:00
Host.cpp Add computeHostNumPhysicalCores() implementation for Darwin 2016-10-19 22:36:07 +00:00
LEB128Test.cpp
LineIteratorTest.cpp
LockFileManagerTest.cpp
ManagedStatic.cpp
MathExtrasTest.cpp [ADT/MathExtras] Make buildbot happy again. 2016-11-11 04:03:29 +00:00
MD5Test.cpp Add convenient functions to compute hashes of byte vectors. 2016-11-23 00:46:09 +00:00
MemoryBufferTest.cpp Try to fix some temp file leaks in SupportTests, PR18335 2016-09-02 00:51:34 +00:00
MemoryTest.cpp
NativeFormatTests.cpp [Support] Introduce llvm::formatv() function. 2016-11-11 23:57:40 +00:00
Path.cpp [Support] remove_dots: Remove windows test. 2016-10-17 13:57:16 +00:00
ProcessTest.cpp
ProgramTest.cpp
raw_ostream_test.cpp [Support] Improve flexibility of binary blob formatter. 2016-11-10 20:16:45 +00:00
raw_pwrite_stream_test.cpp raw_pwrite_stream_test.cpp: _putenv_s() may be assumed as win32-generic. 2016-09-02 01:20:18 +00:00
raw_sha1_ostream_test.cpp Add convenient functions to compute hashes of byte vectors. 2016-11-23 00:46:09 +00:00
RegexTest.cpp [Support] - Fix possible crash in match() of llvm::Regex. 2016-09-02 08:44:46 +00:00
ReplaceFileTest.cpp
ScaledNumberTest.cpp
SourceMgrTest.cpp
SpecialCaseListTest.cpp Support escaping in TrigramIndex. 2016-12-02 23:30:16 +00:00
StringPool.cpp
SwapByteOrderTest.cpp
TargetParserTest.cpp Refactor TargetParserTests. 2016-12-06 02:22:08 +00:00
Threading.cpp Rename interface for querying physical hardware concurrency 2016-10-17 14:56:53 +00:00
ThreadLocalTest.cpp
ThreadPool.cpp [ThreadPool] Rollback recent changes until I figure out the breakage. 2016-11-28 09:17:12 +00:00
TimerTest.cpp Timer: Track name and description. 2016-11-18 19:43:18 +00:00
TrailingObjectsTest.cpp Retire llvm::alignOf in favor of C++11 alignof. 2016-10-20 15:02:18 +00:00
TrigramIndexTest.cpp Support escaping in TrigramIndex. 2016-12-02 23:30:16 +00:00
TypeNameTest.cpp
UnicodeTest.cpp
xxhashTest.cpp Add xxhash to llvm. 2016-09-27 15:45:57 +00:00
YAMLIOTest.cpp Improve error handling in YAML parsing 2016-11-28 21:38:52 +00:00
YAMLParserTest.cpp