[cfe-commits] r75028 - in /cfe/trunk/lib/CodeGen: CGBlocks.cpp CGCXX.cpp CGDecl.cpp CGExprConstant.cpp CGObjCGNU.cpp CGObjCMac.cpp CodeGenModule.cpp
Owen Anderson
resistor at mac.com
Wed Jul 8 12:05:10 PDT 2009
Author: resistor
Date: Wed Jul 8 14:05:04 2009
New Revision: 75028
URL: http://llvm.org/viewvc/llvm-project?rev=75028&view=rev
Log:
Update for LLVM API change.
Modified:
cfe/trunk/lib/CodeGen/CGBlocks.cpp
cfe/trunk/lib/CodeGen/CGCXX.cpp
cfe/trunk/lib/CodeGen/CGDecl.cpp
cfe/trunk/lib/CodeGen/CGExprConstant.cpp
cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=75028&r1=75027&r2=75028&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Wed Jul 8 14:05:04 2009
@@ -50,9 +50,9 @@
C = llvm::ConstantStruct::get(Elts);
- C = new llvm::GlobalVariable(CGM.getModule().getContext(), C->getType(), true,
+ C = new llvm::GlobalVariable(CGM.getModule(), C->getType(), true,
llvm::GlobalValue::InternalLinkage,
- C, "__block_descriptor_tmp", &CGM.getModule());
+ C, "__block_descriptor_tmp");
return C;
}
@@ -165,10 +165,9 @@
char Name[32];
sprintf(Name, "__block_holder_tmp_%d", CGM.getGlobalUniqueCount());
- C = new llvm::GlobalVariable(CGM.getModule().getContext(),
- C->getType(), true,
+ C = new llvm::GlobalVariable(CGM.getModule(), C->getType(), true,
llvm::GlobalValue::InternalLinkage,
- C, Name, &CGM.getModule());
+ C, Name);
QualType BPT = BE->getType();
C = llvm::ConstantExpr::getBitCast(C, ConvertType(BPT));
return C;
@@ -514,11 +513,9 @@
llvm::ConstantStruct::get(&DescriptorFields[0], 2);
llvm::GlobalVariable *Descriptor =
- new llvm::GlobalVariable(getModule().getContext(),
- DescriptorStruct->getType(), true,
+ new llvm::GlobalVariable(getModule(), DescriptorStruct->getType(), true,
llvm::GlobalVariable::InternalLinkage,
- DescriptorStruct, "__block_descriptor_global",
- &getModule());
+ DescriptorStruct, "__block_descriptor_global");
// Generate the constants for the block literal.
llvm::Constant *LiteralFields[5];
@@ -557,11 +554,9 @@
llvm::ConstantStruct::get(&LiteralFields[0], 5);
llvm::GlobalVariable *BlockLiteral =
- new llvm::GlobalVariable(getModule().getContext(),
- BlockLiteralStruct->getType(), true,
+ new llvm::GlobalVariable(getModule(), BlockLiteralStruct->getType(), true,
llvm::GlobalVariable::InternalLinkage,
- BlockLiteralStruct, "__block_literal_global",
- &getModule());
+ BlockLiteralStruct, "__block_literal_global");
return BlockLiteral;
}
Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=75028&r1=75027&r2=75028&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Wed Jul 8 14:05:04 2009
@@ -20,7 +20,6 @@
#include "clang/AST/Decl.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
-#include "llvm/Module.h"
#include "llvm/ADT/StringExtras.h"
using namespace clang;
using namespace CodeGen;
@@ -39,12 +38,10 @@
// Create the guard variable.
llvm::GlobalValue *GuardV =
- new llvm::GlobalVariable(CGM.getModule().getContext(),
- llvm::Type::Int64Ty, false,
+ new llvm::GlobalVariable(CGM.getModule(), llvm::Type::Int64Ty, false,
GV->getLinkage(),
llvm::Constant::getNullValue(llvm::Type::Int64Ty),
- GuardVName.c_str(),
- &CGM.getModule());
+ GuardVName.c_str());
// Load the first byte of the guard variable.
const llvm::Type *PtrTy = llvm::PointerType::get(llvm::Type::Int8Ty, 0);
Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=75028&r1=75027&r2=75028&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Wed Jul 8 14:05:04 2009
@@ -104,10 +104,10 @@
}
const llvm::Type *LTy = CGM.getTypes().ConvertTypeForMem(Ty);
- return new llvm::GlobalVariable(CGM.getModule().getContext(),
- LTy, Ty.isConstant(getContext()), Linkage,
+ return new llvm::GlobalVariable(CGM.getModule(), LTy,
+ Ty.isConstant(getContext()), Linkage,
llvm::Constant::getNullValue(LTy), Name,
- &CGM.getModule(), D.isThreadSpecified(),
+ 0, D.isThreadSpecified(),
Ty.getAddressSpace());
}
@@ -150,10 +150,10 @@
if (GV->getType() != Init->getType()) {
llvm::GlobalVariable *OldGV = GV;
- GV = new llvm::GlobalVariable(CGM.getModule().getContext(),
- Init->getType(), OldGV->isConstant(),
+ GV = new llvm::GlobalVariable(CGM.getModule(), Init->getType(),
+ OldGV->isConstant(),
OldGV->getLinkage(), Init, "",
- &CGM.getModule(), D.isThreadSpecified(),
+ 0, D.isThreadSpecified(),
D.getType().getAddressSpace());
// Steal the name of the old global
Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=75028&r1=75027&r2=75028&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Wed Jul 8 14:05:04 2009
@@ -394,10 +394,10 @@
llvm::Constant* C = Visit(CLE->getInitializer());
// FIXME: "Leaked" on failure.
if (C)
- C = new llvm::GlobalVariable(CGM.getModule().getContext(), C->getType(),
+ C = new llvm::GlobalVariable(CGM.getModule(), C->getType(),
E->getType().isConstQualified(),
llvm::GlobalValue::InternalLinkage,
- C, ".compoundliteral", &CGM.getModule());
+ C, ".compoundliteral");
return C;
}
case Expr::DeclRefExprClass:
Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=75028&r1=75027&r2=75028&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Wed Jul 8 14:05:04 2009
@@ -184,11 +184,11 @@
std::string symbolName = "__objc_class_name_" + className;
llvm::GlobalVariable *ClassSymbol = TheModule.getGlobalVariable(symbolName);
if (!ClassSymbol) {
- ClassSymbol = new llvm::GlobalVariable(TheModule.getContext(), LongTy,
- false, llvm::GlobalValue::ExternalLinkage, 0, symbolName, &TheModule);
+ ClassSymbol = new llvm::GlobalVariable(TheModule, LongTy, false,
+ llvm::GlobalValue::ExternalLinkage, 0, symbolName);
}
- new llvm::GlobalVariable(TheModule.getContext(), ClassSymbol->getType(), true,
- llvm::GlobalValue::CommonLinkage, ClassSymbol, symbolRef, &TheModule);
+ new llvm::GlobalVariable(TheModule, ClassSymbol->getType(), true,
+ llvm::GlobalValue::CommonLinkage, ClassSymbol, symbolRef);
}
static std::string SymbolNameForClass(const std::string &ClassName) {
@@ -291,23 +291,22 @@
llvm::Constant *CGObjCGNU::MakeConstantString(const std::string &Str,
const std::string &Name) {
llvm::Constant * ConstStr = llvm::ConstantArray::get(Str);
- ConstStr = new llvm::GlobalVariable(TheModule.getContext(),
- ConstStr->getType(), true,
+ ConstStr = new llvm::GlobalVariable(TheModule, ConstStr->getType(), true,
llvm::GlobalValue::InternalLinkage,
- ConstStr, Name, &TheModule);
+ ConstStr, Name);
return llvm::ConstantExpr::getGetElementPtr(ConstStr, Zeros, 2);
}
llvm::Constant *CGObjCGNU::MakeGlobal(const llvm::StructType *Ty,
std::vector<llvm::Constant*> &V, const std::string &Name) {
llvm::Constant *C = llvm::ConstantStruct::get(Ty, V);
- return new llvm::GlobalVariable(TheModule.getContext(), Ty, false,
- llvm::GlobalValue::InternalLinkage, C, Name, &TheModule);
+ return new llvm::GlobalVariable(TheModule, Ty, false,
+ llvm::GlobalValue::InternalLinkage, C, Name);
}
llvm::Constant *CGObjCGNU::MakeGlobal(const llvm::ArrayType *Ty,
std::vector<llvm::Constant*> &V, const std::string &Name) {
llvm::Constant *C = llvm::ConstantArray::get(Ty, V);
- return new llvm::GlobalVariable(TheModule.getContext(), Ty, false,
- llvm::GlobalValue::InternalLinkage, C, Name, &TheModule);
+ return new llvm::GlobalVariable(TheModule, Ty, false,
+ llvm::GlobalValue::InternalLinkage, C, Name);
}
/// Generate an NSConstantString object.
@@ -869,9 +868,9 @@
TheModule.getGlobalVariable(classSymbolName)) {
symbol->setInitializer(llvm::ConstantInt::get(LongTy, 0));
} else {
- new llvm::GlobalVariable(TheModule.getContext(), LongTy, false,
- llvm::GlobalValue::ExternalLinkage,
- llvm::ConstantInt::get(LongTy, 0), classSymbolName, &TheModule);
+ new llvm::GlobalVariable(TheModule, LongTy, false,
+ llvm::GlobalValue::ExternalLinkage, llvm::ConstantInt::get(LongTy, 0),
+ classSymbolName);
}
// Get the size of instances.
@@ -1102,10 +1101,10 @@
iter != iterEnd; ++iter) {
llvm::Constant *Idxs[] = {Zeros[0],
llvm::ConstantInt::get(llvm::Type::Int32Ty, index++), Zeros[0]};
- llvm::Constant *SelPtr = new llvm::GlobalVariable(TheModule.getContext(),
- SelStructPtrTy, true, llvm::GlobalValue::InternalLinkage,
+ llvm::Constant *SelPtr = new llvm::GlobalVariable(TheModule, SelStructPtrTy,
+ true, llvm::GlobalValue::InternalLinkage,
llvm::ConstantExpr::getGetElementPtr(SelectorList, Idxs, 2),
- ".objc_sel_ptr", &TheModule);
+ ".objc_sel_ptr");
// If selectors are defined as an opaque type, cast the pointer to this
// type.
if (isSelOpaque) {
@@ -1119,10 +1118,10 @@
iter != iterEnd; iter++) {
llvm::Constant *Idxs[] = {Zeros[0],
llvm::ConstantInt::get(llvm::Type::Int32Ty, index++), Zeros[0]};
- llvm::Constant *SelPtr = new llvm::GlobalVariable(TheModule.getContext(),
- SelStructPtrTy, true, llvm::GlobalValue::InternalLinkage,
+ llvm::Constant *SelPtr = new llvm::GlobalVariable(TheModule, SelStructPtrTy,
+ true, llvm::GlobalValue::InternalLinkage,
llvm::ConstantExpr::getGetElementPtr(SelectorList, Idxs, 2),
- ".objc_sel_ptr", &TheModule);
+ ".objc_sel_ptr");
// If selectors are defined as an opaque type, cast the pointer to this
// type.
if (isSelOpaque) {
@@ -1568,8 +1567,8 @@
uint64_t Offset = ComputeIvarBaseOffset(CGM, ID, Ivar);
llvm::ConstantInt *OffsetGuess =
llvm::ConstantInt::get(LongTy, Offset, "ivar");
- IvarOffsetGV = new llvm::GlobalVariable(TheModule.getContext(), LongTy,
- false, llvm::GlobalValue::CommonLinkage, OffsetGuess, Name, &TheModule);
+ IvarOffsetGV = new llvm::GlobalVariable(TheModule, LongTy, false,
+ llvm::GlobalValue::CommonLinkage, OffsetGuess, Name);
}
return IvarOffsetGV;
}
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=75028&r1=75027&r2=75028&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Wed Jul 8 14:05:04 2009
@@ -1646,12 +1646,10 @@
Entry->setInitializer(Init);
} else {
Entry =
- new llvm::GlobalVariable(CGM.getModule().getContext(),
- ObjCTypes.ProtocolTy, false,
+ new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ProtocolTy, false,
llvm::GlobalValue::InternalLinkage,
Init,
- std::string("\01L_OBJC_PROTOCOL_")+ProtocolName,
- &CGM.getModule());
+ std::string("\01L_OBJC_PROTOCOL_")+ProtocolName);
Entry->setSection("__OBJC,__protocol,regular,no_dead_strip");
Entry->setAlignment(4);
UsedGlobals.push_back(Entry);
@@ -1670,12 +1668,10 @@
// reference or not. At module finalization we add the empty
// contents for protocols which were referenced but never defined.
Entry =
- new llvm::GlobalVariable(CGM.getModule().getContext(),
- ObjCTypes.ProtocolTy, false,
+ new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ProtocolTy, false,
llvm::GlobalValue::ExternalLinkage,
0,
- "\01L_OBJC_PROTOCOL_" + PD->getNameAsString(),
- &CGM.getModule());
+ "\01L_OBJC_PROTOCOL_" + PD->getNameAsString());
Entry->setSection("__OBJC,__protocol,regular,no_dead_strip");
Entry->setAlignment(4);
UsedGlobals.push_back(Entry);
@@ -2102,11 +2098,9 @@
GV->setLinkage(llvm::GlobalValue::InternalLinkage);
GV->setInitializer(Init);
} else {
- GV = new llvm::GlobalVariable(CGM.getModule().getContext(),
- ObjCTypes.ClassTy, false,
+ GV = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassTy, false,
llvm::GlobalValue::InternalLinkage,
- Init, Name,
- &CGM.getModule());
+ Init, Name);
}
GV->setSection("__OBJC,__meta_class,regular,no_dead_strip");
GV->setAlignment(4);
@@ -2133,12 +2127,10 @@
} else {
// Generate as an external reference to keep a consistent
// module. This will be patched up when we emit the metaclass.
- return new llvm::GlobalVariable(CGM.getModule().getContext(),
- ObjCTypes.ClassTy, false,
+ return new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassTy, false,
llvm::GlobalValue::ExternalLinkage,
0,
- Name,
- &CGM.getModule());
+ Name);
}
}
@@ -2315,11 +2307,10 @@
bool AddToUsed) {
const llvm::Type *Ty = Init->getType();
llvm::GlobalVariable *GV =
- new llvm::GlobalVariable(CGM.getModule().getContext(), Ty, false,
+ new llvm::GlobalVariable(CGM.getModule(), Ty, false,
llvm::GlobalValue::InternalLinkage,
Init,
- Name,
- &CGM.getModule());
+ Name);
if (Section)
GV->setSection(Section);
if (Align)
@@ -4075,12 +4066,10 @@
Symbols);
llvm::GlobalVariable *GV =
- new llvm::GlobalVariable(CGM.getModule().getContext(),
- Init->getType(), false,
+ new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false,
llvm::GlobalValue::InternalLinkage,
Init,
- SymbolName,
- &CGM.getModule());
+ SymbolName);
GV->setAlignment(8);
GV->setSection(SectionName);
UsedGlobals.push_back(GV);
@@ -4122,12 +4111,10 @@
llvm::ArrayType::get(ObjCTypes.IntTy, 2),
Values);
llvm::GlobalVariable *IMGV =
- new llvm::GlobalVariable(CGM.getModule().getContext(),
- Init->getType(), false,
+ new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false,
llvm::GlobalValue::InternalLinkage,
Init,
- "\01L_OBJC_IMAGE_INFO",
- &CGM.getModule());
+ "\01L_OBJC_IMAGE_INFO");
IMGV->setSection("__DATA, __objc_imageinfo, regular, no_dead_strip");
IMGV->setConstant(true);
UsedGlobals.push_back(IMGV);
@@ -4267,14 +4254,12 @@
llvm::Constant *Init = llvm::ConstantStruct::get(ObjCTypes.ClassRonfABITy,
Values);
llvm::GlobalVariable *CLASS_RO_GV =
- new llvm::GlobalVariable(CGM.getModule().getContext(),
- ObjCTypes.ClassRonfABITy, false,
+ new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassRonfABITy, false,
llvm::GlobalValue::InternalLinkage,
Init,
(flags & CLS_META) ?
std::string("\01l_OBJC_METACLASS_RO_$_")+ClassName :
- std::string("\01l_OBJC_CLASS_RO_$_")+ClassName,
- &CGM.getModule());
+ std::string("\01l_OBJC_CLASS_RO_$_")+ClassName);
CLASS_RO_GV->setAlignment(
CGM.getTargetData().getPrefTypeAlignment(ObjCTypes.ClassRonfABITy));
CLASS_RO_GV->setSection("__DATA, __objc_const");
@@ -4343,22 +4328,20 @@
std::string ClassName = ID->getNameAsString();
if (!ObjCEmptyCacheVar) {
ObjCEmptyCacheVar = new llvm::GlobalVariable(
- CGM.getModule().getContext(),
+ CGM.getModule(),
ObjCTypes.CacheTy,
false,
llvm::GlobalValue::ExternalLinkage,
0,
- "_objc_empty_cache",
- &CGM.getModule());
+ "_objc_empty_cache");
ObjCEmptyVtableVar = new llvm::GlobalVariable(
- CGM.getModule().getContext(),
+ CGM.getModule(),
ObjCTypes.ImpnfABITy,
false,
llvm::GlobalValue::ExternalLinkage,
0,
- "_objc_empty_vtable",
- &CGM.getModule());
+ "_objc_empty_vtable");
}
assert(ID->getClassInterface() &&
"CGObjCNonFragileABIMac::GenerateClass - class is 0");
@@ -4462,12 +4445,11 @@
if (PTGV)
return Builder.CreateLoad(PTGV, false, "tmp");
PTGV = new llvm::GlobalVariable(
- CGM.getModule().getContext(),
+ CGM.getModule(),
Init->getType(), false,
llvm::GlobalValue::WeakAnyLinkage,
Init,
- ProtocolName,
- &CGM.getModule());
+ ProtocolName);
PTGV->setSection("__DATA, __objc_protorefs, coalesced, no_dead_strip");
PTGV->setVisibility(llvm::GlobalValue::HiddenVisibility);
UsedGlobals.push_back(PTGV);
@@ -4548,13 +4530,11 @@
llvm::ConstantStruct::get(ObjCTypes.CategorynfABITy,
Values);
llvm::GlobalVariable *GCATV
- = new llvm::GlobalVariable(CGM.getModule().getContext(),
- ObjCTypes.CategorynfABITy,
+ = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.CategorynfABITy,
false,
llvm::GlobalValue::InternalLinkage,
Init,
- ExtCatName,
- &CGM.getModule());
+ ExtCatName);
GCATV->setAlignment(
CGM.getTargetData().getPrefTypeAlignment(ObjCTypes.CategorynfABITy));
GCATV->setSection("__DATA, __objc_const");
@@ -4612,12 +4592,10 @@
llvm::Constant *Init = llvm::ConstantStruct::get(Values);
llvm::GlobalVariable *GV =
- new llvm::GlobalVariable(CGM.getModule().getContext(),
- Init->getType(), false,
+ new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false,
llvm::GlobalValue::InternalLinkage,
Init,
- Name,
- &CGM.getModule());
+ Name);
GV->setAlignment(
CGM.getTargetData().getPrefTypeAlignment(Init->getType()));
GV->setSection(Section);
@@ -4642,12 +4620,11 @@
CGM.getModule().getGlobalVariable(Name);
if (!IvarOffsetGV)
IvarOffsetGV =
- new llvm::GlobalVariable(CGM.getModule().getContext(), ObjCTypes.LongTy,
+ new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.LongTy,
false,
llvm::GlobalValue::ExternalLinkage,
0,
- Name,
- &CGM.getModule());
+ Name);
return IvarOffsetGV;
}
@@ -4741,12 +4718,10 @@
llvm::Constant *Init = llvm::ConstantStruct::get(Values);
const char *Prefix = "\01l_OBJC_$_INSTANCE_VARIABLES_";
llvm::GlobalVariable *GV =
- new llvm::GlobalVariable(CGM.getModule().getContext(),
- Init->getType(), false,
+ new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false,
llvm::GlobalValue::InternalLinkage,
Init,
- Prefix + OID->getNameAsString(),
- &CGM.getModule());
+ Prefix + OID->getNameAsString());
GV->setAlignment(
CGM.getTargetData().getPrefTypeAlignment(Init->getType()));
GV->setSection("__DATA, __objc_const");
@@ -4765,12 +4740,10 @@
// reference or not. At module finalization we add the empty
// contents for protocols which were referenced but never defined.
Entry =
- new llvm::GlobalVariable(CGM.getModule().getContext(),
- ObjCTypes.ProtocolnfABITy, false,
+ new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ProtocolnfABITy, false,
llvm::GlobalValue::ExternalLinkage,
0,
- "\01l_OBJC_PROTOCOL_$_" + PD->getNameAsString(),
- &CGM.getModule());
+ "\01l_OBJC_PROTOCOL_$_" + PD->getNameAsString());
Entry->setSection("__DATA,__datacoal_nt,coalesced");
UsedGlobals.push_back(Entry);
}
@@ -4870,12 +4843,10 @@
Entry->setInitializer(Init);
} else {
Entry =
- new llvm::GlobalVariable(CGM.getModule().getContext(),
- ObjCTypes.ProtocolnfABITy, false,
+ new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ProtocolnfABITy, false,
llvm::GlobalValue::WeakAnyLinkage,
Init,
- std::string("\01l_OBJC_PROTOCOL_$_")+ProtocolName,
- &CGM.getModule());
+ std::string("\01l_OBJC_PROTOCOL_$_")+ProtocolName);
Entry->setAlignment(
CGM.getTargetData().getPrefTypeAlignment(ObjCTypes.ProtocolnfABITy));
Entry->setSection("__DATA,__datacoal_nt,coalesced");
@@ -4885,13 +4856,12 @@
// Use this protocol meta-data to build protocol list table in section
// __DATA, __objc_protolist
llvm::GlobalVariable *PTGV = new llvm::GlobalVariable(
- CGM.getModule().getContext(),
+ CGM.getModule(),
ObjCTypes.ProtocolnfABIPtrTy, false,
llvm::GlobalValue::WeakAnyLinkage,
Entry,
std::string("\01l_OBJC_LABEL_PROTOCOL_$_")
- +ProtocolName,
- &CGM.getModule());
+ +ProtocolName);
PTGV->setAlignment(
CGM.getTargetData().getPrefTypeAlignment(ObjCTypes.ProtocolnfABIPtrTy));
PTGV->setSection("__DATA, __objc_protolist, coalesced, no_dead_strip");
@@ -4939,12 +4909,10 @@
ProtocolRefs);
llvm::Constant *Init = llvm::ConstantStruct::get(Values);
- GV = new llvm::GlobalVariable(CGM.getModule().getContext(),
- Init->getType(), false,
+ GV = new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false,
llvm::GlobalValue::InternalLinkage,
Init,
- Name,
- &CGM.getModule());
+ Name);
GV->setSection("__DATA, __objc_const");
GV->setAlignment(
CGM.getTargetData().getPrefTypeAlignment(Init->getType()));
@@ -5083,12 +5051,10 @@
Values[0] = Fn;
Values[1] = GetMethodVarName(Sel);
llvm::Constant *Init = llvm::ConstantStruct::get(Values);
- GV = new llvm::GlobalVariable(CGM.getModule().getContext(),
- Init->getType(), false,
+ GV = new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false,
llvm::GlobalValue::WeakAnyLinkage,
Init,
- Name,
- &CGM.getModule());
+ Name);
GV->setVisibility(llvm::GlobalValue::HiddenVisibility);
GV->setAlignment(16);
GV->setSection("__DATA, __objc_msgrefs, coalesced");
@@ -5132,10 +5098,9 @@
llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name);
if (!GV) {
- GV = new llvm::GlobalVariable(CGM.getModule().getContext(),
- ObjCTypes.ClassnfABITy, false,
- llvm::GlobalValue::ExternalLinkage,
- 0, Name, &CGM.getModule());
+ GV = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassnfABITy,
+ false, llvm::GlobalValue::ExternalLinkage,
+ 0, Name);
}
return GV;
@@ -5149,12 +5114,10 @@
std::string ClassName(getClassSymbolPrefix() + ID->getNameAsString());
llvm::GlobalVariable *ClassGV = GetClassGlobal(ClassName);
Entry =
- new llvm::GlobalVariable(CGM.getModule().getContext(),
- ObjCTypes.ClassnfABIPtrTy, false,
- llvm::GlobalValue::InternalLinkage,
+ new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassnfABIPtrTy,
+ false, llvm::GlobalValue::InternalLinkage,
ClassGV,
- "\01L_OBJC_CLASSLIST_REFERENCES_$_",
- &CGM.getModule());
+ "\01L_OBJC_CLASSLIST_REFERENCES_$_");
Entry->setAlignment(
CGM.getTargetData().getPrefTypeAlignment(
ObjCTypes.ClassnfABIPtrTy));
@@ -5174,12 +5137,10 @@
std::string ClassName(getClassSymbolPrefix() + ID->getNameAsString());
llvm::GlobalVariable *ClassGV = GetClassGlobal(ClassName);
Entry =
- new llvm::GlobalVariable(CGM.getModule().getContext(),
- ObjCTypes.ClassnfABIPtrTy, false,
- llvm::GlobalValue::InternalLinkage,
+ new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassnfABIPtrTy,
+ false, llvm::GlobalValue::InternalLinkage,
ClassGV,
- "\01L_OBJC_CLASSLIST_SUP_REFS_$_",
- &CGM.getModule());
+ "\01L_OBJC_CLASSLIST_SUP_REFS_$_");
Entry->setAlignment(
CGM.getTargetData().getPrefTypeAlignment(
ObjCTypes.ClassnfABIPtrTy));
@@ -5202,12 +5163,10 @@
std::string MetaClassName(getMetaclassSymbolPrefix() + ID->getNameAsString());
llvm::GlobalVariable *MetaClassGV = GetClassGlobal(MetaClassName);
Entry =
- new llvm::GlobalVariable(CGM.getModule().getContext(),
- ObjCTypes.ClassnfABIPtrTy, false,
+ new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassnfABIPtrTy, false,
llvm::GlobalValue::InternalLinkage,
MetaClassGV,
- "\01L_OBJC_CLASSLIST_SUP_REFS_$_",
- &CGM.getModule());
+ "\01L_OBJC_CLASSLIST_SUP_REFS_$_");
Entry->setAlignment(
CGM.getTargetData().getPrefTypeAlignment(
ObjCTypes.ClassnfABIPtrTy));
@@ -5291,11 +5250,9 @@
llvm::ConstantExpr::getBitCast(GetMethodVarName(Sel),
ObjCTypes.SelectorPtrTy);
Entry =
- new llvm::GlobalVariable(CGM.getModule().getContext(),
- ObjCTypes.SelectorPtrTy, false,
+ new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.SelectorPtrTy, false,
llvm::GlobalValue::InternalLinkage,
- Casted, "\01L_OBJC_SELECTOR_REFERENCES_",
- &CGM.getModule());
+ Casted, "\01L_OBJC_SELECTOR_REFERENCES_");
Entry->setSection("__DATA, __objc_selrefs, literal_pointers, no_dead_strip");
UsedGlobals.push_back(Entry);
}
@@ -5492,10 +5449,10 @@
CGM.getModule().getGlobalVariable("OBJC_EHTYPE_id");
if (!IDEHType)
IDEHType =
- new llvm::GlobalVariable(CGM.getModule().getContext(),
- ObjCTypes.EHTypeTy, false,
+ new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.EHTypeTy,
+ false,
llvm::GlobalValue::ExternalLinkage,
- 0, "OBJC_EHTYPE_id", &CGM.getModule());
+ 0, "OBJC_EHTYPE_id");
SelectorArgs.push_back(IDEHType);
HasCatchAll = true;
break;
@@ -5710,13 +5667,11 @@
// attribute, emit an external reference.
if (hasObjCExceptionAttribute(CGM.getContext(), ID))
return Entry =
- new llvm::GlobalVariable(CGM.getModule().getContext(),
- ObjCTypes.EHTypeTy, false,
+ new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.EHTypeTy, false,
llvm::GlobalValue::ExternalLinkage,
0,
(std::string("OBJC_EHTYPE_$_") +
- ID->getIdentifier()->getName()),
- &CGM.getModule());
+ ID->getIdentifier()->getName()));
}
// Otherwise we need to either make a new entry or fill in the
@@ -5727,10 +5682,10 @@
llvm::GlobalVariable *VTableGV =
CGM.getModule().getGlobalVariable(VTableName);
if (!VTableGV)
- VTableGV = new llvm::GlobalVariable(CGM.getModule().getContext(),
- ObjCTypes.Int8PtrTy, false,
+ VTableGV = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.Int8PtrTy,
+ false,
llvm::GlobalValue::ExternalLinkage,
- 0, VTableName, &CGM.getModule());
+ 0, VTableName);
llvm::Value *VTableIdx = llvm::ConstantInt::get(llvm::Type::Int32Ty, 2);
@@ -5743,13 +5698,11 @@
if (Entry) {
Entry->setInitializer(Init);
} else {
- Entry = new llvm::GlobalVariable(CGM.getModule().getContext(),
- ObjCTypes.EHTypeTy, false,
+ Entry = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.EHTypeTy, false,
llvm::GlobalValue::WeakAnyLinkage,
Init,
(std::string("OBJC_EHTYPE_$_") +
- ID->getIdentifier()->getName()),
- &CGM.getModule());
+ ID->getIdentifier()->getName()));
}
if (CGM.getLangOptions().getVisibilityMode() == LangOptions::Hidden)
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=75028&r1=75027&r2=75028&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Wed Jul 8 14:05:04 2009
@@ -216,11 +216,10 @@
if (!Ctors.empty()) {
llvm::ArrayType *AT = llvm::ArrayType::get(CtorStructTy, Ctors.size());
- new llvm::GlobalVariable(TheModule.getContext(), AT, false,
+ new llvm::GlobalVariable(TheModule, AT, false,
llvm::GlobalValue::AppendingLinkage,
llvm::ConstantArray::get(AT, Ctors),
- GlobalName,
- &TheModule);
+ GlobalName);
}
}
@@ -234,9 +233,9 @@
Annotations.size()),
Annotations);
llvm::GlobalValue *gv =
- new llvm::GlobalVariable(TheModule.getContext(), Array->getType(), false,
+ new llvm::GlobalVariable(TheModule, Array->getType(), false,
llvm::GlobalValue::AppendingLinkage, Array,
- "llvm.global.annotations", &TheModule);
+ "llvm.global.annotations");
gv->setSection("llvm.metadata");
}
@@ -436,10 +435,10 @@
llvm::ArrayType *ATy = llvm::ArrayType::get(i8PTy, UsedArray.size());
llvm::GlobalVariable *GV =
- new llvm::GlobalVariable(getModule().getContext(), ATy, false,
+ new llvm::GlobalVariable(getModule(), ATy, false,
llvm::GlobalValue::AppendingLinkage,
llvm::ConstantArray::get(ATy, UsedArray),
- "llvm.used", &getModule());
+ "llvm.used");
GV->setSection("llvm.metadata");
}
@@ -494,14 +493,14 @@
// created to hold the bytes of the strings.
const char *StringPrefix = getContext().Target.getStringSymbolPrefix(true);
llvm::GlobalValue *annoGV =
- new llvm::GlobalVariable(M->getContext(), anno->getType(), false,
+ new llvm::GlobalVariable(*M, anno->getType(), false,
llvm::GlobalValue::InternalLinkage, anno,
- GV->getName() + StringPrefix, M);
+ GV->getName() + StringPrefix);
// translation unit name string, emitted into the llvm.metadata section.
llvm::GlobalValue *unitGV =
- new llvm::GlobalVariable(M->getContext(), unit->getType(), false,
+ new llvm::GlobalVariable(*M, unit->getType(), false,
llvm::GlobalValue::InternalLinkage, unit,
- StringPrefix, M);
+ StringPrefix);
// Create the ConstantStruct for the global annotation.
llvm::Constant *Fields[4] = {
@@ -719,10 +718,9 @@
}
llvm::GlobalVariable *GV =
- new llvm::GlobalVariable(getModule().getContext(),
- Ty->getElementType(), false,
+ new llvm::GlobalVariable(getModule(), Ty->getElementType(), false,
llvm::GlobalValue::ExternalLinkage,
- 0, "", &getModule(),
+ 0, "", 0,
false, Ty->getAddressSpace());
GV->setName(MangledName);
@@ -1246,10 +1244,9 @@
// likely see an opaque error message. This is a general issue with relying
// on particular names.
llvm::GlobalVariable *GV =
- new llvm::GlobalVariable(getModule().getContext(), Ty, false,
+ new llvm::GlobalVariable(getModule(), Ty, false,
llvm::GlobalVariable::ExternalLinkage, 0,
- "__CFConstantStringClassReference",
- &getModule());
+ "__CFConstantStringClassReference");
// Decay array -> ptr
CFConstantStringClassRef =
@@ -1300,9 +1297,9 @@
isConstant = true;
}
llvm::GlobalVariable *GV =
- new llvm::GlobalVariable(getModule().getContext(), C->getType(), isConstant,
+ new llvm::GlobalVariable(getModule(), C->getType(), isConstant,
llvm::GlobalValue::InternalLinkage,
- C, Prefix, &getModule());
+ C, Prefix);
if (Sect)
GV->setSection(Sect);
if (isUTF16) {
@@ -1322,10 +1319,9 @@
// The struct.
C = llvm::ConstantStruct::get(STy, Fields);
- GV = new llvm::GlobalVariable(getModule().getContext(), C->getType(), true,
+ GV = new llvm::GlobalVariable(getModule(), C->getType(), true,
llvm::GlobalVariable::InternalLinkage, C,
- getContext().Target.getCFStringSymbolPrefix(),
- &getModule());
+ getContext().Target.getCFStringSymbolPrefix());
if (const char *Sect = getContext().Target.getCFStringSection())
GV->setSection(Sect);
Entry.setValue(GV);
@@ -1383,10 +1379,9 @@
llvm::Constant *C = llvm::ConstantArray::get(str, false);
// Create a global variable for this string
- return new llvm::GlobalVariable(CGM.getModule().getContext(),
- C->getType(), constant,
+ return new llvm::GlobalVariable(CGM.getModule(), C->getType(), constant,
llvm::GlobalValue::InternalLinkage,
- C, GlobalName, &CGM.getModule());
+ C, GlobalName);
}
/// GetAddrOfConstantString - Returns a pointer to a character array
More information about the cfe-commits
mailing list