[cfe-commits] r51707 - /cfe/trunk/lib/AST/CFG.cpp

Ted Kremenek kremenek at apple.com
Thu May 29 14:52:26 PDT 2008


Author: kremenek
Date: Thu May 29 16:52:26 2008
New Revision: 51707

URL: http://llvm.org/viewvc/llvm-project?rev=51707&view=rev
Log:
Fix one strict-aliasing warning.

Modified:
    cfe/trunk/lib/AST/CFG.cpp

Modified: cfe/trunk/lib/AST/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CFG.cpp?rev=51707&r1=51706&r2=51707&view=diff

==============================================================================
--- cfe/trunk/lib/AST/CFG.cpp (original)
+++ cfe/trunk/lib/AST/CFG.cpp Thu May 29 16:52:26 2008
@@ -1177,17 +1177,17 @@
 const std::pair<CFGBlock*,CFGBlock*>*
 CFG::getBlockEdgeImpl(const CFGBlock* B1, const CFGBlock* B2) {
   
-  llvm::BumpPtrAllocator*& Alloc =
-    reinterpret_cast<llvm::BumpPtrAllocator*&>(Allocator);
+  if (!Allocator)
+    Allocator = new llvm::BumpPtrAllocator();
   
-  if (!Alloc)
-    Alloc = new llvm::BumpPtrAllocator();
+  llvm::BumpPtrAllocator* Alloc =
+    static_cast<llvm::BumpPtrAllocator*>(Allocator);
 
-  BlkEdgeSetTy*& p = reinterpret_cast<BlkEdgeSetTy*&>(BlkEdgeSet);
+  if (!BlkEdgeSet)
+    BlkEdgeSet = new BlkEdgeSetTy();
+    
+  BlkEdgeSetTy* p = static_cast<BlkEdgeSetTy*>(BlkEdgeSet);
 
-  if (!p)
-    p = new BlkEdgeSetTy();
-  
   // Profile the edges.
   llvm::FoldingSetNodeID profile;
   void* InsertPos;





More information about the cfe-commits mailing list