Author: Björn Schäpers Date: 2022-01-05T12:31:35+01:00 New Revision: 918c977dc1c8905086443e13c172a492247d4709
URL: https://github.com/llvm/llvm-project/commit/918c977dc1c8905086443e13c172a492247d4709 DIFF: https://github.com/llvm/llvm-project/commit/918c977dc1c8905086443e13c172a492247d4709.diff LOG: [clang-format][NFC] Early return in TokenAnnotator::next Differential Revision: https://reviews.llvm.org/D116559 Added: Modified: clang/lib/Format/TokenAnnotator.cpp Removed: ################################################################################ diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 54c2a62542b9..3cd89127348c 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1431,13 +1431,14 @@ class AnnotatingParser { } void next() { - if (CurrentToken) { - CurrentToken->NestingLevel = Contexts.size() - 1; - CurrentToken->BindingStrength = Contexts.back().BindingStrength; - modifyContext(*CurrentToken); - determineTokenType(*CurrentToken); - CurrentToken = CurrentToken->Next; - } + if (!CurrentToken) + return; + + CurrentToken->NestingLevel = Contexts.size() - 1; + CurrentToken->BindingStrength = Contexts.back().BindingStrength; + modifyContext(*CurrentToken); + determineTokenType(*CurrentToken); + CurrentToken = CurrentToken->Next; resetTokenMetadata(); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits