rymiel updated this revision to Diff 490584. rymiel added a comment. Drop unrelated change
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D142139/new/ https://reviews.llvm.org/D142139 Files: clang/lib/Format/TokenAnnotator.cpp clang/unittests/Format/FormatTest.cpp Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -10345,6 +10345,7 @@ // Not template parameters. verifyFormat("return a < b && c > d;"); + verifyFormat("a < 0 ? b : a > 0 ? c : d;"); verifyFormat("void f() {\n" " while (a < b && c > d) {\n" " }\n" Index: clang/lib/Format/TokenAnnotator.cpp =================================================================== --- clang/lib/Format/TokenAnnotator.cpp +++ clang/lib/Format/TokenAnnotator.cpp @@ -185,6 +185,8 @@ } else { CurrentToken->setType(TT_TemplateCloser); } + if (CurrentToken->Next && CurrentToken->Next->Tok.isLiteral()) + return false; next(); return true; }
Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -10345,6 +10345,7 @@ // Not template parameters. verifyFormat("return a < b && c > d;"); + verifyFormat("a < 0 ? b : a > 0 ? c : d;"); verifyFormat("void f() {\n" " while (a < b && c > d) {\n" " }\n" Index: clang/lib/Format/TokenAnnotator.cpp =================================================================== --- clang/lib/Format/TokenAnnotator.cpp +++ clang/lib/Format/TokenAnnotator.cpp @@ -185,6 +185,8 @@ } else { CurrentToken->setType(TT_TemplateCloser); } + if (CurrentToken->Next && CurrentToken->Next->Tok.isLiteral()) + return false; next(); return true; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits