diff options
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 14 |
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); } |