From 67b03de9a2d354d41eb88a801e16a7df193f1de2 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Tue, 11 Dec 2018 07:04:49 +0000 Subject: [Sema]improve static_assert(!expr) llvm-svn: 348830 --- clang/lib/Sema/SemaTemplate.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'clang/lib/Sema/SemaTemplate.cpp') 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(FailedCond)) { + OS << "("; + prettyPrintFailedBooleanCondition(OS, Paren->getSubExpr(), Policy); + OS << ")"; + return; + } + // If this is !(BooleanExpression), try pretty-printing the inner expression. + const auto *UnaryOp = dyn_cast(FailedCond); + if (UnaryOp && UnaryOp->getOpcode() == UO_LNot) { + OS << "!"; + prettyPrintFailedBooleanCondition(OS, UnaryOp->getSubExpr(), Policy); + return; + } + FailedCond->printPretty(OS, nullptr, Policy); } -- cgit v1.2.3