[llvm] 43fe9af - MatchTableRecord::emit - fix boolean operator precedence warnings from PVS Studio. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 2 14:04:37 PDT 2019


Author: Simon Pilgrim
Date: 2019-11-02T21:04:07Z
New Revision: 43fe9afa4fe4474d691ff84ea893bc671e8254c2

URL: https://github.com/llvm/llvm-project/commit/43fe9afa4fe4474d691ff84ea893bc671e8254c2
DIFF: https://github.com/llvm/llvm-project/commit/43fe9afa4fe4474d691ff84ea893bc671e8254c2.diff

LOG: MatchTableRecord::emit - fix boolean operator precedence warnings from PVS Studio. NFCI.

Make it clear that (Flags & MTRF_????) should resolve to a boolean.

Added: 
    

Modified: 
    llvm/utils/TableGen/GlobalISelEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp
index ab4a91c10783..fdac5ba90bb9 100644
--- a/llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -609,7 +609,7 @@ MatchTableRecord MatchTable::LineBreak = {
 void MatchTableRecord::emit(raw_ostream &OS, bool LineBreakIsNextAfterThis,
                             const MatchTable &Table) const {
   bool UseLineComment =
-      LineBreakIsNextAfterThis | (Flags & MTRF_LineBreakFollows);
+      LineBreakIsNextAfterThis || (Flags & MTRF_LineBreakFollows);
   if (Flags & (MTRF_JumpTarget | MTRF_CommaFollows))
     UseLineComment = false;
 
@@ -620,7 +620,7 @@ void MatchTableRecord::emit(raw_ostream &OS, bool LineBreakIsNextAfterThis,
   if (Flags & MTRF_Label)
     OS << ": @" << Table.getLabelIndex(LabelID);
 
-  if (Flags & MTRF_Comment && !UseLineComment)
+  if ((Flags & MTRF_Comment) && !UseLineComment)
     OS << "*/";
 
   if (Flags & MTRF_JumpTarget) {


        


More information about the llvm-commits mailing list