[clang-format][NFC] Reorder conditions
authorBjörn Schäpers <bjoern@hazardy.de>
Fri, 3 Dec 2021 07:45:56 +0000 (08:45 +0100)
committerBjörn Schäpers <bjoern@hazardy.de>
Sat, 4 Dec 2021 20:29:29 +0000 (21:29 +0100)
Prefer to check the local variables first before dereferencing the
pointer.

Differential Revision: https://reviews.llvm.org/D115066

clang/lib/Format/TokenAnnotator.cpp

index 3633c7c..cc6d066 100644 (file)
@@ -2173,8 +2173,8 @@ public:
 
       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;