summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2017-02-14 16:35:56 +0000
committerPavel Labath <labath@google.com>2017-02-14 16:35:56 +0000
commit41ec64999d6f5df39a90ef2e7b7af5c2bfcac921 (patch)
treebde11bfddb5d970ffd81d3948fda49c4ea81a79f /llvm/unittests/Support
parentf09d13e5cc47b52cef8ca695aad6aa3c77dbe87e (diff)
downloadbcm5719-llvm-41ec64999d6f5df39a90ef2e7b7af5c2bfcac921.tar.gz
bcm5719-llvm-41ec64999d6f5df39a90ef2e7b7af5c2bfcac921.zip
[Support] Add formatv support for StringLiteral
Summary: This is achieved by generalizing the expression selecting the StringRef format_provider. Now, anything that can be converted to a StringRef will use it's formatter. Reviewers: zturner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29898 llvm-svn: 295064
Diffstat (limited to 'llvm/unittests/Support')
-rw-r--r--llvm/unittests/Support/FormatVariadicTest.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/unittests/Support/FormatVariadicTest.cpp b/llvm/unittests/Support/FormatVariadicTest.cpp
index 9307c6d8e09..b0c843870af 100644
--- a/llvm/unittests/Support/FormatVariadicTest.cpp
+++ b/llvm/unittests/Support/FormatVariadicTest.cpp
@@ -324,11 +324,13 @@ TEST(FormatVariadicTest, StringFormatting) {
const char FooArray[] = "FooArray";
const char *FooPtr = "FooPtr";
llvm::StringRef FooRef("FooRef");
+ constexpr StringLiteral FooLiteral("FooLiteral");
std::string FooString("FooString");
// 1. Test that we can print various types of strings.
EXPECT_EQ(FooArray, formatv("{0}", FooArray).str());
EXPECT_EQ(FooPtr, formatv("{0}", FooPtr).str());
EXPECT_EQ(FooRef, formatv("{0}", FooRef).str());
+ EXPECT_EQ(FooLiteral, formatv("{0}", FooLiteral).str());
EXPECT_EQ(FooString, formatv("{0}", FooString).str());
// 2. Test that the precision specifier prints the correct number of
OpenPOWER on IntegriCloud