[clang] bb1b53d - [clang-format] Remove unnecessary non-null check and assert instead. NFC.
Marek Kurdej via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 3 00:50:53 PST 2022
Author: Marek Kurdej
Date: 2022-02-03T09:50:36+01:00
New Revision: bb1b53da6eeb90d3c101719f569abce1d689a959
URL: https://github.com/llvm/llvm-project/commit/bb1b53da6eeb90d3c101719f569abce1d689a959
DIFF: https://github.com/llvm/llvm-project/commit/bb1b53da6eeb90d3c101719f569abce1d689a959.diff
LOG: [clang-format] Remove unnecessary non-null check and assert instead. NFC.
After a non-eof token, there is at least an eof token.
Added:
Modified:
clang/lib/Format/UnwrappedLineParser.cpp
Removed:
################################################################################
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 8d06277caba37..cdc2740ba9642 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -514,9 +514,10 @@ bool UnwrappedLineParser::parseLevel(bool HasOpeningBrace, IfStmtKind *IfKind) {
FormatToken *Next;
do {
Next = Tokens->getNextToken();
+ assert(Next);
} while (Next->is(tok::comment));
FormatTok = Tokens->setPosition(StoredPosition);
- if (Next && Next->isNot(tok::colon)) {
+ if (Next->isNot(tok::colon)) {
// default not followed by ':' is not a case label; treat it like
// an identifier.
parseStructuralElement();
More information about the cfe-commits
mailing list