diff options
99 files changed, 1473 insertions, 1354 deletions
diff --git a/include/llvm/DIBuilder.h b/include/llvm/DIBuilder.h index 4f0aa07130..a7a8c53e2f 100644 --- a/include/llvm/DIBuilder.h +++ b/include/llvm/DIBuilder.h @@ -46,6 +46,7 @@ namespace llvm { class DITemplateTypeParameter; class DITemplateValueParameter; class DIObjCProperty; + class DIImportedModule; class DIBuilder { private: @@ -566,6 +567,11 @@ namespace llvm { DILexicalBlock createLexicalBlock(DIDescriptor Scope, DIFile File, unsigned Line, unsigned Col); + + /// \brief Create a descriptor for an imported module. + /// @param NS The namespace being imported here + DIImportedModule createImportedModule(DINameSpace NS); + /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call. /// @param Storage llvm::Value of the variable /// @param VarInfo Variable's debug info descriptor. diff --git a/include/llvm/DebugInfo.h b/include/llvm/DebugInfo.h index 15f91870a5..0c8cb5d9e7 100644 --- a/include/llvm/DebugInfo.h +++ b/include/llvm/DebugInfo.h @@ -44,6 +44,7 @@ namespace llvm { class DIVariable; class DIType; class DIObjCProperty; + class DIImportedModule; /// DIDescriptor - A thin wraper around MDNode to access encoded debug info. /// This should not be stored in a container, because the underlying MDNode @@ -125,6 +126,7 @@ namespace llvm { bool isTemplateTypeParameter() const; bool isTemplateValueParameter() const; bool isObjCProperty() const; + bool isImportedModule() const; /// print - print descriptor. void print(raw_ostream &OS) const; @@ -167,6 +169,7 @@ namespace llvm { StringRef getFilename() const; StringRef getDirectory() const; + DIArray getImportedModules() const { return getFieldAs<DIArray>(2); } }; /// DIFile - This is a wrapper for a file. @@ -188,19 +191,19 @@ namespace llvm { public: explicit DICompileUnit(const MDNode *N = 0) : DIScope(N) {} - unsigned getLanguage() const { return getUnsignedField(2); } - StringRef getProducer() const { return getStringField(3); } + unsigned getLanguage() const { return getUnsignedField(3); } + StringRef getProducer() const { return getStringField(4); } - bool isOptimized() const { return getUnsignedField(4) != 0; } - StringRef getFlags() const { return getStringField(5); } - unsigned getRunTimeVersion() const { return getUnsignedField(6); } + bool isOptimized() const { return getUnsignedField(5) != 0; } + StringRef getFlags() const { return getStringField(6); } + unsigned getRunTimeVersion() const { return getUnsignedField(7); } DIArray getEnumTypes() const; DIArray getRetainedTypes() const; DIArray getSubprograms() const; DIArray getGlobalVariables() const; - StringRef getSplitDebugFilename() const { return getStringField(11); } + StringRef getSplitDebugFilename() const { return getStringField(12); } /// Verify - Verify that a compile unit is well formed. bool Verify() const; @@ -236,15 +239,15 @@ namespace llvm { explicit DIType(const MDNode *N); explicit DIType() {} - DIScope getContext() const { return getFieldAs<DIScope>(2); } - StringRef getName() const { return getStringField(3); } - unsigned getLineNumber() const { return getUnsignedField(4); } - uint64_t getSizeInBits() const { return getUInt64Field(5); } - uint64_t getAlignInBits() const { return getUInt64Field(6); } + DIScope getContext() const { return getFieldAs<DIScope>(3); } + StringRef getName() const { return getStringField(4); } + unsigned getLineNumber() const { return getUnsignedField(5); } + uint64_t getSizeInBits() const { return getUInt64Field(6); } + uint64_t getAlignInBits() const { return getUInt64Field(7); } // FIXME: Offset is only used for DW_TAG_member nodes. Making every type // carry this is just plain insane. - uint64_t getOffsetInBits() const { return getUInt64Field(7); } - unsigned getFlags() const { return getUnsignedField(8); } + uint64_t getOffsetInBits() const { return getUInt64Field(8); } + unsigned getFlags() const { return getUnsignedField(9); } bool isPrivate() const { return (getFlags() & FlagPrivate) != 0; } @@ -297,7 +300,7 @@ namespace llvm { public: explicit DIBasicType(const MDNode *N = 0) : DIType(N) {} - unsigned getEncoding() const { return getUnsignedField(9); } + unsigned getEncoding() const { return getUnsignedField(10); } /// Verify - Verify that a basic type descriptor is well formed. bool Verify() const; @@ -316,7 +319,7 @@ namespace llvm { explicit DIDerivedType(const MDNode *N = 0) : DIType(N, true, true) {} - DIType getTypeDerivedFrom() const { return getFieldAs<DIType>(9); } + DIType getTypeDerivedFrom() const { return getFieldAs<DIType>(10); } /// getOriginalTypeSize - If this type is derived from a base type then /// return base type size. @@ -328,12 +331,12 @@ namespace llvm { DIType getClassType() const { assert(getTag() == dwarf::DW_TAG_ptr_to_member_type); - return getFieldAs<DIType>(10); + return getFieldAs<DIType>(11); } Constant *getConstant() const { assert((getTag() == dwarf::DW_TAG_member) && isStaticMember()); - return getConstantField(10); + return getConstantField(11); } /// Verify - Verify that a derived type descriptor is well formed. @@ -353,14 +356,14 @@ namespace llvm { DbgNode = 0; } - DIArray getTypeArray() const { return getFieldAs<DIArray>(10); } + DIArray getTypeArray() const { return getFieldAs<DIArray>(11); } void setTypeArray(DIArray Elements, DIArray TParams = DIArray()); - unsigned getRunTimeLang() const { return getUnsignedField(11); } + unsigned getRunTimeLang() const { return getUnsignedField(12); } DICompositeType getContainingType() const { - return getFieldAs<DICompositeType>(12); + return getFieldAs<DICompositeType>(13); } void setContainingType(DICompositeType ContainingType); - DIArray getTemplateParams() const { return getFieldAs<DIArray>(13); } + DIArray getTemplateParams() const { return getFieldAs<DIArray>(14); } /// Verify - Verify that a composite type descriptor is well formed. bool Verify() const; @@ -412,62 +415,62 @@ namespace llvm { public: explicit DISubprogram(const MDNode *N = 0) : DIScope(N) {} - DIScope getContext() const { return getFieldAs<DIScope>(2); } - StringRef getName() const { return getStringField(3); } - StringRef getDisplayName() const { return getStringField(4); } - StringRef getLinkageName() const { return getStringField(5); } - unsigned getLineNumber() const { return getUnsignedField(6); } - DICompositeType getType() const { return getFieldAs<DICompositeType>(7); } + DIScope getContext() const { return getFieldAs<DIScope>(3); } + StringRef getName() const { return getStringField(4); } + StringRef getDisplayName() const { return getStringField(5); } + StringRef getLinkageName() const { return getStringField(6); } + unsigned getLineNumber() const { return getUnsignedField(7); } + DICompositeType getType() const { return getFieldAs<DICompositeType>(8); } /// getReturnTypeName - Subprogram return types are encoded either as /// DIType or as DICompositeType. StringRef getReturnTypeName() const { - DICompositeType DCT(getFieldAs<DICompositeType>(7)); + DICompositeType DCT(getFieldAs<DICompositeType>(8)); if (DCT.Verify()) { DIArray A = DCT.getTypeArray(); DIType T(A.getElement(0)); return T.getName(); } - DIType T(getFieldAs<DIType>(7)); + DIType T(getFieldAs<DIType>(8)); return T.getName(); } /// isLocalToUnit - Return true if this subprogram is local to the current /// compile unit, like 'static' in C. - unsigned isLocalToUnit() const { return getUnsignedField(8); } - unsigned isDefinition() const { return getUnsignedField(9); } + unsigned isLocalToUnit() const { return getUnsignedField(9); } + unsigned isDefinition() const { return getUnsignedField(10); } - unsigned getVirtuality() const { return getUnsignedField(10); } - unsigned getVirtualIndex() const { return getUnsignedField(11); } + unsigned getVirtuality() const { return getUnsignedField(11); } + unsigned getVirtualIndex() const { return getUnsignedField(12); } DICompositeType getContainingType() const { - return getFieldAs<DICompositeType>(12); + return getFieldAs<DICompositeType>(13); } unsigned getFlags() const { - return getUnsignedField(13); + return getUnsignedField(14); } unsigned isArtificial() const { - return (getUnsignedField(13) & FlagArtificial) != 0; + return (getFlags() & FlagArtificial) != 0; } /// isPrivate - Return true if this subprogram has "private" /// access specifier. bool isPrivate() const { - return (getUnsignedField(13) & FlagPrivate) != 0; + return (getFlags() & FlagPrivate) != 0; } /// isProtected - Return true if this subprogram has "protected" /// access specifier. bool isProtected() const { - return (getUnsignedField(13) & FlagProtected) != 0; + return (getFlags() & FlagProtected) != 0; } /// isExplicit - Return true if this subprogram is marked as explicit. bool isExplicit() const { - return (getUnsignedField(13) & FlagExplicit) != 0; + return (getFlags() & FlagExplicit) != 0; } /// isPrototyped - Return true if this subprogram is prototyped. bool isPrototyped() const { - return (getUnsignedField(13) & Flag |