Author: Björn Schäpers Date: 2021-12-04T21:29:29+01:00 New Revision: 4483e9b5279bc71c9da7bbb0e1524c3671493ab6
URL: https://github.com/llvm/llvm-project/commit/4483e9b5279bc71c9da7bbb0e1524c3671493ab6 DIFF: https://github.com/llvm/llvm-project/commit/4483e9b5279bc71c9da7bbb0e1524c3671493ab6.diff LOG: [clang-format][NFC] Reorder conditions Prefer to check the local variables first before dereferencing the pointer. Differential Revision: https://reviews.llvm.org/D115066 Added: Modified: clang/lib/Format/TokenAnnotator.cpp Removed: ################################################################################ diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 3633c7cf2c27..cc6d0662c9d1 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -2173,8 +2173,8 @@ class ExpressionParser { int CurrentPrecedence = getCurrentPrecedence(); - if (Current && Current->is(TT_SelectorName) && - Precedence == CurrentPrecedence) { + if (Precedence == CurrentPrecedence && Current && + Current->is(TT_SelectorName)) { if (LatestOperator) addFakeParenthesis(Start, prec::Level(Precedence)); Start = Current; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits