summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplate.cpp
diff options
context:
space:
mode:
authorClement Courbet <courbet@google.com>2018-12-11 07:04:49 +0000
committerClement Courbet <courbet@google.com>2018-12-11 07:04:49 +0000
commit67b03de9a2d354d41eb88a801e16a7df193f1de2 (patch)
tree006ea2adba999881bf31366d64a7986828ad594b /clang/lib/Sema/SemaTemplate.cpp
parentf17c5f6ba6a2764b0d8d17fdd2b0700dff2e2753 (diff)
downloadbcm5719-llvm-67b03de9a2d354d41eb88a801e16a7df193f1de2.tar.gz
bcm5719-llvm-67b03de9a2d354d41eb88a801e16a7df193f1de2.zip
[Sema]improve static_assert(!expr)
llvm-svn: 348830
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 56302d62484..cb6e32fc5e5 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -3071,6 +3071,20 @@ static void prettyPrintFailedBooleanCondition(llvm::raw_string_ostream &OS,
}
return;
}
+ if (const auto *Paren = dyn_cast<ParenExpr>(FailedCond)) {
+ OS << "(";
+ prettyPrintFailedBooleanCondition(OS, Paren->getSubExpr(), Policy);
+ OS << ")";
+ return;
+ }
+ // If this is !(BooleanExpression), try pretty-printing the inner expression.
+ const auto *UnaryOp = dyn_cast<UnaryOperator>(FailedCond);
+ if (UnaryOp && UnaryOp->getOpcode() == UO_LNot) {
+ OS << "!";
+ prettyPrintFailedBooleanCondition(OS, UnaryOp->getSubExpr(), Policy);
+ return;
+ }
+
FailedCond->printPretty(OS, nullptr, Policy);
}
OpenPOWER on IntegriCloud