X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FAnalysis%2FDIBuilder.cpp;h=4fe0fc26f1a6d46b9ba929f51c9820795000d605;hb=2a5422b1a6955977d05af48222c86c77c7549484;hp=f0bdc48cf3c23a17bdf10b7fa5e9774940a1d575;hpb=9f90e8760fda131db8311f976c6bbeb66abbaa05;p=oota-llvm.git diff --git a/lib/Analysis/DIBuilder.cpp b/lib/Analysis/DIBuilder.cpp index f0bdc48cf3c..4fe0fc26f1a 100644 --- a/lib/Analysis/DIBuilder.cpp +++ b/lib/Analysis/DIBuilder.cpp @@ -17,6 +17,7 @@ #include "llvm/IntrinsicInst.h" #include "llvm/Module.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/Dwarf.h" using namespace llvm; @@ -46,16 +47,16 @@ void DIBuilder::finalize() { DIType(TempSubprograms).replaceAllUsesWith(SPs); for (unsigned i = 0, e = SPs.getNumElements(); i != e; ++i) { DISubprogram SP(SPs.getElement(i)); + SmallVector Variables; if (NamedMDNode *NMD = getFnSpecificMDNode(M, SP)) { - SmallVector Variables; for (unsigned ii = 0, ee = NMD->getNumOperands(); ii != ee; ++ii) Variables.push_back(NMD->getOperand(ii)); - if (MDNode *Temp = SP.getVariablesNodes()) { - DIArray AV = getOrCreateArray(Variables); - DIType(Temp).replaceAllUsesWith(AV); - } NMD->eraseFromParent(); } + if (MDNode *Temp = SP.getVariablesNodes()) { + DIArray AV = getOrCreateArray(Variables); + DIType(Temp).replaceAllUsesWith(AV); + } } DIArray GVs = getOrCreateArray(AllGVs); @@ -228,12 +229,13 @@ DIType DIBuilder::createPointerType(DIType PointeeTy, uint64_t SizeInBits, return DIType(MDNode::get(VMContext, Elts)); } -/// createReferenceType - Create debugging information entry for a reference. -DIType DIBuilder::createReferenceType(DIType RTy) { +/// createReferenceType - Create debugging information entry for a reference +/// type. +DIType DIBuilder::createReferenceType(unsigned Tag, DIType RTy) { assert(RTy.Verify() && "Unable to create reference type"); // References are encoded in DIDerivedType format. Value *Elts[] = { - GetTagConstant(VMContext, dwarf::DW_TAG_reference_type), + GetTagConstant(VMContext, Tag), NULL, // TheCU, NULL, // Name NULL, // Filename @@ -385,16 +387,21 @@ DIType DIBuilder::createObjCIVar(StringRef Name, /// createObjCProperty - Create debugging information entry for Objective-C /// property. -DIObjCProperty DIBuilder::createObjCProperty(StringRef Name, +DIObjCProperty DIBuilder::createObjCProperty(StringRef Name, + DIFile File, unsigned LineNumber, StringRef GetterName, StringRef SetterName, - unsigned PropertyAttributes) { + unsigned PropertyAttributes, + DIType Ty) { Value *Elts[] = { - GetTagConstant(VMContext, dwarf::DW_TAG_APPLE_Property), + GetTagConstant(VMContext, dwarf::DW_TAG_APPLE_property), MDString::get(VMContext, Name), + File, + ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber), MDString::get(VMContext, GetterName), MDString::get(VMContext, SetterName), - ConstantInt::get(Type::getInt32Ty(VMContext), PropertyAttributes) + ConstantInt::get(Type::getInt32Ty(VMContext), PropertyAttributes), + Ty }; return DIObjCProperty(MDNode::get(VMContext, Elts)); } @@ -541,7 +548,8 @@ DIType DIBuilder::createEnumerationType(DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits, - DIArray Elements) { + DIArray Elements, + DIType ClassType, unsigned Flags) { // TAG_enumeration_type is encoded in DICompositeType format. Value *Elts[] = { GetTagConstant(VMContext, dwarf::DW_TAG_enumeration_type), @@ -552,8 +560,8 @@ DIType DIBuilder::createEnumerationType(DIDescriptor Scope, StringRef Name, ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits), ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits), ConstantInt::get(Type::getInt32Ty(VMContext), 0), - ConstantInt::get(Type::getInt32Ty(VMContext), 0), - NULL, + ConstantInt::get(Type::getInt32Ty(VMContext), Flags), + ClassType, Elements, ConstantInt::get(Type::getInt32Ty(VMContext), 0), llvm::Constant::getNullValue(Type::getInt32Ty(VMContext)), @@ -671,12 +679,13 @@ DIType DIBuilder::createTemporaryType(DIFile F) { /// createForwardDecl - Create a temporary forward-declared type that /// can be RAUW'd if the full type is seen. -DIType DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, DIFile F, +DIType DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, + DIDescriptor Scope, DIFile F, unsigned Line, unsigned RuntimeLang) { // Create a temporary MDNode. Value *Elts[] = { GetTagConstant(VMContext, Tag), - NULL, // TheCU + getNonCompileUnitScope(Scope), MDString::get(VMContext, Name), F, ConstantInt::get(Type::getInt32Ty(VMContext), Line), @@ -820,6 +829,7 @@ DISubprogram DIBuilder::createFunction(DIDescriptor Context, DIFile File, unsigned LineNo, DIType Ty, bool isLocalToUnit, bool isDefinition, + unsigned ScopeLine, unsigned Flags, bool isOptimized, Function *Fn, MDNode *TParams, @@ -849,7 +859,8 @@ DISubprogram DIBuilder::createFunction(DIDescriptor Context, Fn, TParams, Decl, - THolder + THolder, + ConstantInt::get(Type::getInt32Ty(VMContext), ScopeLine) }; MDNode *Node = MDNode::get(VMContext, Elts); @@ -897,7 +908,9 @@ DISubprogram DIBuilder::createMethod(DIDescriptor Context, Fn, TParam, llvm::Constant::getNullValue(Type::getInt32Ty(VMContext)), - THolder + THolder, + // FIXME: Do we want to use different scope/lines? + ConstantInt::get(Type::getInt32Ty(VMContext), LineNo) }; MDNode *Node = MDNode::get(VMContext, Elts); return DISubprogram(Node);