]> granicus.if.org Git - clang/commitdiff
IRgen: Add an LValue::MakeAddr variant which takes a type and uses that to build
authorDaniel Dunbar <daniel@zuster.org>
Sat, 21 Aug 2010 02:53:44 +0000 (02:53 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sat, 21 Aug 2010 02:53:44 +0000 (02:53 +0000)
the qualifiers.

Also, add CodeGenFunction::MakeAddrLValue() helper function which passes in the
ASTContext.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111714 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGValue.h
lib/CodeGen/CodeGenFunction.h

index a1bd193f9e274850c84d2325444ba988d2a988ae..8153169c8757dc384890cf320dee830aa953e872 100644 (file)
@@ -15,6 +15,7 @@
 #ifndef CLANG_CODEGEN_CGVALUE_H
 #define CLANG_CODEGEN_CGVALUE_H
 
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/Type.h"
 
 namespace llvm {
@@ -258,6 +259,13 @@ public:
     return R;
   }
 
+  static LValue MakeAddr(llvm::Value *V, QualType T, ASTContext &Context) {
+    Qualifiers Quals = Context.getCanonicalType(T).getQualifiers();
+    Quals.setObjCGCAttr(Context.getObjCGCAttrKind(T));
+
+    return MakeAddr(V, Quals);
+  }
+
   static LValue MakeVectorElt(llvm::Value *Vec, llvm::Value *Idx,
                               unsigned CVR) {
     LValue R;
index 6dcf18c3cdfa01ad9ba3113d92e9d6f7cb8434fc..726b7ed284e5f3fe18ceb6b9fee989ea3d634562 100644 (file)
@@ -975,6 +975,10 @@ public:
     return Quals;
   }
 
+  LValue MakeAddrLValue(llvm::Value *V, QualType T) {
+    return LValue::MakeAddr(V, T, getContext());
+  }
+
   /// CreateTempAlloca - This creates a alloca and inserts it into the entry
   /// block. The caller is responsible for setting an appropriate alignment on
   /// the alloca.