summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-07-18 19:11:29 +0000
committerEric Christopher <echristo@gmail.com>2013-07-18 19:11:29 +0000
commit6abb4d2ef28f2c688498a10dfe0e4bd1b36882e3 (patch)
treee3a3627d25507b8ae89edc1bebde7e86be57980b /lib
parentef69f54fec8ba71b6624226e5e7bf7675b013bac (diff)
Remove DIBuilder cache of variable TheCU and change the few
uses that wanted it. Also change the interface for createCompileUnit to compensate. Fix comments that refer to TheCU as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186599 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/IR/DIBuilder.cpp32
-rw-r--r--lib/Transforms/Instrumentation/DebugIR.cpp6
2 files changed, 21 insertions, 17 deletions
diff --git a/lib/IR/DIBuilder.cpp b/lib/IR/DIBuilder.cpp
index 6cb13a0844c..3005f777426 100644
--- a/lib/IR/DIBuilder.cpp
+++ b/lib/IR/DIBuilder.cpp
@@ -30,7 +30,7 @@ static Constant *GetTagConstant(LLVMContext &VMContext, unsigned Tag) {
}
DIBuilder::DIBuilder(Module &m)
- : M(m), VMContext(M.getContext()), TheCU(0), TempEnumTypes(0),
+ : M(m), VMContext(M.getContext()), TempEnumTypes(0),
TempRetainTypes(0), TempSubprograms(0), TempGVs(0), DeclareFn(0),
ValueFn(0)
{}
@@ -86,10 +86,11 @@ static MDNode *createFilePathPair(LLVMContext &VMContext, StringRef Filename,
/// createCompileUnit - A CompileUnit provides an anchor for all debugging
/// information generated during this instance of compilation.
-void DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename,
- StringRef Directory, StringRef Producer,
- bool isOptimized, StringRef Flags,
- unsigned RunTimeVer, StringRef SplitName) {
+DICompileUnit DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename,
+ StringRef Directory,
+ StringRef Producer, bool isOptimized,
+ StringRef Flags, unsigned RunTimeVer,
+ StringRef SplitName) {
assert(((Lang <= dwarf::DW_LANG_Python && Lang >= dwarf::DW_LANG_C89) ||
(Lang <= dwarf::DW_LANG_hi_user && Lang >= dwarf::DW_LANG_lo_user)) &&
"Invalid Language tag");
@@ -121,11 +122,14 @@ void DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename,
TempImportedModules,
MDString::get(VMContext, SplitName)
};
- TheCU = DICompileUnit(MDNode::get(VMContext, Elts));
+
+ MDNode *CUNode = MDNode::get(VMContext, Elts);
// Create a named metadata so that it is easier to find cu in a module.
NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.cu");
- NMD->addOperand(TheCU);
+ NMD->addOperand(CUNode);
+
+ return DICompileUnit(CUNode);
}
static DIImportedEntity
@@ -216,7 +220,7 @@ DIBasicType DIBuilder::createUnspecifiedType(StringRef Name) {
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_unspecified_type),
NULL, // Filename
- NULL, //TheCU,
+ NULL, // Unused
MDString::get(VMContext, Name),
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
@@ -244,7 +248,7 @@ DIBuilder::createBasicType(StringRef Name, uint64_t SizeInBits,
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_base_type),
NULL, // File/directory name
- NULL, //TheCU,
+ NULL, // Unused
MDString::get(VMContext, Name),
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
@@ -263,7 +267,7 @@ DIDerivedType DIBuilder::createQualifiedType(unsigned Tag, DIType FromTy) {
Value *Elts[] = {
GetTagConstant(VMContext, Tag),
NULL, // Filename
- NULL, //TheCU,
+ NULL, // Unused
MDString::get(VMContext, StringRef()), // Empty name.
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
@@ -283,7 +287,7 @@ DIBuilder::createPointerType(DIType PointeeTy, uint64_t SizeInBits,
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_pointer_type),
NULL, // Filename
- NULL, //TheCU,
+ NULL, // Unused
MDString::get(VMContext, Name),
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
@@ -301,7 +305,7 @@ DIDerivedType DIBuilder::createMemberPointerType(DIType PointeeTy,
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_ptr_to_member_type),
NULL, // Filename
- NULL, //TheCU,
+ NULL, // Unused
NULL,
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
ConstantInt::get(Type::getInt64Ty(VMContext), 0),
@@ -737,7 +741,7 @@ DICompositeType DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBits,
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_array_type),
NULL, // Filename/Directory,
- NULL, //TheCU,
+ NULL, // Unused
MDString::get(VMContext, ""),
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
ConstantInt::get(Type::getInt64Ty(VMContext), Size),
@@ -760,7 +764,7 @@ DICompositeType DIBuilder::createVectorType(uint64_t Size, uint64_t AlignInBits,
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_array_type),
NULL, // Filename/Directory,
- NULL, //TheCU,
+ NULL, // Unused
MDString::get(VMContext, ""),
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
ConstantInt::get(Type::getInt64Ty(VMContext), Size),
diff --git a/lib/Transforms/Instrumentation/DebugIR.cpp b/lib/Transforms/Instrumentation/DebugIR.cpp
index cea19e6510d..651381d88b5 100644
--- a/lib/Transforms/Instrumentation/DebugIR.cpp
+++ b/lib/Transforms/Instrumentation/DebugIR.cpp
@@ -289,9 +289,9 @@ private:
"LLVM Version " STR(LLVM_VERSION_MAJOR) "." STR(LLVM_VERSION_MINOR);
}
- Builder.createCompileUnit(dwarf::DW_LANG_C99, Filename, Directory, Producer,
- IsOptimized, Flags, RuntimeVersion);
- CUNode = Builder.getCU();
+ CUNode =
+ Builder.createCompileUnit(dwarf::DW_LANG_C99, Filename, Directory,
+ Producer, IsOptimized, Flags, RuntimeVersion);
if (CUToReplace)
CUToReplace->replaceAllUsesWith(const_cast<MDNode *>(CUNode));