]> granicus.if.org Git - clang/commitdiff
Fix one strict-aliasing warning.
authorTed Kremenek <kremenek@apple.com>
Thu, 29 May 2008 21:52:26 +0000 (21:52 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 29 May 2008 21:52:26 +0000 (21:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51707 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/CFG.cpp

index aad9ee7ada48b49bec201854e01a78916e79ce2b..ba6a6c8552c48e085d3faf122faa5ca46fe7b253 100644 (file)
@@ -1177,17 +1177,17 @@ typedef llvm::FoldingSet<PersistPairTy> BlkEdgeSetTy;
 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;