summaryrefslogtreecommitdiffstats
path: root/clang/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
commitf506eaf36dd8f2c54082e8278857f2f47e90488a (patch)
tree080029d3c68dde45ab111e34e3a07515ef216d1e /clang/lib/Sema/SemaDeclCXX.cpp
parent8dc347fc270cf063fb3368b39d140b2664ee9b46 (diff)
downloadbcm5719-llvm-f506eaf36dd8f2c54082e8278857f2f47e90488a.tar.gz
bcm5719-llvm-f506eaf36dd8f2c54082e8278857f2f47e90488a.zip
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. llvm-svn: 152069
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index b603b64bda9..abcaf983572 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/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))
OpenPOWER on IntegriCloud