r360333 - Fix gcc compilation warning in an assert [NFC]

Mikael Holmen via cfe-commits cfe-commits at lists.llvm.org
Thu May 9 05:11:57 PDT 2019


Author: uabelho
Date: Thu May  9 05:11:57 2019
New Revision: 360333

URL: http://llvm.org/viewvc/llvm-project?rev=360333&view=rev
Log:
Fix gcc compilation warning in an assert [NFC]

Without this, gcc (7.4) complains with

../tools/clang/lib/Parse/ParseDecl.cpp:3937:63: error: suggest parentheses around '&&' within '||' [-Werror=parentheses]
     assert(!isAlreadyConsumed || RangeEnd != SourceLocation() &&
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
                                      "both or neither of isAlreadyConsumed and "
                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                      "RangeEnd needs to be set");
                                      ~

Modified:
    cfe/trunk/lib/Parse/ParseDecl.cpp

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=360333&r1=360332&r2=360333&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Thu May  9 05:11:57 2019
@@ -3934,7 +3934,7 @@ void Parser::ParseDeclarationSpecifiers(
       continue;
     }
 
-    assert(!isAlreadyConsumed || RangeEnd != SourceLocation() &&
+    assert((!isAlreadyConsumed || RangeEnd != SourceLocation()) &&
                                      "both or neither of isAlreadyConsumed and "
                                      "RangeEnd needs to be set");
     DS.SetRangeEnd(isAlreadyConsumed ? RangeEnd : Tok.getLocation());




More information about the cfe-commits mailing list