summaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-03-27 00:07:26 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-03-27 00:07:26 +0000
commit342d92c7a0adeabc9ab00f3f0d88d739fe7da4c7 (patch)
tree20efeadb9cd6b7049beff91505093017668123ee /include/llvm
parentb7e11e400dabced046e7ec53a66926716563bb36 (diff)
downloadllvm-342d92c7a0adeabc9ab00f3f0d88d739fe7da4c7.tar.gz
llvm-342d92c7a0adeabc9ab00f3f0d88d739fe7da4c7.tar.bz2
llvm-342d92c7a0adeabc9ab00f3f0d88d739fe7da4c7.tar.xz
Adding DIImportedModules to DIScopes.
This is just the basic groundwork for supporting DW_TAG_imported_module but I wanted to commit this before pushing support further into Clang or LLVM so that this rather churny change is isolated from the rest of the work. The major churn here is obviously adding another field (within the common DIScope prefix) to all DIScopes (files, classes, namespaces, lexical scopes, etc). This should be the last big churny change needed for DW_TAG_imported_module/using directive support/PR14606. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178099 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/DIBuilder.h6
-rw-r--r--include/llvm/DebugInfo.h116
2 files changed, 70 insertions, 52 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) & FlagPrototyped) != 0;
+ return (getFlags() & FlagPrototyped) != 0;
}
unsigned isOptimized() const;
@@ -475,7 +478,7 @@ namespace llvm {
/// getScopeLineNumber - Get the beginning of the scope of the
/// function, not necessarily where the name of the program
/// starts.
- unsigned getScopeLineNumber() const { return getUnsignedField(19); }
+ unsigned getScopeLineNumber() const { return getUnsignedField(20); }
/// Verify - Verify that a subprogram descriptor is well formed.
bool Verify() const;
@@ -484,11 +487,11 @@ namespace llvm {
/// information for the function F.
bool describes(const Function *F);
- Function *getFunction() const { return getFunctionField(15); }
- void replaceFunction(Function *F) { replaceFunctionField(15, F); }
- DIArray getTemplateParams() const { return getFieldAs<DIArray>(16); }
+ Function *getFunction() const { return getFunctionField(16); }
+ void replaceFunction(Function *F) { replaceFunctionField(16, F); }
+ DIArray getTemplateParams() const { return getFieldAs<DIArray>(17); }
DISubprogram getFunctionDeclaration() const {
- return getFieldAs<DISubprogram>(17);
+ return getFieldAs<DISubprogram>(18);
}
MDNode *getVariablesNodes() const;
DIArray getVariables() const;
@@ -592,9 +595,9 @@ namespace llvm {
class DILexicalBlock : public DIScope {
public:
explicit DILexicalBlock(const MDNode *N = 0) : DIScope(N) {}
- DIScope getContext() const { return getFieldAs<DIScope>(2); }
- unsigned getLineNumber() const { return getUnsignedField(3); }
- unsigned getColumnNumber() const { return getUnsignedField(4); }
+ DIScope getContext() const { return getFieldAs<DIScope>(3); }
+ unsigned getLineNumber() const { return getUnsignedField(4); }
+ unsigned getColumnNumber() const { return getUnsignedField(5); }
bool Verify() const;
};
@@ -606,7 +609,7 @@ namespace llvm {
DIScope getContext() const { if (getScope().isSubprogram()) return getScope(); return getScope().getContext(); }
unsigned getLineNumber() const { return getScope().getLineNumber(); }
unsigned getColumnNumber() const { return getScope().getColumnNumber(); }
- DILexicalBlock getScope() const { return getFieldAs<DILexicalBlock>(2); }
+ DILexicalBlock getScope() const { return getFieldAs<DILexicalBlock>(3); }
bool Verify() const;
};
@@ -616,9 +619,9 @@ namespace llvm {
void printInternal(raw_ostream &OS) const;
public:
explicit DINameSpace(const MDNode *N = 0) : DIScope(N) {}
- DIScope getContext() const { return getFieldAs<DIScope>(2); }
- StringRef getName() const { return getStringField(3); }
- unsigned getLineNumber() const { return getUnsignedField(4); }
+ DIScope getContext() const { return getFieldAs<DIScope>(3); }
+ StringRef getName() const { return getStringField(4); }
+ unsigned getLineNumber() const { return getUnsignedField(5); }
bool Verify() const;
};
@@ -678,6 +681,15 @@ namespace llvm {
bool Verify() const;
};
+ class DIImportedModule : public DIDescriptor {
+ friend class DIDescriptor;
+ void printInternal(raw_ostream &OS) const;
+ public:
+ explicit DIImportedModule(const MDNode *N) : DIDescriptor(N) { }
+ DINameSpace getNameSpace() const { return getFieldAs<DINameSpace>(1); }
+ bool Verify() const;
+ };
+
/// getDISubprogram - Find subprogram that is enclosing this scope.
DISubprogram getDISubprogram(const MDNode *Scope);