aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Analysis/DebugInfo.h42
-rw-r--r--include/llvm/CodeGen/MachineModuleInfo.h3
-rw-r--r--lib/Analysis/DebugInfo.cpp52
3 files changed, 74 insertions, 23 deletions
diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h
index 270b36b..fd19547 100644
--- a/include/llvm/Analysis/DebugInfo.h
+++ b/include/llvm/Analysis/DebugInfo.h
@@ -33,7 +33,8 @@ namespace llvm {
class DIDescriptor {
public:
enum {
- Version6 = 6 << 16, // Current version of debug information.
+ Version7 = 7 << 16, // Current version of debug information.
+ Version6 = 6 << 16, // Constant for version 6.
Version5 = 5 << 16, // Constant for version 5.
Version4 = 4 << 16, // Constant for version 4.
VersionMask = 0xffff0000 // Mask for version number.
@@ -156,6 +157,8 @@ namespace llvm {
explicit DIBasicType(GlobalVariable *GV);
unsigned getEncoding() const { return getUnsignedField(9); }
+ std::string getFileName() const { return getStringField(10); }
+ std::string getDirectory() const { return getStringField(11); }
};
/// DIDerivedType - A simple derived type, like a const qualified type,
@@ -168,7 +171,9 @@ namespace llvm {
explicit DIDerivedType(GlobalVariable *GV);
DIType getTypeDerivedFrom() const { return getFieldAs<DIType>(9); }
-
+ std::string getFileName() const { return getStringField(10); }
+ std::string getDirectory() const { return getStringField(11); }
+
/// isDerivedType - Return true if the specified tag is legal for
/// DIDerivedType.
static bool isDerivedType(unsigned TAG);
@@ -183,6 +188,8 @@ namespace llvm {
explicit DICompositeType(GlobalVariable *GV);
DIArray getTypeArray() const { return getFieldAs<DIArray>(10); }
+ std::string getFileName() const { return getStringField(11); }
+ std::string getDirectory() const { return getStringField(12); }
/// isCompositeType - Return true if the specified tag is legal for
/// DICompositeType.
@@ -216,7 +223,8 @@ namespace llvm {
class DISubprogram : public DIGlobal {
public:
explicit DISubprogram(GlobalVariable *GV = 0);
-
+ std::string getFilename() const { return getStringField(11); }
+ std::string getDirectory() const { return getStringField(12); }
};
/// DIGlobalVariable - This is a wrapper for a global variable.
@@ -225,6 +233,8 @@ namespace llvm {
explicit DIGlobalVariable(GlobalVariable *GV = 0);
GlobalVariable *getGlobal() const { return getGlobalVariableField(11); }
+ std::string getFilename() const { return getStringField(12); }
+ std::string getDirectory() const { return getStringField(13); }
};
@@ -240,6 +250,8 @@ namespace llvm {
DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); }
unsigned getLineNumber() const { return getUnsignedField(4); }
DIType getType() const { return getFieldAs<DIType>(5); }
+ std::string getFilename() const { return getStringField(6); }
+ std::string getDirectory() const { return getStringField(7); }
/// isVariable - Return true if the specified tag is legal for DIVariable.
static bool isVariable(unsigned Tag);
@@ -310,7 +322,9 @@ namespace llvm {
DICompileUnit CompileUnit, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits,
uint64_t OffsetInBits, unsigned Flags,
- unsigned Encoding);
+ unsigned Encoding,
+ const std::string *FileName = 0,
+ const std::string *Directory = 0);
/// CreateDerivedType - Create a derived type like const qualified type,
/// pointer, typedef, etc.
@@ -320,7 +334,9 @@ namespace llvm {
unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits,
uint64_t OffsetInBits, unsigned Flags,
- DIType DerivedFrom);
+ DIType DerivedFrom,
+ const std::string *FileName = 0,
+ const std::string *Directory = 0);
/// CreateCompositeType - Create a composite type like array, struct, etc.
DICompositeType CreateCompositeType(unsigned Tag, DIDescriptor Context,
@@ -331,7 +347,9 @@ namespace llvm {
uint64_t AlignInBits,
uint64_t OffsetInBits, unsigned Flags,
DIType DerivedFrom,
- DIArray Elements);
+ DIArray Elements,
+ const std::string *FileName = 0,
+ const std::string *Directory = 0);
/// CreateSubprogram - Create a new descriptor for the specified subprogram.
/// See comments in DISubprogram for descriptions of these fields.
@@ -340,7 +358,9 @@ namespace llvm {
const std::string &LinkageName,
DICompileUnit CompileUnit, unsigned LineNo,
DIType Type, bool isLocalToUnit,
- bool isDefinition);
+ bool isDefinition,
+ const std::string *FileName = 0,
+ const std::string *Directory = 0);
/// CreateGlobalVariable - Create a new descriptor for the specified global.
DIGlobalVariable
@@ -349,14 +369,18 @@ namespace llvm {
const std::string &LinkageName,
DICompileUnit CompileUnit,
unsigned LineNo, DIType Type, bool isLocalToUnit,
- bool isDefinition, llvm::GlobalVariable *GV);
+ bool isDefinition, llvm::GlobalVariable *GV,
+ const std::string *FileName = 0,
+ const std::string *Directory = 0);
/// CreateVariable - Create a new descriptor for the specified variable.
DIVariable CreateVariable(unsigned Tag, DIDescriptor Context,
const std::string &Name,
DICompileUnit CompileUnit, unsigned LineNo,
- DIType Type);
+ DIType Type,
+ const std::string *FileName = 0,
+ const std::string *Directory = 0);
/// CreateBlock - This creates a descriptor for a lexical block with the
/// specified parent context.
diff --git a/include/llvm/CodeGen/MachineModuleInfo.h b/include/llvm/CodeGen/MachineModuleInfo.h
index 61befb5..1f4c534 100644
--- a/include/llvm/CodeGen/MachineModuleInfo.h
+++ b/include/llvm/CodeGen/MachineModuleInfo.h
@@ -59,7 +59,8 @@ class StructType;
// Debug info constants.
enum {
- LLVMDebugVersion = (6 << 16), // Current version of debug information.
+ LLVMDebugVersion = (7 << 16), // Current version of debug information.
+ LLVMDebugVersion6 = (6 << 16), // Constant for version 6.
LLVMDebugVersion5 = (5 << 16), // Constant for version 5.
LLVMDebugVersion4 = (4 << 16), // Constant for version 4.
LLVMDebugVersionMask = 0xffff0000 // Mask for version number.
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp
index a49a3b3..f1f7d8e 100644
--- a/lib/Analysis/DebugInfo.cpp
+++ b/lib/Analysis/DebugInfo.cpp
@@ -195,7 +195,7 @@ Constant *DIFactory::getCastToEmpty(DIDescriptor D) {
Constant *DIFactory::GetTagConstant(unsigned TAG) {
assert((TAG & DIDescriptor::VersionMask) == 0 &&
"Tag too large for debug encoding!");
- return ConstantInt::get(Type::Int32Ty, TAG | DIDescriptor::Version6);
+ return ConstantInt::get(Type::Int32Ty, TAG | DIDescriptor::Version7);
}
Constant *DIFactory::GetStringConstant(const std::string &String) {
@@ -389,7 +389,9 @@ DIBasicType DIFactory::CreateBasicType(DIDescriptor Context,
uint64_t SizeInBits,
uint64_t AlignInBits,
uint64_t OffsetInBits, unsigned Flags,
- unsigned Encoding) {
+ unsigned Encoding,
+ const std::string *FileName,
+ const std::string *Directory) {
Constant *Elts[] = {
GetTagConstant(dwarf::DW_TAG_base_type),
getCastToEmpty(Context),
@@ -400,7 +402,9 @@ DIBasicType DIFactory::CreateBasicType(DIDescriptor Context,
ConstantInt::get(Type::Int64Ty, AlignInBits),
ConstantInt::get(Type::Int64Ty, OffsetInBits),
ConstantInt::get(Type::Int32Ty, Flags),
- ConstantInt::get(Type::Int32Ty, Encoding)
+ ConstantInt::get(Type::Int32Ty, Encoding),
+ GetStringConstant(FileName ? FileName->c_str() : ""),
+ GetStringConstant(Directory ? Directory->c_str() : "")
};
Constant *Init = ConstantStruct::get(Elts, sizeof(Elts)/sizeof(Elts[0]));
@@ -424,7 +428,9 @@ DIDerivedType DIFactory::CreateDerivedType(unsigned Tag,
uint64_t AlignInBits,
uint64_t OffsetInBits,
unsigned Flags,
- DIType DerivedFrom) {
+ DIType DerivedFrom,
+ const std::string *FileName,
+ const std::string *Directory) {
Constant *Elts[] = {
GetTagConstant(Tag),
getCastToEmpty(Context),
@@ -435,7 +441,9 @@ DIDerivedType DIFactory::CreateDerivedType(unsigned Tag,
ConstantInt::get(Type::Int64Ty, AlignInBits),
ConstantInt::get(Type::Int64Ty, OffsetInBits),
ConstantInt::get(Type::Int32Ty, Flags),
- getCastToEmpty(DerivedFrom)
+ getCastToEmpty(DerivedFrom),
+ GetStringConstant(FileName ? FileName->c_str() : ""),
+ GetStringConstant(Directory ? Directory->c_str() : "")
};
Constant *Init = ConstantStruct::get(Elts, sizeof(Elts)/sizeof(Elts[0]));
@@ -459,7 +467,10 @@ DICompositeType DIFactory::CreateCompositeType(unsigned Tag,
uint64_t OffsetInBits,
unsigned Flags,
DIType DerivedFrom,
- DIArray Elements) {
+ DIArray Elements,
+ const std::string *FileName,
+ const std::string *Directory) {
+
Constant *Elts[] = {
GetTagConstant(Tag),
getCastToEmpty(Context),
@@ -471,7 +482,9 @@ DICompositeType DIFactory::CreateCompositeType(unsigned Tag,
ConstantInt::get(Type::Int64Ty, OffsetInBits),
ConstantInt::get(Type::Int32Ty, Flags),
getCastToEmpty(DerivedFrom),
- getCastToEmpty(Elements)
+ getCastToEmpty(Elements),
+ GetStringConstant(FileName ? FileName->c_str() : ""),
+ GetStringConstant(Directory ? Directory->c_str() : "")
};
Constant *Init = ConstantStruct::get(Elts, sizeof(Elts)/sizeof(Elts[0]));
@@ -495,7 +508,10 @@ DISubprogram DIFactory::CreateSubprogram(DIDescriptor Context,
DICompileUnit CompileUnit,
unsigned LineNo, DIType Type,
bool isLocalToUnit,
- bool isDefinition) {
+ bool isDefinition,
+ const std::string *FileName,
+ const std::string *Directory) {
+
Constant *Elts[] = {
GetTagConstant(dwarf::DW_TAG_subprogram),
getCastToEmpty(GetOrCreateSubprogramAnchor()),
@@ -507,7 +523,9 @@ DISubprogram DIFactory::CreateSubprogram(DIDescriptor Context,
ConstantInt::get(Type::Int32Ty, LineNo),
getCastToEmpty(Type),
ConstantInt::get(Type::Int1Ty, isLocalToUnit),
- ConstantInt::get(Type::Int1Ty, isDefinition)
+ ConstantInt::get(Type::Int1Ty, isDefinition),
+ GetStringConstant(FileName ? FileName->c_str() : ""),
+ GetStringConstant(Directory ? Directory->c_str() : "")
};
Constant *Init = ConstantStruct::get(Elts, sizeof(Elts)/sizeof(Elts[0]));
@@ -527,8 +545,9 @@ DIFactory::CreateGlobalVariable(DIDescriptor Context, const std::string &Name,
const std::string &LinkageName,
DICompileUnit CompileUnit,
unsigned LineNo, DIType Type,bool isLocalToUnit,
- bool isDefinition, llvm::GlobalVariable *Val) {
-
+ bool isDefinition, llvm::GlobalVariable *Val,
+ const std::string *FileName,
+ const std::string *Directory) {
Constant *Elts[] = {
GetTagConstant(dwarf::DW_TAG_variable),
getCastToEmpty(GetOrCreateGlobalVariableAnchor()),
@@ -541,7 +560,9 @@ DIFactory::CreateGlobalVariable(DIDescriptor Context, const std::string &Name,
getCastToEmpty(Type),
ConstantInt::get(Type::Int1Ty, isLocalToUnit),
ConstantInt::get(Type::Int1Ty, isDefinition),
- ConstantExpr::getBitCast(Val, EmptyStructPtr)
+ ConstantExpr::getBitCast(Val, EmptyStructPtr),
+ GetStringConstant(FileName ? FileName->c_str() : ""),
+ GetStringConstant(Directory ? Directory->c_str() : "")
};
Constant *Init = ConstantStruct::get(Elts, sizeof(Elts)/sizeof(Elts[0]));
@@ -559,7 +580,10 @@ DIFactory::CreateGlobalVariable(DIDescriptor Context, const std::string &Name,
DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context,
const std::string &Name,
DICompileUnit CompileUnit, unsigned LineNo,
- DIType Type) {
+ DIType Type,
+ const std::string *FileName,
+ const std::string *Directory) {
+
Constant *Elts[] = {
GetTagConstant(Tag),
@@ -568,6 +592,8 @@ DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context,
getCastToEmpty(CompileUnit),
ConstantInt::get(Type::Int32Ty, LineNo),
getCastToEmpty(Type),
+ GetStringConstant(FileName ? FileName->c_str() : ""),
+ GetStringConstant(Directory ? Directory->c_str() : "")
};
Constant *Init = ConstantStruct::get(Elts, sizeof(Elts)/sizeof(Elts[0]));