diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-14 02:09:32 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-14 02:09:32 +0000 |
commit | 32e7f2860b831b757ca5bae7a4d8a862ac761721 (patch) | |
tree | dddb531abb61d056034a72c4849ec3f0ee88dc4f /llvm/lib/CodeGen/LiveDebugVariables.cpp | |
parent | 571baebacb99a415f39acdaafe321eeb855a8407 (diff) | |
download | bcm5719-llvm-32e7f2860b831b757ca5bae7a4d8a862ac761721.tar.gz bcm5719-llvm-32e7f2860b831b757ca5bae7a4d8a862ac761721.zip |
DebugInfo: Move DIVariable::printExtendedName() to its only caller
Move the local function `printDebugLoc()` along with it.
llvm-svn: 234838
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugVariables.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LiveDebugVariables.cpp | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp b/llvm/lib/CodeGen/LiveDebugVariables.cpp index cf02e31240f..2e8615219c8 100644 --- a/llvm/lib/CodeGen/LiveDebugVariables.cpp +++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp @@ -357,10 +357,46 @@ public: }; } // namespace +static void printDebugLoc(DebugLoc DL, raw_ostream &CommentOS, + const LLVMContext &Ctx) { + if (!DL) + return; + + DIScope Scope = cast<MDScope>(DL.getScope()); + // Omit the directory, because it's likely to be long and uninteresting. + CommentOS << Scope.getFilename(); + CommentOS << ':' << DL.getLine(); + if (DL.getCol() != 0) + CommentOS << ':' << DL.getCol(); + + DebugLoc InlinedAtDL = DL.getInlinedAt(); + if (!InlinedAtDL) + return; + + CommentOS << " @[ "; + printDebugLoc(InlinedAtDL, CommentOS, Ctx); + CommentOS << " ]"; +} + +static void printExtendedName(raw_ostream &OS, const MDLocalVariable *V) { + const LLVMContext &Ctx = V->getContext(); + StringRef Res = V->getName(); + if (!Res.empty()) + OS << Res << "," << V->getLine(); + if (auto *InlinedAt = V->getInlinedAt()) { + if (DebugLoc InlinedAtDL = InlinedAt) { + OS << " @["; + printDebugLoc(InlinedAtDL, OS, Ctx); + OS << "]"; + } + } +} + void UserValue::print(raw_ostream &OS, const TargetRegisterInfo *TRI) { DIVariable DV = cast<MDLocalVariable>(Variable); OS << "!\""; - DV.printExtendedName(OS); + printExtendedName(OS, DV); + OS << "\"\t"; if (offset) OS << '+' << offset; |