[cfe-commits] r111714 - in /cfe/trunk/lib/CodeGen: CGValue.h CodeGenFunction.h

Daniel Dunbar daniel at zuster.org
Fri Aug 20 19:53:44 PDT 2010


Author: ddunbar
Date: Fri Aug 20 21:53:44 2010
New Revision: 111714

URL: http://llvm.org/viewvc/llvm-project?rev=111714&view=rev
Log:
IRgen: Add an LValue::MakeAddr variant which takes a type and uses that to build
the qualifiers.

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

Modified:
    cfe/trunk/lib/CodeGen/CGValue.h
    cfe/trunk/lib/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/lib/CodeGen/CGValue.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGValue.h?rev=111714&r1=111713&r2=111714&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGValue.h (original)
+++ cfe/trunk/lib/CodeGen/CGValue.h Fri Aug 20 21:53:44 2010
@@ -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 @@
     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;

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=111714&r1=111713&r2=111714&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Fri Aug 20 21:53:44 2010
@@ -975,6 +975,10 @@
     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.





More information about the cfe-commits mailing list