mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 00:21:03 +00:00
Remove std::string uses from DebugInfo interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83083 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -53,7 +53,7 @@ namespace llvm {
|
|||||||
/// not, the debug info is corrupt and we ignore it.
|
/// not, the debug info is corrupt and we ignore it.
|
||||||
DIDescriptor(MDNode *N, unsigned RequiredTag);
|
DIDescriptor(MDNode *N, unsigned RequiredTag);
|
||||||
|
|
||||||
const std::string &getStringField(unsigned Elt, std::string &Result) const;
|
const char *getStringField(unsigned Elt) const;
|
||||||
unsigned getUnsignedField(unsigned Elt) const {
|
unsigned getUnsignedField(unsigned Elt) const {
|
||||||
return (unsigned)getUInt64Field(Elt);
|
return (unsigned)getUInt64Field(Elt);
|
||||||
}
|
}
|
||||||
@@ -131,13 +131,8 @@ namespace llvm {
|
|||||||
}
|
}
|
||||||
virtual ~DIScope() {}
|
virtual ~DIScope() {}
|
||||||
|
|
||||||
virtual const std::string &getFilename(std::string &F) const {
|
virtual const char *getFilename() const { return NULL; }
|
||||||
return F;
|
virtual const char *getDirectory() const { return NULL; }
|
||||||
}
|
|
||||||
|
|
||||||
virtual const std::string &getDirectory(std::string &D) const {
|
|
||||||
return D;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// DICompileUnit - A wrapper for a compile unit.
|
/// DICompileUnit - A wrapper for a compile unit.
|
||||||
@@ -149,15 +144,9 @@ namespace llvm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned getLanguage() const { return getUnsignedField(2); }
|
unsigned getLanguage() const { return getUnsignedField(2); }
|
||||||
const std::string &getFilename(std::string &F) const {
|
const char *getFilename() const { return getStringField(3); }
|
||||||
return getStringField(3, F);
|
const char *getDirectory() const { return getStringField(4); }
|
||||||
}
|
const char *getProducer() const { return getStringField(5); }
|
||||||
const std::string &getDirectory(std::string &F) const {
|
|
||||||
return getStringField(4, F);
|
|
||||||
}
|
|
||||||
const std::string &getProducer(std::string &F) const {
|
|
||||||
return getStringField(5, F);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// isMain - Each input file is encoded as a separate compile unit in LLVM
|
/// isMain - Each input file is encoded as a separate compile unit in LLVM
|
||||||
/// debugging information output. However, many target specific tool chains
|
/// debugging information output. However, many target specific tool chains
|
||||||
@@ -170,9 +159,7 @@ namespace llvm {
|
|||||||
|
|
||||||
bool isMain() const { return getUnsignedField(6); }
|
bool isMain() const { return getUnsignedField(6); }
|
||||||
bool isOptimized() const { return getUnsignedField(7); }
|
bool isOptimized() const { return getUnsignedField(7); }
|
||||||
const std::string &getFlags(std::string &F) const {
|
const char *getFlags() const { return getStringField(8); }
|
||||||
return getStringField(8, F);
|
|
||||||
}
|
|
||||||
unsigned getRunTimeVersion() const { return getUnsignedField(9); }
|
unsigned getRunTimeVersion() const { return getUnsignedField(9); }
|
||||||
|
|
||||||
/// Verify - Verify that a compile unit is well formed.
|
/// Verify - Verify that a compile unit is well formed.
|
||||||
@@ -190,10 +177,8 @@ namespace llvm {
|
|||||||
explicit DIEnumerator(MDNode *N = 0)
|
explicit DIEnumerator(MDNode *N = 0)
|
||||||
: DIDescriptor(N, dwarf::DW_TAG_enumerator) {}
|
: DIDescriptor(N, dwarf::DW_TAG_enumerator) {}
|
||||||
|
|
||||||
const std::string &getName(std::string &F) const {
|
const char *getName() const { return getStringField(1); }
|
||||||
return getStringField(1, F);
|
uint64_t getEnumValue() const { return getUInt64Field(2); }
|
||||||
}
|
|
||||||
uint64_t getEnumValue() const { return getUInt64Field(2); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// DIType - This is a wrapper for a type.
|
/// DIType - This is a wrapper for a type.
|
||||||
@@ -226,9 +211,7 @@ namespace llvm {
|
|||||||
virtual ~DIType() {}
|
virtual ~DIType() {}
|
||||||
|
|
||||||
DIDescriptor getContext() const { return getDescriptorField(1); }
|
DIDescriptor getContext() const { return getDescriptorField(1); }
|
||||||
const std::string &getName(std::string &F) const {
|
const char *getName() const { return getStringField(2); }
|
||||||
return getStringField(2, F);
|
|
||||||
}
|
|
||||||
DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); }
|
DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); }
|
||||||
unsigned getLineNumber() const { return getUnsignedField(4); }
|
unsigned getLineNumber() const { return getUnsignedField(4); }
|
||||||
uint64_t getSizeInBits() const { return getUInt64Field(5); }
|
uint64_t getSizeInBits() const { return getUInt64Field(5); }
|
||||||
@@ -328,15 +311,9 @@ namespace llvm {
|
|||||||
virtual ~DIGlobal() {}
|
virtual ~DIGlobal() {}
|
||||||
|
|
||||||
DIDescriptor getContext() const { return getDescriptorField(2); }
|
DIDescriptor getContext() const { return getDescriptorField(2); }
|
||||||
const std::string &getName(std::string &F) const {
|
const char *getName() const { return getStringField(3); }
|
||||||
return getStringField(3, F);
|
const char *getDisplayName() const { return getStringField(4); }
|
||||||
}
|
const char *getLinkageName() const { return getStringField(5); }
|
||||||
const std::string &getDisplayName(std::string &F) const {
|
|
||||||
return getStringField(4, F);
|
|
||||||
}
|
|
||||||
const std::string &getLinkageName(std::string &F) const {
|
|
||||||
return getStringField(5, F);
|
|
||||||
}
|
|
||||||
DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(6); }
|
DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(6); }
|
||||||
unsigned getLineNumber() const { return getUnsignedField(7); }
|
unsigned getLineNumber() const { return getUnsignedField(7); }
|
||||||
DIType getType() const { return getFieldAs<DIType>(8); }
|
DIType getType() const { return getFieldAs<DIType>(8); }
|
||||||
@@ -359,43 +336,32 @@ namespace llvm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DIDescriptor getContext() const { return getDescriptorField(2); }
|
DIDescriptor getContext() const { return getDescriptorField(2); }
|
||||||
const std::string &getName(std::string &F) const {
|
const char *getName() const { return getStringField(3); }
|
||||||
return getStringField(3, F);
|
const char *getDisplayName() const { return getStringField(4); }
|
||||||
}
|
const char *getLinkageName() const { return getStringField(5); }
|
||||||
const std::string &getDisplayName(std::string &F) const {
|
|
||||||
return getStringField(4, F);
|
|
||||||
}
|
|
||||||
const std::string &getLinkageName(std::string &F) const {
|
|
||||||
return getStringField(5, F);
|
|
||||||
}
|
|
||||||
DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(6); }
|
DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(6); }
|
||||||
unsigned getLineNumber() const { return getUnsignedField(7); }
|
unsigned getLineNumber() const { return getUnsignedField(7); }
|
||||||
DICompositeType getType() const { return getFieldAs<DICompositeType>(8); }
|
DICompositeType getType() const { return getFieldAs<DICompositeType>(8); }
|
||||||
|
|
||||||
/// getReturnTypeName - Subprogram return types are encoded either as
|
/// getReturnTypeName - Subprogram return types are encoded either as
|
||||||
/// DIType or as DICompositeType.
|
/// DIType or as DICompositeType.
|
||||||
const std::string &getReturnTypeName(std::string &F) const {
|
const char *getReturnTypeName() const {
|
||||||
DICompositeType DCT(getFieldAs<DICompositeType>(8));
|
DICompositeType DCT(getFieldAs<DICompositeType>(8));
|
||||||
if (!DCT.isNull()) {
|
if (!DCT.isNull()) {
|
||||||
DIArray A = DCT.getTypeArray();
|
DIArray A = DCT.getTypeArray();
|
||||||
DIType T(A.getElement(0).getNode());
|
DIType T(A.getElement(0).getNode());
|
||||||
return T.getName(F);
|
return T.getName();
|
||||||
}
|
}
|
||||||
DIType T(getFieldAs<DIType>(8));
|
DIType T(getFieldAs<DIType>(8));
|
||||||
return T.getName(F);
|
return T.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isLocalToUnit - Return true if this subprogram is local to the current
|
/// isLocalToUnit - Return true if this subprogram is local to the current
|
||||||
/// compile unit, like 'static' in C.
|
/// compile unit, like 'static' in C.
|
||||||
unsigned isLocalToUnit() const { return getUnsignedField(9); }
|
unsigned isLocalToUnit() const { return getUnsignedField(9); }
|
||||||
unsigned isDefinition() const { return getUnsignedField(10); }
|
unsigned isDefinition() const { return getUnsignedField(10); }
|
||||||
|
const char *getFilename() const { return getCompileUnit().getFilename();}
|
||||||
const std::string &getFilename(std::string &F) const {
|
const char *getDirectory() const { return getCompileUnit().getDirectory();}
|
||||||
return getCompileUnit().getFilename(F);
|
|
||||||
}
|
|
||||||
const std::string &getDirectory(std::string &F) const {
|
|
||||||
return getCompileUnit().getDirectory(F);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Verify - Verify that a subprogram descriptor is well formed.
|
/// Verify - Verify that a subprogram descriptor is well formed.
|
||||||
bool Verify() const;
|
bool Verify() const;
|
||||||
@@ -434,9 +400,7 @@ namespace llvm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DIDescriptor getContext() const { return getDescriptorField(1); }
|
DIDescriptor getContext() const { return getDescriptorField(1); }
|
||||||
const std::string &getName(std::string &F) const {
|
const char *getName() const { return getStringField(2); }
|
||||||
return getStringField(2, F);
|
|
||||||
}
|
|
||||||
DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); }
|
DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); }
|
||||||
unsigned getLineNumber() const { return getUnsignedField(4); }
|
unsigned getLineNumber() const { return getUnsignedField(4); }
|
||||||
DIType getType() const { return getFieldAs<DIType>(5); }
|
DIType getType() const { return getFieldAs<DIType>(5); }
|
||||||
@@ -462,14 +426,8 @@ namespace llvm {
|
|||||||
if (DbgNode && !isLexicalBlock())
|
if (DbgNode && !isLexicalBlock())
|
||||||
DbgNode = 0;
|
DbgNode = 0;
|
||||||
}
|
}
|
||||||
DIScope getContext() const { return getFieldAs<DIScope>(1); }
|
DIScope getContext() const { return getFieldAs<DIScope>(1); }
|
||||||
|
const char *getFilename() const { return getContext().getFilename(); }
|
||||||
const std::string &getFilename(std::string &F) const {
|
|
||||||
return getContext().getFilename(F);
|
|
||||||
}
|
|
||||||
const std::string &getDirectory(std::string &D) const {
|
|
||||||
return getContext().getDirectory(D);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// DILocation - This object holds location information. This object
|
/// DILocation - This object holds location information. This object
|
||||||
@@ -480,14 +438,10 @@ namespace llvm {
|
|||||||
|
|
||||||
unsigned getLineNumber() const { return getUnsignedField(0); }
|
unsigned getLineNumber() const { return getUnsignedField(0); }
|
||||||
unsigned getColumnNumber() const { return getUnsignedField(1); }
|
unsigned getColumnNumber() const { return getUnsignedField(1); }
|
||||||
DIScope getScope() const { return getFieldAs<DIScope>(3); }
|
DIScope getScope() const { return getFieldAs<DIScope>(2); }
|
||||||
DILocation getOrigLocation() const { return getFieldAs<DILocation>(4); }
|
DILocation getOrigLocation() const { return getFieldAs<DILocation>(3); }
|
||||||
std::string getFilename(std::string &F) const {
|
const char *getFilename() const { return getScope().getFilename(); }
|
||||||
return getScope().getFilename(F);
|
const char *getDirectory() const { return getScope().getDirectory(); }
|
||||||
}
|
|
||||||
std::string getDirectory(std::string &D) const {
|
|
||||||
return getScope().getDirectory(D);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// DIFactory - This object assists with the construction of the various
|
/// DIFactory - This object assists with the construction of the various
|
||||||
@@ -522,19 +476,19 @@ namespace llvm {
|
|||||||
/// CreateCompileUnit - Create a new descriptor for the specified compile
|
/// CreateCompileUnit - Create a new descriptor for the specified compile
|
||||||
/// unit.
|
/// unit.
|
||||||
DICompileUnit CreateCompileUnit(unsigned LangID,
|
DICompileUnit CreateCompileUnit(unsigned LangID,
|
||||||
const std::string &Filename,
|
StringRef Filenae,
|
||||||
const std::string &Directory,
|
StringRef Directory,
|
||||||
const std::string &Producer,
|
StringRef Producer,
|
||||||
bool isMain = false,
|
bool isMain = false,
|
||||||
bool isOptimized = false,
|
bool isOptimized = false,
|
||||||
const char *Flags = "",
|
const char *Flags = "",
|
||||||
unsigned RunTimeVer = 0);
|
unsigned RunTimeVer = 0);
|
||||||
|
|
||||||
/// CreateEnumerator - Create a single enumerator value.
|
/// CreateEnumerator - Create a single enumerator value.
|
||||||
DIEnumerator CreateEnumerator(const std::string &Name, uint64_t Val);
|
DIEnumerator CreateEnumerator(StringRef Name, uint64_t Val);
|
||||||
|
|
||||||
/// CreateBasicType - Create a basic type like int, float, etc.
|
/// CreateBasicType - Create a basic type like int, float, etc.
|
||||||
DIBasicType CreateBasicType(DIDescriptor Context, const std::string &Name,
|
DIBasicType CreateBasicType(DIDescriptor Context, StringRef Name,
|
||||||
DICompileUnit CompileUnit, unsigned LineNumber,
|
DICompileUnit CompileUnit, unsigned LineNumber,
|
||||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||||
uint64_t OffsetInBits, unsigned Flags,
|
uint64_t OffsetInBits, unsigned Flags,
|
||||||
@@ -543,7 +497,7 @@ namespace llvm {
|
|||||||
/// CreateDerivedType - Create a derived type like const qualified type,
|
/// CreateDerivedType - Create a derived type like const qualified type,
|
||||||
/// pointer, typedef, etc.
|
/// pointer, typedef, etc.
|
||||||
DIDerivedType CreateDerivedType(unsigned Tag, DIDescriptor Context,
|
DIDerivedType CreateDerivedType(unsigned Tag, DIDescriptor Context,
|
||||||
const std::string &Name,
|
StringRef Name,
|
||||||
DICompileUnit CompileUnit,
|
DICompileUnit CompileUnit,
|
||||||
unsigned LineNumber,
|
unsigned LineNumber,
|
||||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||||
@@ -552,7 +506,7 @@ namespace llvm {
|
|||||||
|
|
||||||
/// CreateCompositeType - Create a composite type like array, struct, etc.
|
/// CreateCompositeType - Create a composite type like array, struct, etc.
|
||||||
DICompositeType CreateCompositeType(unsigned Tag, DIDescriptor Context,
|
DICompositeType CreateCompositeType(unsigned Tag, DIDescriptor Context,
|
||||||
const std::string &Name,
|
StringRef Name,
|
||||||
DICompileUnit CompileUnit,
|
DICompileUnit CompileUnit,
|
||||||
unsigned LineNumber,
|
unsigned LineNumber,
|
||||||
uint64_t SizeInBits,
|
uint64_t SizeInBits,
|
||||||
@@ -564,25 +518,25 @@ namespace llvm {
|
|||||||
|
|
||||||
/// CreateSubprogram - Create a new descriptor for the specified subprogram.
|
/// CreateSubprogram - Create a new descriptor for the specified subprogram.
|
||||||
/// See comments in DISubprogram for descriptions of these fields.
|
/// See comments in DISubprogram for descriptions of these fields.
|
||||||
DISubprogram CreateSubprogram(DIDescriptor Context, const std::string &Name,
|
DISubprogram CreateSubprogram(DIDescriptor Context, StringRef Name,
|
||||||
const std::string &DisplayName,
|
StringRef DisplayName,
|
||||||
const std::string &LinkageName,
|
StringRef LinkageName,
|
||||||
DICompileUnit CompileUnit, unsigned LineNo,
|
DICompileUnit CompileUnit, unsigned LineNo,
|
||||||
DIType Type, bool isLocalToUnit,
|
DIType Type, bool isLocalToUnit,
|
||||||
bool isDefinition);
|
bool isDefinition);
|
||||||
|
|
||||||
/// CreateGlobalVariable - Create a new descriptor for the specified global.
|
/// CreateGlobalVariable - Create a new descriptor for the specified global.
|
||||||
DIGlobalVariable
|
DIGlobalVariable
|
||||||
CreateGlobalVariable(DIDescriptor Context, const std::string &Name,
|
CreateGlobalVariable(DIDescriptor Context, StringRef Name,
|
||||||
const std::string &DisplayName,
|
StringRef DisplayName,
|
||||||
const std::string &LinkageName,
|
StringRef LinkageName,
|
||||||
DICompileUnit CompileUnit,
|
DICompileUnit CompileUnit,
|
||||||
unsigned LineNo, DIType Type, bool isLocalToUnit,
|
unsigned LineNo, DIType Type, bool isLocalToUnit,
|
||||||
bool isDefinition, llvm::GlobalVariable *GV);
|
bool isDefinition, llvm::GlobalVariable *GV);
|
||||||
|
|
||||||
/// CreateVariable - Create a new descriptor for the specified variable.
|
/// CreateVariable - Create a new descriptor for the specified variable.
|
||||||
DIVariable CreateVariable(unsigned Tag, DIDescriptor Context,
|
DIVariable CreateVariable(unsigned Tag, DIDescriptor Context,
|
||||||
const std::string &Name,
|
StringRef Name,
|
||||||
DICompileUnit CompileUnit, unsigned LineNo,
|
DICompileUnit CompileUnit, unsigned LineNo,
|
||||||
DIType Type);
|
DIType Type);
|
||||||
|
|
||||||
@@ -633,9 +587,9 @@ namespace llvm {
|
|||||||
/// Find the debug info descriptor corresponding to this global variable.
|
/// Find the debug info descriptor corresponding to this global variable.
|
||||||
Value *findDbgGlobalDeclare(GlobalVariable *V);
|
Value *findDbgGlobalDeclare(GlobalVariable *V);
|
||||||
|
|
||||||
bool getLocationInfo(const Value *V, std::string &DisplayName,
|
bool getLocationInfo(const Value *V, std::string &DisplayName,
|
||||||
std::string &Type, unsigned &LineNo, std::string &File,
|
std::string &Type, unsigned &LineNo, std::string &File,
|
||||||
std::string &Dir);
|
std::string &Dir);
|
||||||
|
|
||||||
/// isValidDebugInfoIntrinsic - Return true if SPI is a valid debug
|
/// isValidDebugInfoIntrinsic - Return true if SPI is a valid debug
|
||||||
/// info intrinsic.
|
/// info intrinsic.
|
||||||
|
@@ -91,9 +91,8 @@ void PrintDbgInfo::printStopPoint(const DbgStopPointInst *DSI) {
|
|||||||
|
|
||||||
void PrintDbgInfo::printFuncStart(const DbgFuncStartInst *FS) {
|
void PrintDbgInfo::printFuncStart(const DbgFuncStartInst *FS) {
|
||||||
DISubprogram Subprogram(FS->getSubprogram());
|
DISubprogram Subprogram(FS->getSubprogram());
|
||||||
std::string Res1, Res2;
|
Out << "; fully qualified function name: " << Subprogram.getDisplayName()
|
||||||
Out << "; fully qualified function name: " << Subprogram.getDisplayName(Res1)
|
<< " return type: " << Subprogram.getReturnTypeName()
|
||||||
<< " return type: " << Subprogram.getReturnTypeName(Res2)
|
|
||||||
<< " at line " << Subprogram.getLineNumber()
|
<< " at line " << Subprogram.getLineNumber()
|
||||||
<< "\n\n";
|
<< "\n\n";
|
||||||
}
|
}
|
||||||
|
@@ -78,19 +78,16 @@ DIDescriptor::DIDescriptor(MDNode *N, unsigned RequiredTag) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string &
|
const char *
|
||||||
DIDescriptor::getStringField(unsigned Elt, std::string &Result) const {
|
DIDescriptor::getStringField(unsigned Elt) const {
|
||||||
Result.clear();
|
|
||||||
if (DbgNode == 0)
|
if (DbgNode == 0)
|
||||||
return Result;
|
return NULL;
|
||||||
|
|
||||||
if (Elt < DbgNode->getNumElements())
|
if (Elt < DbgNode->getNumElements())
|
||||||
if (MDString *MDS = dyn_cast_or_null<MDString>(DbgNode->getElement(Elt))) {
|
if (MDString *MDS = dyn_cast_or_null<MDString>(DbgNode->getElement(Elt)))
|
||||||
Result.assign(MDS->begin(), MDS->begin() + MDS->length());
|
return MDS->getString().data();
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Result;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t DIDescriptor::getUInt64Field(unsigned Elt) const {
|
uint64_t DIDescriptor::getUInt64Field(unsigned Elt) const {
|
||||||
@@ -284,8 +281,8 @@ void DIDerivedType::replaceAllUsesWith(DIDescriptor &D) {
|
|||||||
bool DICompileUnit::Verify() const {
|
bool DICompileUnit::Verify() const {
|
||||||
if (isNull())
|
if (isNull())
|
||||||
return false;
|
return false;
|
||||||
std::string Res;
|
const char *N = getFilename();
|
||||||
if (getFilename(Res).empty())
|
if (!N)
|
||||||
return false;
|
return false;
|
||||||
// It is possible that directory and produce string is empty.
|
// It is possible that directory and produce string is empty.
|
||||||
return true;
|
return true;
|
||||||
@@ -387,11 +384,10 @@ uint64_t DIDerivedType::getOriginalTypeSize() const {
|
|||||||
/// information for the function F.
|
/// information for the function F.
|
||||||
bool DISubprogram::describes(const Function *F) {
|
bool DISubprogram::describes(const Function *F) {
|
||||||
assert (F && "Invalid function");
|
assert (F && "Invalid function");
|
||||||
std::string Name;
|
const char *Name = getLinkageName();
|
||||||
getLinkageName(Name);
|
if (!Name)
|
||||||
if (Name.empty())
|
Name = getName();
|
||||||
getName(Name);
|
if (strcmp(F->getName().data(), Name) == 0)
|
||||||
if (F->getName() == Name)
|
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -412,16 +408,14 @@ void DICompileUnit::dump() const {
|
|||||||
if (getLanguage())
|
if (getLanguage())
|
||||||
errs() << " [" << dwarf::LanguageString(getLanguage()) << "] ";
|
errs() << " [" << dwarf::LanguageString(getLanguage()) << "] ";
|
||||||
|
|
||||||
std::string Res1, Res2;
|
errs() << " [" << getDirectory() << "/" << getFilename() << " ]";
|
||||||
errs() << " [" << getDirectory(Res1) << "/" << getFilename(Res2) << " ]";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// dump - Print type.
|
/// dump - Print type.
|
||||||
void DIType::dump() const {
|
void DIType::dump() const {
|
||||||
if (isNull()) return;
|
if (isNull()) return;
|
||||||
|
|
||||||
std::string Res;
|
if (const char *Res = getName())
|
||||||
if (!getName(Res).empty())
|
|
||||||
errs() << " [" << Res << "] ";
|
errs() << " [" << Res << "] ";
|
||||||
|
|
||||||
unsigned Tag = getTag();
|
unsigned Tag = getTag();
|
||||||
@@ -478,8 +472,7 @@ void DICompositeType::dump() const {
|
|||||||
|
|
||||||
/// dump - Print global.
|
/// dump - Print global.
|
||||||
void DIGlobal::dump() const {
|
void DIGlobal::dump() const {
|
||||||
std::string Res;
|
if (const char *Res = getName())
|
||||||
if (!getName(Res).empty())
|
|
||||||
errs() << " [" << Res << "] ";
|
errs() << " [" << Res << "] ";
|
||||||
|
|
||||||
unsigned Tag = getTag();
|
unsigned Tag = getTag();
|
||||||
@@ -503,8 +496,7 @@ void DIGlobal::dump() const {
|
|||||||
|
|
||||||
/// dump - Print subprogram.
|
/// dump - Print subprogram.
|
||||||
void DISubprogram::dump() const {
|
void DISubprogram::dump() const {
|
||||||
std::string Res;
|
if (const char *Res = getName())
|
||||||
if (!getName(Res).empty())
|
|
||||||
errs() << " [" << Res << "] ";
|
errs() << " [" << Res << "] ";
|
||||||
|
|
||||||
unsigned Tag = getTag();
|
unsigned Tag = getTag();
|
||||||
@@ -532,8 +524,7 @@ void DIGlobalVariable::dump() const {
|
|||||||
|
|
||||||
/// dump - Print variable.
|
/// dump - Print variable.
|
||||||
void DIVariable::dump() const {
|
void DIVariable::dump() const {
|
||||||
std::string Res;
|
if (const char *Res = getName())
|
||||||
if (!getName(Res).empty())
|
|
||||||
errs() << " [" << Res << "] ";
|
errs() << " [" << Res << "] ";
|
||||||
|
|
||||||
getCompileUnit().dump();
|
getCompileUnit().dump();
|
||||||
@@ -594,9 +585,9 @@ DISubrange DIFactory::GetOrCreateSubrange(int64_t Lo, int64_t Hi) {
|
|||||||
/// CreateCompileUnit - Create a new descriptor for the specified compile
|
/// CreateCompileUnit - Create a new descriptor for the specified compile
|
||||||
/// unit. Note that this does not unique compile units within the module.
|
/// unit. Note that this does not unique compile units within the module.
|
||||||
DICompileUnit DIFactory::CreateCompileUnit(unsigned LangID,
|
DICompileUnit DIFactory::CreateCompileUnit(unsigned LangID,
|
||||||
const std::string &Filename,
|
StringRef Filename,
|
||||||
const std::string &Directory,
|
StringRef Directory,
|
||||||
const std::string &Producer,
|
StringRef Producer,
|
||||||
bool isMain,
|
bool isMain,
|
||||||
bool isOptimized,
|
bool isOptimized,
|
||||||
const char *Flags,
|
const char *Flags,
|
||||||
@@ -618,7 +609,7 @@ DICompileUnit DIFactory::CreateCompileUnit(unsigned LangID,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// CreateEnumerator - Create a single enumerator value.
|
/// CreateEnumerator - Create a single enumerator value.
|
||||||
DIEnumerator DIFactory::CreateEnumerator(const std::string &Name, uint64_t Val){
|
DIEnumerator DIFactory::CreateEnumerator(StringRef Name, uint64_t Val){
|
||||||
Value *Elts[] = {
|
Value *Elts[] = {
|
||||||
GetTagConstant(dwarf::DW_TAG_enumerator),
|
GetTagConstant(dwarf::DW_TAG_enumerator),
|
||||||
MDString::get(VMContext, Name),
|
MDString::get(VMContext, Name),
|
||||||
@@ -630,7 +621,7 @@ DIEnumerator DIFactory::CreateEnumerator(const std::string &Name, uint64_t Val){
|
|||||||
|
|
||||||
/// CreateBasicType - Create a basic type like int, float, etc.
|
/// CreateBasicType - Create a basic type like int, float, etc.
|
||||||
DIBasicType DIFactory::CreateBasicType(DIDescriptor Context,
|
DIBasicType DIFactory::CreateBasicType(DIDescriptor Context,
|
||||||
const std::string &Name,
|
StringRef Name,
|
||||||
DICompileUnit CompileUnit,
|
DICompileUnit CompileUnit,
|
||||||
unsigned LineNumber,
|
unsigned LineNumber,
|
||||||
uint64_t SizeInBits,
|
uint64_t SizeInBits,
|
||||||
@@ -656,7 +647,7 @@ DIBasicType DIFactory::CreateBasicType(DIDescriptor Context,
|
|||||||
/// pointer, typedef, etc.
|
/// pointer, typedef, etc.
|
||||||
DIDerivedType DIFactory::CreateDerivedType(unsigned Tag,
|
DIDerivedType DIFactory::CreateDerivedType(unsigned Tag,
|
||||||
DIDescriptor Context,
|
DIDescriptor Context,
|
||||||
const std::string &Name,
|
StringRef Name,
|
||||||
DICompileUnit CompileUnit,
|
DICompileUnit CompileUnit,
|
||||||
unsigned LineNumber,
|
unsigned LineNumber,
|
||||||
uint64_t SizeInBits,
|
uint64_t SizeInBits,
|
||||||
@@ -682,7 +673,7 @@ DIDerivedType DIFactory::CreateDerivedType(unsigned Tag,
|
|||||||
/// CreateCompositeType - Create a composite type like array, struct, etc.
|
/// CreateCompositeType - Create a composite type like array, struct, etc.
|
||||||
DICompositeType DIFactory::CreateCompositeType(unsigned Tag,
|
DICompositeType DIFactory::CreateCompositeType(unsigned Tag,
|
||||||
DIDescriptor Context,
|
DIDescriptor Context,
|
||||||
const std::string &Name,
|
StringRef Name,
|
||||||
DICompileUnit CompileUnit,
|
DICompileUnit CompileUnit,
|
||||||
unsigned LineNumber,
|
unsigned LineNumber,
|
||||||
uint64_t SizeInBits,
|
uint64_t SizeInBits,
|
||||||
@@ -715,9 +706,9 @@ DICompositeType DIFactory::CreateCompositeType(unsigned Tag,
|
|||||||
/// See comments in DISubprogram for descriptions of these fields. This
|
/// See comments in DISubprogram for descriptions of these fields. This
|
||||||
/// method does not unique the generated descriptors.
|
/// method does not unique the generated descriptors.
|
||||||
DISubprogram DIFactory::CreateSubprogram(DIDescriptor Context,
|
DISubprogram DIFactory::CreateSubprogram(DIDescriptor Context,
|
||||||
const std::string &Name,
|
StringRef Name,
|
||||||
const std::string &DisplayName,
|
StringRef DisplayName,
|
||||||
const std::string &LinkageName,
|
StringRef LinkageName,
|
||||||
DICompileUnit CompileUnit,
|
DICompileUnit CompileUnit,
|
||||||
unsigned LineNo, DIType Type,
|
unsigned LineNo, DIType Type,
|
||||||
bool isLocalToUnit,
|
bool isLocalToUnit,
|
||||||
@@ -741,9 +732,9 @@ DISubprogram DIFactory::CreateSubprogram(DIDescriptor Context,
|
|||||||
|
|
||||||
/// CreateGlobalVariable - Create a new descriptor for the specified global.
|
/// CreateGlobalVariable - Create a new descriptor for the specified global.
|
||||||
DIGlobalVariable
|
DIGlobalVariable
|
||||||
DIFactory::CreateGlobalVariable(DIDescriptor Context, const std::string &Name,
|
DIFactory::CreateGlobalVariable(DIDescriptor Context, StringRef Name,
|
||||||
const std::string &DisplayName,
|
StringRef DisplayName,
|
||||||
const std::string &LinkageName,
|
StringRef LinkageName,
|
||||||
DICompileUnit CompileUnit,
|
DICompileUnit CompileUnit,
|
||||||
unsigned LineNo, DIType Type,bool isLocalToUnit,
|
unsigned LineNo, DIType Type,bool isLocalToUnit,
|
||||||
bool isDefinition, llvm::GlobalVariable *Val) {
|
bool isDefinition, llvm::GlobalVariable *Val) {
|
||||||
@@ -775,7 +766,7 @@ DIFactory::CreateGlobalVariable(DIDescriptor Context, const std::string &Name,
|
|||||||
|
|
||||||
/// CreateVariable - Create a new descriptor for the specified variable.
|
/// CreateVariable - Create a new descriptor for the specified variable.
|
||||||
DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context,
|
DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context,
|
||||||
const std::string &Name,
|
StringRef Name,
|
||||||
DICompileUnit CompileUnit, unsigned LineNo,
|
DICompileUnit CompileUnit, unsigned LineNo,
|
||||||
DIType Type) {
|
DIType Type) {
|
||||||
Value *Elts[] = {
|
Value *Elts[] = {
|
||||||
@@ -1127,8 +1118,8 @@ namespace llvm {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getLocationInfo(const Value *V, std::string &DisplayName,
|
bool getLocationInfo(const Value *V, std::string &DisplayName,
|
||||||
std::string &Type, unsigned &LineNo, std::string &File,
|
std::string &Type, unsigned &LineNo, std::string &File,
|
||||||
std::string &Dir) {
|
std::string &Dir) {
|
||||||
DICompileUnit Unit;
|
DICompileUnit Unit;
|
||||||
DIType TypeD;
|
DIType TypeD;
|
||||||
@@ -1138,7 +1129,8 @@ namespace llvm {
|
|||||||
if (!DIGV) return false;
|
if (!DIGV) return false;
|
||||||
DIGlobalVariable Var(cast<MDNode>(DIGV));
|
DIGlobalVariable Var(cast<MDNode>(DIGV));
|
||||||
|
|
||||||
Var.getDisplayName(DisplayName);
|
if (const char *D = Var.getDisplayName())
|
||||||
|
DisplayName = D;
|
||||||
LineNo = Var.getLineNumber();
|
LineNo = Var.getLineNumber();
|
||||||
Unit = Var.getCompileUnit();
|
Unit = Var.getCompileUnit();
|
||||||
TypeD = Var.getType();
|
TypeD = Var.getType();
|
||||||
@@ -1147,15 +1139,19 @@ namespace llvm {
|
|||||||
if (!DDI) return false;
|
if (!DDI) return false;
|
||||||
DIVariable Var(cast<MDNode>(DDI->getVariable()));
|
DIVariable Var(cast<MDNode>(DDI->getVariable()));
|
||||||
|
|
||||||
Var.getName(DisplayName);
|
if (const char *D = Var.getName())
|
||||||
|
DisplayName = D;
|
||||||
LineNo = Var.getLineNumber();
|
LineNo = Var.getLineNumber();
|
||||||
Unit = Var.getCompileUnit();
|
Unit = Var.getCompileUnit();
|
||||||
TypeD = Var.getType();
|
TypeD = Var.getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
TypeD.getName(Type);
|
if (const char *T = TypeD.getName())
|
||||||
Unit.getFilename(File);
|
Type = T;
|
||||||
Unit.getDirectory(Dir);
|
if (const char *F = Unit.getFilename())
|
||||||
|
File = F;
|
||||||
|
if (const char *D = Unit.getDirectory())
|
||||||
|
Dir = D;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1750,9 +1750,8 @@ void AsmPrinter::EmitComments(const MachineInstr &MI) const {
|
|||||||
O.PadToColumn(MAI->getCommentColumn());
|
O.PadToColumn(MAI->getCommentColumn());
|
||||||
O << MAI->getCommentString() << " SrcLine ";
|
O << MAI->getCommentString() << " SrcLine ";
|
||||||
if (DLT.CompileUnit) {
|
if (DLT.CompileUnit) {
|
||||||
std::string Str;
|
|
||||||
DICompileUnit CU(DLT.CompileUnit);
|
DICompileUnit CU(DLT.CompileUnit);
|
||||||
O << CU.getFilename(Str) << " ";
|
O << CU.getFilename() << " ";
|
||||||
}
|
}
|
||||||
O << DLT.Line;
|
O << DLT.Line;
|
||||||
if (DLT.Col != 0)
|
if (DLT.Col != 0)
|
||||||
|
@@ -570,9 +570,7 @@ DIType DwarfDebug::GetBlockByrefType(DIType Ty, std::string Name) {
|
|||||||
for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) {
|
for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) {
|
||||||
DIDescriptor Element = Elements.getElement(i);
|
DIDescriptor Element = Elements.getElement(i);
|
||||||
DIDerivedType DT = DIDerivedType(Element.getNode());
|
DIDerivedType DT = DIDerivedType(Element.getNode());
|
||||||
std::string Name2;
|
if (strcmp(Name.c_str(), DT.getName()) == 0)
|
||||||
DT.getName(Name2);
|
|
||||||
if (Name == Name2)
|
|
||||||
return (DT.getTypeDerivedFrom());
|
return (DT.getTypeDerivedFrom());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -648,8 +646,7 @@ void DwarfDebug::AddBlockByrefAddress(DbgVariable *&DV, DIE *Die,
|
|||||||
unsigned Tag = Ty.getTag();
|
unsigned Tag = Ty.getTag();
|
||||||
bool isPointer = false;
|
bool isPointer = false;
|
||||||
|
|
||||||
std::string varName;
|
const char *varName = VD.getName();
|
||||||
VD.getName(varName);
|
|
||||||
|
|
||||||
if (Tag == dwarf::DW_TAG_pointer_type) {
|
if (Tag == dwarf::DW_TAG_pointer_type) {
|
||||||
DIDerivedType DTy = DIDerivedType (Ty.getNode());
|
DIDerivedType DTy = DIDerivedType (Ty.getNode());
|
||||||
@@ -659,9 +656,6 @@ void DwarfDebug::AddBlockByrefAddress(DbgVariable *&DV, DIE *Die,
|
|||||||
|
|
||||||
DICompositeType blockStruct = DICompositeType(TmpTy.getNode());
|
DICompositeType blockStruct = DICompositeType(TmpTy.getNode());
|
||||||
|
|
||||||
std::string typeName;
|
|
||||||
blockStruct.getName(typeName);
|
|
||||||
|
|
||||||
// Find the __forwarding field and the variable field in the __Block_byref
|
// Find the __forwarding field and the variable field in the __Block_byref
|
||||||
// struct.
|
// struct.
|
||||||
DIArray Fields = blockStruct.getTypeArray();
|
DIArray Fields = blockStruct.getTypeArray();
|
||||||
@@ -672,11 +666,10 @@ void DwarfDebug::AddBlockByrefAddress(DbgVariable *&DV, DIE *Die,
|
|||||||
for (unsigned i = 0, N = Fields.getNumElements(); i < N; ++i) {
|
for (unsigned i = 0, N = Fields.getNumElements(); i < N; ++i) {
|
||||||
DIDescriptor Element = Fields.getElement(i);
|
DIDescriptor Element = Fields.getElement(i);
|
||||||
DIDerivedType DT = DIDerivedType(Element.getNode());
|
DIDerivedType DT = DIDerivedType(Element.getNode());
|
||||||
std::string fieldName;
|
const char *fieldName = DT.getName();
|
||||||
DT.getName(fieldName);
|
if (strcmp(fieldName, "__forwarding") == 0)
|
||||||
if (fieldName == "__forwarding")
|
|
||||||
forwardingField = Element;
|
forwardingField = Element;
|
||||||
else if (fieldName == varName)
|
else if (strcmp(fieldName, varName) == 0)
|
||||||
varField = Element;
|
varField = Element;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -823,14 +816,13 @@ void DwarfDebug::AddType(CompileUnit *DW_Unit, DIE *Entity, DIType Ty) {
|
|||||||
void DwarfDebug::ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer,
|
void DwarfDebug::ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer,
|
||||||
DIBasicType BTy) {
|
DIBasicType BTy) {
|
||||||
// Get core information.
|
// Get core information.
|
||||||
std::string Name;
|
const char *Name = BTy.getName();
|
||||||
BTy.getName(Name);
|
|
||||||
Buffer.setTag(dwarf::DW_TAG_base_type);
|
Buffer.setTag(dwarf::DW_TAG_base_type);
|
||||||
AddUInt(&Buffer, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1,
|
AddUInt(&Buffer, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1,
|
||||||
BTy.getEncoding());
|
BTy.getEncoding());
|
||||||
|
|
||||||
// Add name if not anonymous or intermediate type.
|
// Add name if not anonymous or intermediate type.
|
||||||
if (!Name.empty())
|
if (Name)
|
||||||
AddString(&Buffer, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
AddString(&Buffer, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
||||||
uint64_t Size = BTy.getSizeInBits() >> 3;
|
uint64_t Size = BTy.getSizeInBits() >> 3;
|
||||||
AddUInt(&Buffer, dwarf::DW_AT_byte_size, 0, Size);
|
AddUInt(&Buffer, dwarf::DW_AT_byte_size, 0, Size);
|
||||||
@@ -840,8 +832,7 @@ void DwarfDebug::ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer,
|
|||||||
void DwarfDebug::ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer,
|
void DwarfDebug::ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer,
|
||||||
DIDerivedType DTy) {
|
DIDerivedType DTy) {
|
||||||
// Get core information.
|
// Get core information.
|
||||||
std::string Name;
|
const char *Name = DTy.getName();
|
||||||
DTy.getName(Name);
|
|
||||||
uint64_t Size = DTy.getSizeInBits() >> 3;
|
uint64_t Size = DTy.getSizeInBits() >> 3;
|
||||||
unsigned Tag = DTy.getTag();
|
unsigned Tag = DTy.getTag();
|
||||||
|
|
||||||
@@ -855,7 +846,7 @@ void DwarfDebug::ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer,
|
|||||||
AddType(DW_Unit, &Buffer, FromTy);
|
AddType(DW_Unit, &Buffer, FromTy);
|
||||||
|
|
||||||
// Add name if not anonymous or intermediate type.
|
// Add name if not anonymous or intermediate type.
|
||||||
if (!Name.empty())
|
if (Name)
|
||||||
AddString(&Buffer, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
AddString(&Buffer, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
||||||
|
|
||||||
// Add size if non-zero (derived types might be zero-sized.)
|
// Add size if non-zero (derived types might be zero-sized.)
|
||||||
@@ -871,8 +862,7 @@ void DwarfDebug::ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer,
|
|||||||
void DwarfDebug::ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer,
|
void DwarfDebug::ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer,
|
||||||
DICompositeType CTy) {
|
DICompositeType CTy) {
|
||||||
// Get core information.
|
// Get core information.
|
||||||
std::string Name;
|
const char *Name = CTy.getName();
|
||||||
CTy.getName(Name);
|
|
||||||
|
|
||||||
uint64_t Size = CTy.getSizeInBits() >> 3;
|
uint64_t Size = CTy.getSizeInBits() >> 3;
|
||||||
unsigned Tag = CTy.getTag();
|
unsigned Tag = CTy.getTag();
|
||||||
@@ -952,7 +942,7 @@ void DwarfDebug::ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add name if not anonymous or intermediate type.
|
// Add name if not anonymous or intermediate type.
|
||||||
if (!Name.empty())
|
if (Name)
|
||||||
AddString(&Buffer, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
AddString(&Buffer, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
||||||
|
|
||||||
if (Tag == dwarf::DW_TAG_enumeration_type ||
|
if (Tag == dwarf::DW_TAG_enumeration_type ||
|
||||||
@@ -1018,8 +1008,7 @@ void DwarfDebug::ConstructArrayTypeDIE(CompileUnit *DW_Unit, DIE &Buffer,
|
|||||||
/// ConstructEnumTypeDIE - Construct enum type DIE from DIEnumerator.
|
/// ConstructEnumTypeDIE - Construct enum type DIE from DIEnumerator.
|
||||||
DIE *DwarfDebug::ConstructEnumTypeDIE(CompileUnit *DW_Unit, DIEnumerator *ETy) {
|
DIE *DwarfDebug::ConstructEnumTypeDIE(CompileUnit *DW_Unit, DIEnumerator *ETy) {
|
||||||
DIE *Enumerator = new DIE(dwarf::DW_TAG_enumerator);
|
DIE *Enumerator = new DIE(dwarf::DW_TAG_enumerator);
|
||||||
std::string Name;
|
const char *Name = ETy->getName();
|
||||||
ETy->getName(Name);
|
|
||||||
AddString(Enumerator, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
AddString(Enumerator, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
||||||
int64_t Value = ETy->getEnumValue();
|
int64_t Value = ETy->getEnumValue();
|
||||||
AddSInt(Enumerator, dwarf::DW_AT_const_value, dwarf::DW_FORM_sdata, Value);
|
AddSInt(Enumerator, dwarf::DW_AT_const_value, dwarf::DW_FORM_sdata, Value);
|
||||||
@@ -1030,12 +1019,11 @@ DIE *DwarfDebug::ConstructEnumTypeDIE(CompileUnit *DW_Unit, DIEnumerator *ETy) {
|
|||||||
DIE *DwarfDebug::CreateGlobalVariableDIE(CompileUnit *DW_Unit,
|
DIE *DwarfDebug::CreateGlobalVariableDIE(CompileUnit *DW_Unit,
|
||||||
const DIGlobalVariable &GV) {
|
const DIGlobalVariable &GV) {
|
||||||
DIE *GVDie = new DIE(dwarf::DW_TAG_variable);
|
DIE *GVDie = new DIE(dwarf::DW_TAG_variable);
|
||||||
std::string Name;
|
AddString(GVDie, dwarf::DW_AT_name, dwarf::DW_FORM_string,
|
||||||
GV.getDisplayName(Name);
|
GV.getDisplayName());
|
||||||
AddString(GVDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
|
||||||
std::string LinkageName;
|
const char *LinkageName = GV.getLinkageName();
|
||||||
GV.getLinkageName(LinkageName);
|
if (LinkageName) {
|
||||||
if (!LinkageName.empty()) {
|
|
||||||
// Skip special LLVM prefix that is used to inform the asm printer to not
|
// Skip special LLVM prefix that is used to inform the asm printer to not
|
||||||
// emit usual symbol prefix before the symbol name. This happens for
|
// emit usual symbol prefix before the symbol name. This happens for
|
||||||
// Objective-C symbol names and symbol whose name is replaced using GCC's
|
// Objective-C symbol names and symbol whose name is replaced using GCC's
|
||||||
@@ -1055,9 +1043,7 @@ DIE *DwarfDebug::CreateGlobalVariableDIE(CompileUnit *DW_Unit,
|
|||||||
/// CreateMemberDIE - Create new member DIE.
|
/// CreateMemberDIE - Create new member DIE.
|
||||||
DIE *DwarfDebug::CreateMemberDIE(CompileUnit *DW_Unit, const DIDerivedType &DT){
|
DIE *DwarfDebug::CreateMemberDIE(CompileUnit *DW_Unit, const DIDerivedType &DT){
|
||||||
DIE *MemberDie = new DIE(DT.getTag());
|
DIE *MemberDie = new DIE(DT.getTag());
|
||||||
std::string Name;
|
if (const char *Name = DT.getName())
|
||||||
DT.getName(Name);
|
|
||||||
if (!Name.empty())
|
|
||||||
AddString(MemberDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
AddString(MemberDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
||||||
|
|
||||||
AddType(DW_Unit, MemberDie, DT.getTypeDerivedFrom());
|
AddType(DW_Unit, MemberDie, DT.getTypeDerivedFrom());
|
||||||
@@ -1106,13 +1092,11 @@ DIE *DwarfDebug::CreateSubprogramDIE(CompileUnit *DW_Unit,
|
|||||||
bool IsInlined) {
|
bool IsInlined) {
|
||||||
DIE *SPDie = new DIE(dwarf::DW_TAG_subprogram);
|
DIE *SPDie = new DIE(dwarf::DW_TAG_subprogram);
|
||||||
|
|
||||||
std::string Name;
|
const char * Name = SP.getName();
|
||||||
SP.getName(Name);
|
|
||||||
AddString(SPDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
AddString(SPDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
||||||
|
|
||||||
std::string LinkageName;
|
const char *LinkageName = SP.getLinkageName();
|
||||||
SP.getLinkageName(LinkageName);
|
if (LinkageName) {
|
||||||
if (!LinkageName.empty()) {
|
|
||||||
// Skip special LLVM prefix that is used to inform the asm printer to not emit
|
// Skip special LLVM prefix that is used to inform the asm printer to not emit
|
||||||
// usual symbol prefix before the symbol name. This happens for Objective-C
|
// usual symbol prefix before the symbol name. This happens for Objective-C
|
||||||
// symbol names and symbol whose name is replaced using GCC's __asm__ attribute.
|
// symbol names and symbol whose name is replaced using GCC's __asm__ attribute.
|
||||||
@@ -1196,8 +1180,7 @@ DIE *DwarfDebug::CreateDbgScopeVariable(DbgVariable *DV, CompileUnit *Unit) {
|
|||||||
|
|
||||||
// Define variable debug information entry.
|
// Define variable debug information entry.
|
||||||
DIE *VariableDie = new DIE(Tag);
|
DIE *VariableDie = new DIE(Tag);
|
||||||
std::string Name;
|
const char *Name = VD.getName();
|
||||||
VD.getName(Name);
|
|
||||||
AddString(VariableDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
AddString(VariableDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
||||||
|
|
||||||
// Add source line info if available.
|
// Add source line info if available.
|
||||||
@@ -1398,8 +1381,8 @@ void DwarfDebug::ConstructDefaultDbgScope(MachineFunction *MF) {
|
|||||||
/// source file names. If none currently exists, create a new id and insert it
|
/// source file names. If none currently exists, create a new id and insert it
|
||||||
/// in the SourceIds map. This can update DirectoryNames and SourceFileNames
|
/// in the SourceIds map. This can update DirectoryNames and SourceFileNames
|
||||||
/// maps as well.
|
/// maps as well.
|
||||||
unsigned DwarfDebug::GetOrCreateSourceID(const std::string &DirName,
|
unsigned DwarfDebug::GetOrCreateSourceID(const char *DirName,
|
||||||
const std::string &FileName) {
|
const char *FileName) {
|
||||||
unsigned DId;
|
unsigned DId;
|
||||||
StringMap<unsigned>::iterator DI = DirectoryIdMap.find(DirName);
|
StringMap<unsigned>::iterator DI = DirectoryIdMap.find(DirName);
|
||||||
if (DI != DirectoryIdMap.end()) {
|
if (DI != DirectoryIdMap.end()) {
|
||||||
@@ -1434,28 +1417,26 @@ unsigned DwarfDebug::GetOrCreateSourceID(const std::string &DirName,
|
|||||||
|
|
||||||
void DwarfDebug::ConstructCompileUnit(MDNode *N) {
|
void DwarfDebug::ConstructCompileUnit(MDNode *N) {
|
||||||
DICompileUnit DIUnit(N);
|
DICompileUnit DIUnit(N);
|
||||||
std::string Dir, FN, Prod;
|
const char *FN = DIUnit.getFilename();
|
||||||
unsigned ID = GetOrCreateSourceID(DIUnit.getDirectory(Dir),
|
const char *Dir = DIUnit.getDirectory();
|
||||||
DIUnit.getFilename(FN));
|
unsigned ID = GetOrCreateSourceID(Dir, FN);
|
||||||
|
|
||||||
DIE *Die = new DIE(dwarf::DW_TAG_compile_unit);
|
DIE *Die = new DIE(dwarf::DW_TAG_compile_unit);
|
||||||
AddSectionOffset(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4,
|
AddSectionOffset(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4,
|
||||||
DWLabel("section_line", 0), DWLabel("section_line", 0),
|
DWLabel("section_line", 0), DWLabel("section_line", 0),
|
||||||
false);
|
false);
|
||||||
AddString(Die, dwarf::DW_AT_producer, dwarf::DW_FORM_string,
|
AddString(Die, dwarf::DW_AT_producer, dwarf::DW_FORM_string,
|
||||||
DIUnit.getProducer(Prod));
|
DIUnit.getProducer());
|
||||||
AddUInt(Die, dwarf::DW_AT_language, dwarf::DW_FORM_data1,
|
AddUInt(Die, dwarf::DW_AT_language, dwarf::DW_FORM_data1,
|
||||||
DIUnit.getLanguage());
|
DIUnit.getLanguage());
|
||||||
AddString(Die, dwarf::DW_AT_name, dwarf::DW_FORM_string, FN);
|
AddString(Die, dwarf::DW_AT_name, dwarf::DW_FORM_string, FN);
|
||||||
|
|
||||||
if (!Dir.empty())
|
if (Dir)
|
||||||
AddString(Die, dwarf::DW_AT_comp_dir, dwarf::DW_FORM_string, Dir);
|
AddString(Die, dwarf::DW_AT_comp_dir, dwarf::DW_FORM_string, Dir);
|
||||||
if (DIUnit.isOptimized())
|
if (DIUnit.isOptimized())
|
||||||
AddUInt(Die, dwarf::DW_AT_APPLE_optimized, dwarf::DW_FORM_flag, 1);
|
AddUInt(Die, dwarf::DW_AT_APPLE_optimized, dwarf::DW_FORM_flag, 1);
|
||||||
|
|
||||||
std::string Flags;
|
if (const char *Flags = DIUnit.getFlags())
|
||||||
DIUnit.getFlags(Flags);
|
|
||||||
if (!Flags.empty())
|
|
||||||
AddString(Die, dwarf::DW_AT_APPLE_flags, dwarf::DW_FORM_string, Flags);
|
AddString(Die, dwarf::DW_AT_APPLE_flags, dwarf::DW_FORM_string, Flags);
|
||||||
|
|
||||||
unsigned RVer = DIUnit.getRunTimeVersion();
|
unsigned RVer = DIUnit.getRunTimeVersion();
|
||||||
@@ -1502,8 +1483,7 @@ void DwarfDebug::ConstructGlobalVariableDIE(MDNode *N) {
|
|||||||
ModuleCU->getDie()->AddChild(VariableDie);
|
ModuleCU->getDie()->AddChild(VariableDie);
|
||||||
|
|
||||||
// Expose as global. FIXME - need to check external flag.
|
// Expose as global. FIXME - need to check external flag.
|
||||||
std::string Name;
|
ModuleCU->AddGlobal(DI_GV.getName(), VariableDie);
|
||||||
ModuleCU->AddGlobal(DI_GV.getName(Name), VariableDie);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1529,8 +1509,7 @@ void DwarfDebug::ConstructSubprogram(MDNode *N) {
|
|||||||
ModuleCU->getDie()->AddChild(SubprogramDie);
|
ModuleCU->getDie()->AddChild(SubprogramDie);
|
||||||
|
|
||||||
// Expose as global.
|
// Expose as global.
|
||||||
std::string Name;
|
ModuleCU->AddGlobal(SP.getName(), SubprogramDie);
|
||||||
ModuleCU->AddGlobal(SP.getName(Name), SubprogramDie);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1801,9 +1780,8 @@ unsigned DwarfDebug::RecordSourceLine(unsigned Line, unsigned Col,
|
|||||||
if (TimePassesIsEnabled)
|
if (TimePassesIsEnabled)
|
||||||
DebugTimer->startTimer();
|
DebugTimer->startTimer();
|
||||||
|
|
||||||
std::string Dir, Fn;
|
unsigned Src = GetOrCreateSourceID(CU.getDirectory(),
|
||||||
unsigned Src = GetOrCreateSourceID(CU.getDirectory(Dir),
|
CU.getFilename());
|
||||||
CU.getFilename(Fn));
|
|
||||||
unsigned ID = MMI->NextLabelID();
|
unsigned ID = MMI->NextLabelID();
|
||||||
Lines.push_back(SrcLineInfo(Line, Col, Src, ID));
|
Lines.push_back(SrcLineInfo(Line, Col, Src, ID));
|
||||||
|
|
||||||
@@ -1823,7 +1801,7 @@ unsigned DwarfDebug::getOrCreateSourceID(const std::string &DirName,
|
|||||||
if (TimePassesIsEnabled)
|
if (TimePassesIsEnabled)
|
||||||
DebugTimer->startTimer();
|
DebugTimer->startTimer();
|
||||||
|
|
||||||
unsigned SrcId = GetOrCreateSourceID(DirName, FileName);
|
unsigned SrcId = GetOrCreateSourceID(DirName.c_str(), FileName.c_str());
|
||||||
|
|
||||||
if (TimePassesIsEnabled)
|
if (TimePassesIsEnabled)
|
||||||
DebugTimer->stopTimer();
|
DebugTimer->stopTimer();
|
||||||
@@ -2708,13 +2686,10 @@ void DwarfDebug::EmitDebugInlineInfo() {
|
|||||||
MDNode *Node = I->first;
|
MDNode *Node = I->first;
|
||||||
SmallVector<unsigned, 4> &Labels = I->second;
|
SmallVector<unsigned, 4> &Labels = I->second;
|
||||||
DISubprogram SP(Node);
|
DISubprogram SP(Node);
|
||||||
std::string Name;
|
const char *LName = SP.getLinkageName();
|
||||||
std::string LName;
|
const char *Name = SP.getName();
|
||||||
|
|
||||||
SP.getLinkageName(LName);
|
if (!LName)
|
||||||
SP.getName(Name);
|
|
||||||
|
|
||||||
if (LName.empty())
|
|
||||||
Asm->EmitString(Name);
|
Asm->EmitString(Name);
|
||||||
else {
|
else {
|
||||||
// Skip special LLVM prefix that is used to inform the asm printer to not
|
// Skip special LLVM prefix that is used to inform the asm printer to not
|
||||||
|
@@ -450,8 +450,8 @@ class VISIBILITY_HIDDEN DwarfDebug : public Dwarf {
|
|||||||
/// source file names. If none currently exists, create a new id and insert it
|
/// source file names. If none currently exists, create a new id and insert it
|
||||||
/// in the SourceIds map. This can update DirectoryNames and SourceFileNames maps
|
/// in the SourceIds map. This can update DirectoryNames and SourceFileNames maps
|
||||||
/// as well.
|
/// as well.
|
||||||
unsigned GetOrCreateSourceID(const std::string &DirName,
|
unsigned GetOrCreateSourceID(const char *DirName,
|
||||||
const std::string &FileName);
|
const char *FileName);
|
||||||
|
|
||||||
void ConstructCompileUnit(MDNode *N);
|
void ConstructCompileUnit(MDNode *N);
|
||||||
|
|
||||||
|
@@ -1041,9 +1041,8 @@ void MachineInstr::print(raw_ostream &OS, const TargetMachine *TM) const {
|
|||||||
const MachineFunction *MF = getParent()->getParent();
|
const MachineFunction *MF = getParent()->getParent();
|
||||||
DebugLocTuple DLT = MF->getDebugLocTuple(debugLoc);
|
DebugLocTuple DLT = MF->getDebugLocTuple(debugLoc);
|
||||||
DICompileUnit CU(DLT.CompileUnit);
|
DICompileUnit CU(DLT.CompileUnit);
|
||||||
std::string Dir, Fn;
|
|
||||||
OS << " [dbg: "
|
OS << " [dbg: "
|
||||||
<< CU.getDirectory(Dir) << '/' << CU.getFilename(Fn) << ","
|
<< CU.getDirectory() << '/' << CU.getFilename() << ","
|
||||||
<< DLT.Line << ","
|
<< DLT.Line << ","
|
||||||
<< DLT.Col << "]";
|
<< DLT.Col << "]";
|
||||||
}
|
}
|
||||||
|
@@ -44,8 +44,7 @@ void PIC16DbgInfo::PopulateDebugInfo (DIType Ty, unsigned short &TypeNo,
|
|||||||
/// PopulateBasicTypeInfo- Populate TypeNo for basic type from Ty.
|
/// PopulateBasicTypeInfo- Populate TypeNo for basic type from Ty.
|
||||||
///
|
///
|
||||||
void PIC16DbgInfo::PopulateBasicTypeInfo (DIType Ty, unsigned short &TypeNo) {
|
void PIC16DbgInfo::PopulateBasicTypeInfo (DIType Ty, unsigned short &TypeNo) {
|
||||||
std::string Name = "";
|
std::string Name = Ty.getName();
|
||||||
Ty.getName(Name);
|
|
||||||
unsigned short BaseTy = GetTypeDebugNumber(Name);
|
unsigned short BaseTy = GetTypeDebugNumber(Name);
|
||||||
TypeNo = TypeNo << PIC16Dbg::S_BASIC;
|
TypeNo = TypeNo << PIC16Dbg::S_BASIC;
|
||||||
TypeNo = TypeNo | (0xffff & BaseTy);
|
TypeNo = TypeNo | (0xffff & BaseTy);
|
||||||
@@ -117,7 +116,7 @@ void PIC16DbgInfo::PopulateStructOrUnionTypeInfo (DIType Ty,
|
|||||||
TypeNo = TypeNo | PIC16Dbg::T_STRUCT;
|
TypeNo = TypeNo | PIC16Dbg::T_STRUCT;
|
||||||
else
|
else
|
||||||
TypeNo = TypeNo | PIC16Dbg::T_UNION;
|
TypeNo = TypeNo | PIC16Dbg::T_UNION;
|
||||||
CTy.getName(TagName);
|
TagName = CTy.getName();
|
||||||
// UniqueSuffix is .number where number is obtained from
|
// UniqueSuffix is .number where number is obtained from
|
||||||
// llvm.dbg.composite<number>.
|
// llvm.dbg.composite<number>.
|
||||||
// FIXME: This will break when composite type is not represented by
|
// FIXME: This will break when composite type is not represented by
|
||||||
@@ -305,9 +304,8 @@ void PIC16DbgInfo::EmitCompositeTypeElements (DICompositeType CTy,
|
|||||||
bool HasAux = false;
|
bool HasAux = false;
|
||||||
int ElementAux[PIC16Dbg::AuxSize] = { 0 };
|
int ElementAux[PIC16Dbg::AuxSize] = { 0 };
|
||||||
std::string TagName = "";
|
std::string TagName = "";
|
||||||
std::string ElementName;
|
|
||||||
DIDerivedType DITy(Element.getNode());
|
DIDerivedType DITy(Element.getNode());
|
||||||
DITy.getName(ElementName);
|
const char *ElementName = DITy.getName();
|
||||||
unsigned short ElementSize = DITy.getSizeInBits()/8;
|
unsigned short ElementSize = DITy.getSizeInBits()/8;
|
||||||
// Get mangleddd name for this structure/union element.
|
// Get mangleddd name for this structure/union element.
|
||||||
std::string MangMemName = ElementName + SuffixNo;
|
std::string MangMemName = ElementName + SuffixNo;
|
||||||
@@ -338,8 +336,7 @@ void PIC16DbgInfo::EmitCompositeTypeDecls(Module &M) {
|
|||||||
continue;
|
continue;
|
||||||
if (CTy.getTag() == dwarf::DW_TAG_union_type ||
|
if (CTy.getTag() == dwarf::DW_TAG_union_type ||
|
||||||
CTy.getTag() == dwarf::DW_TAG_structure_type ) {
|
CTy.getTag() == dwarf::DW_TAG_structure_type ) {
|
||||||
std::string Name;
|
const char *Name = CTy.getName();
|
||||||
CTy.getName(Name);
|
|
||||||
// Get the number after llvm.dbg.composite and make UniqueSuffix from
|
// Get the number after llvm.dbg.composite and make UniqueSuffix from
|
||||||
// it.
|
// it.
|
||||||
std::string DIVar = CTy.getNode()->getNameStr();
|
std::string DIVar = CTy.getNode()->getNameStr();
|
||||||
@@ -468,9 +465,9 @@ void PIC16DbgInfo::EmitVarDebugInfo(Module &M) {
|
|||||||
void PIC16DbgInfo::SwitchToCU(MDNode *CU) {
|
void PIC16DbgInfo::SwitchToCU(MDNode *CU) {
|
||||||
// Get the file path from CU.
|
// Get the file path from CU.
|
||||||
DICompileUnit cu(CU);
|
DICompileUnit cu(CU);
|
||||||
std::string DirName, FileName;
|
std::string DirName = cu.getDirectory();
|
||||||
std::string FilePath = cu.getDirectory(DirName) + "/" +
|
std::string FileName = cu.getFilename();
|
||||||
cu.getFilename(FileName);
|
std::string FilePath = DirName + "/" + FileName;
|
||||||
|
|
||||||
// Nothing to do if source file is still same.
|
// Nothing to do if source file is still same.
|
||||||
if ( FilePath == CurFile ) return;
|
if ( FilePath == CurFile ) return;
|
||||||
|
Reference in New Issue
Block a user