From: Duncan P. N. Exon Smith Date: Tue, 14 Apr 2015 02:09:32 +0000 (+0000) Subject: DebugInfo: Move DIVariable::printExtendedName() to its only caller X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=79666c21ab6d29d9c5b69d3d7690a043c9d84c9a;p=oota-llvm.git DebugInfo: Move DIVariable::printExtendedName() to its only caller Move the local function `printDebugLoc()` along with it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234838 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/IR/DebugInfo.h b/include/llvm/IR/DebugInfo.h index 6eb37a07541..96a5e4c06e6 100644 --- a/include/llvm/IR/DebugInfo.h +++ b/include/llvm/IR/DebugInfo.h @@ -642,8 +642,6 @@ public: /// \brief If this variable is inlined then return inline location. MDNode *getInlinedAt() const { return get()->getInlinedAt(); } - - void printExtendedName(raw_ostream &OS) const; }; class DIExpression { diff --git a/lib/CodeGen/LiveDebugVariables.cpp b/lib/CodeGen/LiveDebugVariables.cpp index cf02e31240f..2e8615219c8 100644 --- a/lib/CodeGen/LiveDebugVariables.cpp +++ b/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(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(Variable); OS << "!\""; - DV.printExtendedName(OS); + printExtendedName(OS, DV); + OS << "\"\t"; if (offset) OS << '+' << offset; diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp index fe74ec51a0d..35c4f785b2b 100644 --- a/lib/IR/DebugInfo.cpp +++ b/lib/IR/DebugInfo.cpp @@ -349,41 +349,6 @@ void DIDescriptor::print(raw_ostream &OS) const { get()->print(OS); } -static void printDebugLoc(DebugLoc DL, raw_ostream &CommentOS, - const LLVMContext &Ctx) { - if (!DL) - return; - - DIScope Scope = cast(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 << " ]"; -} - -void DIVariable::printExtendedName(raw_ostream &OS) const { - const LLVMContext &Ctx = DbgNode->getContext(); - StringRef Res = getName(); - if (!Res.empty()) - OS << Res << "," << getLineNumber(); - if (auto *InlinedAt = get()->getInlinedAt()) { - if (DebugLoc InlinedAtDL = InlinedAt) { - OS << " @["; - printDebugLoc(InlinedAtDL, OS, Ctx); - OS << "]"; - } - } -} - template <> DIDescriptor DIRef::resolve(const DITypeIdentifierMap &Map) const {