X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FDebugInfo.h;h=d5d235c0a76c5de54e1e4adb3f4238d5ad32ec42;hb=341ea7ddf6b09d77bfe3c65664773b683386156c;hp=12cd40fcce25f8f5576d254e63822f5dc51a4478;hpb=f56f1dfecc04078dd76121cf06dae4024372f329;p=oota-llvm.git diff --git a/include/llvm/DebugInfo.h b/include/llvm/DebugInfo.h index 12cd40fcce2..d5d235c0a76 100644 --- a/include/llvm/DebugInfo.h +++ b/include/llvm/DebugInfo.h @@ -17,12 +17,12 @@ #ifndef LLVM_DEBUGINFO_H #define LLVM_DEBUGINFO_H -#include "llvm/Support/Casting.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/IR/Metadata.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/Dwarf.h" namespace llvm { @@ -64,20 +64,22 @@ class DIDescriptor { public: enum { - FlagPrivate = 1 << 0, - FlagProtected = 1 << 1, - FlagFwdDecl = 1 << 2, - FlagAppleBlock = 1 << 3, - FlagBlockByrefStruct = 1 << 4, - FlagVirtual = 1 << 5, - FlagArtificial = 1 << 6, - FlagExplicit = 1 << 7, - FlagPrototyped = 1 << 8, + FlagPrivate = 1 << 0, + FlagProtected = 1 << 1, + FlagFwdDecl = 1 << 2, + FlagAppleBlock = 1 << 3, + FlagBlockByrefStruct = 1 << 4, + FlagVirtual = 1 << 5, + FlagArtificial = 1 << 6, + FlagExplicit = 1 << 7, + FlagPrototyped = 1 << 8, FlagObjcClassComplete = 1 << 9, - FlagObjectPointer = 1 << 10, - FlagVector = 1 << 11, - FlagStaticMember = 1 << 12, - FlagIndirectVariable = 1 << 13 + FlagObjectPointer = 1 << 10, + FlagVector = 1 << 11, + FlagStaticMember = 1 << 12, + FlagIndirectVariable = 1 << 13, + FlagLValueReference = 1 << 14, + FlagRValueReference = 1 << 15 }; protected: @@ -281,7 +283,7 @@ protected: void printInternal(raw_ostream &OS) const; public: - DIType(const MDNode *N = 0) : DIScope(N) {} + explicit DIType(const MDNode *N = 0) : DIScope(N) {} /// Verify - Verify that a type descriptor is well formed. bool Verify() const; @@ -313,6 +315,12 @@ public: } bool isVector() const { return (getFlags() & FlagVector) != 0; } bool isStaticMember() const { return (getFlags() & FlagStaticMember) != 0; } + bool isLValueReference() const { + return (getFlags() & FlagLValueReference) != 0; + } + bool isRValueReference() const { + return (getFlags() & FlagRValueReference) != 0; + } bool isValid() const { return DbgNode && isType(); } /// replaceAllUsesWith - Replace all uses of debug info referenced by @@ -377,7 +385,6 @@ public: DIArray getTypeArray() const { return getFieldAs(10); } void setTypeArray(DIArray Elements, DIArray TParams = DIArray()); - void addMember(DIDescriptor D); unsigned getRunTimeLang() const { return getUnsignedField(11); } DITypeRef getContainingType() const { return getFieldAs(12); } void setContainingType(DICompositeType ContainingType); @@ -420,6 +427,7 @@ public: DIArray getImportedEntities() const; StringRef getSplitDebugFilename() const { return getStringField(12); } + unsigned getEmissionKind() const { return getUnsignedField(13); } /// Verify - Verify that a compile unit is well formed. bool Verify() const; @@ -470,6 +478,19 @@ public: return (getUnsignedField(13) & FlagPrototyped) != 0; } + /// Return true if this subprogram is a C++11 reference-qualified + /// non-static member function (void foo() &). + unsigned isLValueReference() const { + return (getUnsignedField(13) & FlagLValueReference) != 0; + } + + /// Return true if this subprogram is a C++11 + /// rvalue-reference-qualified non-static member function + /// (void foo() &&). + unsigned isRValueReference() const { + return (getUnsignedField(13) & FlagRValueReference) != 0; + } + unsigned isOptimized() const; /// Verify - Verify that a subprogram descriptor is well formed. @@ -501,6 +522,7 @@ public: DIScope getContext() const { return getFieldAs(2); } unsigned getLineNumber() const { return getUnsignedField(3); } unsigned getColumnNumber() const { return getUnsignedField(4); } + unsigned getDiscriminator() const { return getUnsignedField(5); } bool Verify() const; }; @@ -533,6 +555,13 @@ public: bool Verify() const; }; +/// DIUnspecifiedParameter - This is a wrapper for unspecified parameters. +class DIUnspecifiedParameter : public DIDescriptor { +public: + explicit DIUnspecifiedParameter(const MDNode *N = 0) : DIDescriptor(N) {} + bool Verify() const; +}; + /// DITemplateTypeParameter - This is a wrapper for template type parameter. class DITemplateTypeParameter : public DIDescriptor { public: @@ -672,6 +701,27 @@ public: StringRef getFilename() const { return getScope().getFilename(); } StringRef getDirectory() const { return getScope().getDirectory(); } bool Verify() const; + bool atSameLineAs(const DILocation &Other) const { + return (getLineNumber() == Other.getLineNumber() && + getFilename() == Other.getFilename()); + } + /// getDiscriminator - DWARF discriminators are used to distinguish + /// identical file locations for instructions that are on different + /// basic blocks. If two instructions are inside the same lexical block + /// and are in different basic blocks, we create a new lexical block + /// with identical location as the original but with a different + /// discriminator value (lib/Transforms/Util/AddDiscriminators.cpp + /// for details). + unsigned getDiscriminator() const { + // Since discriminators are associated with lexical blocks, make + // sure this location is a lexical block before retrieving its + // value. + return getScope().isLexicalBlock() + ? getFieldAs(2).getDiscriminator() + : 0; + } + unsigned computeNewDiscriminator(LLVMContext &Ctx); + DILocation copyWithNewScope(LLVMContext &Ctx, DILexicalBlock NewScope); }; class DIObjCProperty : public DIDescriptor { @@ -753,6 +803,15 @@ DIVariable cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext); /// Construct DITypeIdentifierMap by going through retained types of each CU. DITypeIdentifierMap generateDITypeIdentifierMap(const NamedMDNode *CU_Nodes); +/// Strip debug info in the module if it exists. +/// To do this, we remove all calls to the debugger intrinsics and any named +/// metadata for debugging. We also remove debug locations for instructions. +/// Return true if module is modified. +bool StripDebugInfo(Module &M); + +/// Return Debug Info Metadata Version by checking module flags. +unsigned getDebugMetadataVersionFromModule(const Module &M); + /// DebugInfoFinder tries to list all debug info MDNodes used in a module. To /// list debug info MDNodes used by an instruction, DebugInfoFinder uses /// processDeclare, processValue and processLocation to handle DbgDeclareInst,