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.

llvm-svn: 111714
This commit is contained in:
Daniel Dunbar 2010-08-21 02:53:44 +00:00
parent 573869fe5b
commit 93b00a98a3
2 changed files with 12 additions and 0 deletions

View 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;

View 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.