[cfe-commits] r134977 - /cfe/trunk/lib/CodeGen/CGExpr.cpp

Chandler Carruth chandlerc at gmail.com
Tue Jul 12 01:58:26 PDT 2011


Author: chandlerc
Date: Tue Jul 12 03:58:26 2011
New Revision: 134977

URL: http://llvm.org/viewvc/llvm-project?rev=134977&view=rev
Log:
Work around a problem with a static helper's formulation in release
builds introduced in r134972:

lib/CodeGen/CGExpr.cpp:1294:7: error: no matching function for call to 'EmitBitCastOfLValueToProperType'
lib/CodeGen/CGExpr.cpp:1278:1: note: candidate function not viable: no known conversion from 'CGBuilderTy' (aka 'IRBuilder<false>') to 'llvm::IRBuilder<> &' for 1st argument

This fixes the issue by passing CodeGenFunction on down, and using its
builder directly rather than passing just the builder down.

This may not be the best / cleanest fix, Chris please review. It at
least fixes builds.

Modified:
    cfe/trunk/lib/CodeGen/CGExpr.cpp

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=134977&r1=134976&r2=134977&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Tue Jul 12 03:58:26 2011
@@ -1275,11 +1275,11 @@
 }
 
 static llvm::Value *
-EmitBitCastOfLValueToProperType(llvm::IRBuilder<> &Builder, 
+EmitBitCastOfLValueToProperType(CodeGenFunction &CGF,
                                 llvm::Value *V, llvm::Type *IRType,
                                 llvm::StringRef Name = llvm::StringRef()) {
   unsigned AS = cast<llvm::PointerType>(V->getType())->getAddressSpace();
-  return Builder.CreateBitCast(V, IRType->getPointerTo(AS), Name);
+  return CGF.Builder.CreateBitCast(V, IRType->getPointerTo(AS), Name);
 }
 
 static LValue EmitGlobalVarDeclLValue(CodeGenFunction &CGF,
@@ -1291,7 +1291,7 @@
   if (VD->getType()->isReferenceType())
     V = CGF.Builder.CreateLoad(V, "tmp");
   
-  V = EmitBitCastOfLValueToProperType(CGF.Builder, V,
+  V = EmitBitCastOfLValueToProperType(CGF, V,
                                 CGF.getTypes().ConvertTypeForMem(E->getType()));
 
   unsigned Alignment = CGF.getContext().getDeclAlign(VD).getQuantity();
@@ -1350,7 +1350,7 @@
     if (VD->getType()->isReferenceType())
       V = Builder.CreateLoad(V, "tmp");
 
-    V = EmitBitCastOfLValueToProperType(Builder, V,
+    V = EmitBitCastOfLValueToProperType(*this, V,
                                     getTypes().ConvertTypeForMem(E->getType()));
 
     LValue LV = MakeAddrLValue(V, E->getType(), Alignment);
@@ -1850,7 +1850,7 @@
   // for both unions and structs.  A union needs a bitcast, a struct element
   // will need a bitcast if the LLVM type laid out doesn't match the desired
   // type.
-  addr = EmitBitCastOfLValueToProperType(Builder, addr,
+  addr = EmitBitCastOfLValueToProperType(*this, addr,
                                          CGM.getTypes().ConvertTypeForMem(type),
                                          field->getName());
 





More information about the cfe-commits mailing list