aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-03-05 23:20:05 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-03-05 23:20:05 +0000
commit0cc323c6bed7206f9743a9775ec8d9cb90655f9c (patch)
tree5d4fea5c36daf0a866976076a48a17674fbb32f2 /lib/Sema/SemaDeclCXX.cpp
parenta99f874bf2ade1e32f0feda7d5b8211171440f02 (diff)
static_assert: Allow any string-literal as the message, not just a character
string literal, and adjust the diagnostic code to match. This also causes us to escape any control characters in the message. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152069 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--lib/Sema/SemaDeclCXX.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index b603b64bda..abcaf98357 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -9646,9 +9646,13 @@ Decl *Sema::ActOnStaticAssertDeclaration(SourceLocation StaticAssertLoc,
/*AllowFold=*/false).isInvalid())
return 0;
- if (!Cond)
+ if (!Cond) {
+ llvm::SmallString<256> MsgBuffer;
+ llvm::raw_svector_ostream Msg(MsgBuffer);
+ AssertMessage->printPretty(Msg, Context, 0, getPrintingPolicy());
Diag(StaticAssertLoc, diag::err_static_assert_failed)
- << AssertMessage->getString() << AssertExpr->getSourceRange();
+ << Msg.str() << AssertExpr->getSourceRange();
+ }
}
if (DiagnoseUnexpandedParameterPack(AssertExpr, UPPC_StaticAssertExpression))