summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclPrinter.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-06-05 18:03:58 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-06-05 18:03:58 +0000
commitcdffc36c119a7933c3e8871ccd0028f41d5b5feb (patch)
tree1fd4d7df8ca04e1445257ac4e60a0e3ff545d09c /clang/lib/AST/DeclPrinter.cpp
parent6679fc1a791ed1f673be9143ed5a07755ae80767 (diff)
downloadbcm5719-llvm-cdffc36c119a7933c3e8871ccd0028f41d5b5feb.tar.gz
bcm5719-llvm-cdffc36c119a7933c3e8871ccd0028f41d5b5feb.zip
[AST] There is no message for C++1z-style static_assert
We would crash in the DeclPrinter trying to pretty-print the static_assert message. C++1z-style assertions don't have a message so we would crash. This fixes PR23756. llvm-svn: 239170
Diffstat (limited to 'clang/lib/AST/DeclPrinter.cpp')
-rw-r--r--clang/lib/AST/DeclPrinter.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp
index c0f3e17693d..d8cd40ec9c6 100644
--- a/clang/lib/AST/DeclPrinter.cpp
+++ b/clang/lib/AST/DeclPrinter.cpp
@@ -733,8 +733,10 @@ void DeclPrinter::VisitImportDecl(ImportDecl *D) {
void DeclPrinter::VisitStaticAssertDecl(StaticAssertDecl *D) {
Out << "static_assert(";
D->getAssertExpr()->printPretty(Out, nullptr, Policy, Indentation);
- Out << ", ";
- D->getMessage()->printPretty(Out, nullptr, Policy, Indentation);
+ if (StringLiteral *SL = D->getMessage()) {
+ Out << ", ";
+ SL->printPretty(Out, nullptr, Policy, Indentation);
+ }
Out << ")";
}
OpenPOWER on IntegriCloud