[llvm] r234838 - DebugInfo: Move DIVariable::printExtendedName() to its only caller
Duncan P. N. Exon Smith
dexonsmith at apple.com
Mon Apr 13 19:09:33 PDT 2015
Author: dexonsmith
Date: Mon Apr 13 21:09:32 2015
New Revision: 234838
URL: http://llvm.org/viewvc/llvm-project?rev=234838&view=rev
Log:
DebugInfo: Move DIVariable::printExtendedName() to its only caller
Move the local function `printDebugLoc()` along with it.
Modified:
llvm/trunk/include/llvm/IR/DebugInfo.h
llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp
llvm/trunk/lib/IR/DebugInfo.cpp
Modified: llvm/trunk/include/llvm/IR/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfo.h?rev=234838&r1=234837&r2=234838&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/IR/DebugInfo.h Mon Apr 13 21:09:32 2015
@@ -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 {
Modified: llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp?rev=234838&r1=234837&r2=234838&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp Mon Apr 13 21:09:32 2015
@@ -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;
Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=234838&r1=234837&r2=234838&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Mon Apr 13 21:09:32 2015
@@ -349,41 +349,6 @@ void DIDescriptor::print(raw_ostream &OS
get()->print(OS);
}
-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 << " ]";
-}
-
-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<DIDescriptor>::resolve(const DITypeIdentifierMap &Map) const {
More information about the llvm-commits
mailing list