r217670 - Fixing a -Woverflow warning from GCC by using a more natural datatype for this operation. NFC.

Aaron Ballman aaron at aaronballman.com
Fri Sep 12 05:42:15 PDT 2014


Author: aaronballman
Date: Fri Sep 12 07:42:15 2014
New Revision: 217670

URL: http://llvm.org/viewvc/llvm-project?rev=217670&view=rev
Log:
Fixing a -Woverflow warning from GCC by using a more natural datatype for this operation. NFC.

Modified:
    cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
    cfe/trunk/lib/Analysis/ThreadSafetyTIL.cpp

Modified: cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h?rev=217670&r1=217669&r2=217670&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h (original)
+++ cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h Fri Sep 12 07:42:15 2014
@@ -1669,7 +1669,7 @@ private:
   SCFG         *CFGPtr;      // The CFG that contains this block.
   int          BlockID : 31; // unique id for this BB in the containing CFG.
                              // IDs are in topological order.
-  int          Visited : 1;  // Bit to determine if a block has been visited
+  bool         Visited : 1;  // Bit to determine if a block has been visited
                              // during a traversal.
   BlockArray  Predecessors;  // Predecessor blocks in the CFG.
   InstrArray  Args;          // Phi nodes.  One argument per predecessor.

Modified: cfe/trunk/lib/Analysis/ThreadSafetyTIL.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ThreadSafetyTIL.cpp?rev=217670&r1=217669&r2=217670&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/ThreadSafetyTIL.cpp (original)
+++ cfe/trunk/lib/Analysis/ThreadSafetyTIL.cpp Fri Sep 12 07:42:15 2014
@@ -170,7 +170,7 @@ int BasicBlock::renumberInstrs(int ID) {
 // block, and ID should be the total number of blocks.
 int BasicBlock::topologicalSort(SimpleArray<BasicBlock*>& Blocks, int ID) {
   if (Visited) return ID;
-  Visited = 1;
+  Visited = true;
   for (auto *Block : successors())
     ID = Block->topologicalSort(Blocks, ID);
   // set ID and update block array in place.
@@ -195,7 +195,7 @@ int BasicBlock::topologicalFinalSort(Sim
   // Visited is assumed to have been set by the topologicalSort.  This pass
   // assumes !Visited means that we've visited this node before.
   if (!Visited) return ID;
-  Visited = 0;
+  Visited = false;
   if (DominatorNode.Parent)
     ID = DominatorNode.Parent->topologicalFinalSort(Blocks, ID);
   for (auto *Pred : Predecessors)





More information about the cfe-commits mailing list