summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2014-05-15 21:24:32 +0000
committerAlexey Samsonov <samsonov@google.com>2014-05-15 21:24:32 +0000
commitb043c3d94a7d6440f7c333f835e5d1c921a679b7 (patch)
treecacfc8715ba01dcccd1911426943bdff2df40efa /tools
parent48ea98d1d228dfc58f9662473a4253c052c44b03 (diff)
downloadllvm-b043c3d94a7d6440f7c333f835e5d1c921a679b7.tar.gz
llvm-b043c3d94a7d6440f7c333f835e5d1c921a679b7.tar.bz2
llvm-b043c3d94a7d6440f7c333f835e5d1c921a679b7.tar.xz
[DWARF parser] Use enums instead of bitfields in DILineInfoSpecifier.
It is more appropriate than the current situation, when one flag (AbsoluteFilePath) is relevant only if another flag is set. This refactoring would also simplify fetching the short function name (stored in DW_AT_name) instead of a linkage name returned currently. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208921 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/llvm-dwarfdump/llvm-dwarfdump.cpp12
-rw-r--r--tools/llvm-symbolizer/LLVMSymbolize.cpp17
2 files changed, 14 insertions, 15 deletions
diff --git a/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
index e41ae25168..58914f08a4 100644
--- a/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
+++ b/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
@@ -108,13 +108,13 @@ static void DumpInput(const StringRef &Filename) {
DICtx->dump(outs(), DumpType);
} else {
// Print line info for the specified address.
- int SpecFlags = DILineInfoSpecifier::FileLineInfo |
- DILineInfoSpecifier::AbsoluteFilePath;
- if (PrintFunctions)
- SpecFlags |= DILineInfoSpecifier::FunctionName;
+ DILineInfoSpecifier Spec(
+ DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath,
+ PrintFunctions ? DILineInfoSpecifier::FunctionNameKind::LinkageName
+ : DILineInfoSpecifier::FunctionNameKind::None);
if (PrintInlining) {
DIInliningInfo InliningInfo =
- DICtx->getInliningInfoForAddress(Address, SpecFlags);
+ DICtx->getInliningInfoForAddress(Address, Spec);
uint32_t n = InliningInfo.getNumberOfFrames();
if (n == 0) {
// Print one empty debug line info in any case.
@@ -126,7 +126,7 @@ static void DumpInput(const StringRef &Filename) {
}
}
} else {
- DILineInfo dli = DICtx->getLineInfoForAddress(Address, SpecFlags);
+ DILineInfo dli = DICtx->getLineInfoForAddress(Address, Spec);
PrintDILineInfo(dli);
}
}
diff --git a/tools/llvm-symbolizer/LLVMSymbolize.cpp b/tools/llvm-symbolizer/LLVMSymbolize.cpp
index 4a9bbe5e82..7018ebed73 100644
--- a/tools/llvm-symbolizer/LLVMSymbolize.cpp
+++ b/tools/llvm-symbolizer/LLVMSymbolize.cpp
@@ -35,13 +35,12 @@ static bool error(error_code ec) {
return true;
}
-static uint32_t
-getDILineInfoSpecifierFlags(const LLVMSymbolizer::Options &Opts) {
- uint32_t Flags = llvm::DILineInfoSpecifier::FileLineInfo |
- llvm::DILineInfoSpecifier::AbsoluteFilePath;
- if (Opts.PrintFunctions)
- Flags |= llvm::DILineInfoSpecifier::FunctionName;
- return Flags;
+static DILineInfoSpecifier
+getDILineInfoSpecifier(const LLVMSymbolizer::Options &Opts) {
+ return DILineInfoSpecifier(
+ DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath,
+ Opts.PrintFunctions ? DILineInfoSpecifier::FunctionNameKind::LinkageName
+ : DILineInfoSpecifier::FunctionNameKind::None);
}
ModuleInfo::ModuleInfo(ObjectFile *Obj, DIContext *DICtx)
@@ -115,7 +114,7 @@ DILineInfo ModuleInfo::symbolizeCode(
DILineInfo LineInfo;
if (DebugInfoContext) {
LineInfo = DebugInfoContext->getLineInfoForAddress(
- ModuleOffset, getDILineInfoSpecifierFlags(Opts));
+ ModuleOffset, getDILineInfoSpecifier(Opts));
}
// Override function name from symbol table if necessary.
if (Opts.PrintFunctions && Opts.UseSymbolTable) {
@@ -134,7 +133,7 @@ DIInliningInfo ModuleInfo::symbolizeInlinedCode(
DIInliningInfo InlinedContext;
if (DebugInfoContext) {
InlinedContext = DebugInfoContext->getInliningInfoForAddress(
- ModuleOffset, getDILineInfoSpecifierFlags(Opts));
+ ModuleOffset, getDILineInfoSpecifier(Opts));
}
// Make sure there is at least one frame in context.
if (InlinedContext.getNumberOfFrames() == 0) {