[PATCH] D50661: Add a newline to SourceLocation dump output
Stephen Kelly via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 13 13:25:11 PDT 2018
steveire created this revision.
Herald added a subscriber: cfe-commits.
Migrate callers to print().
dump() should be useful to downstreams and third parties as a debugging
aid. Everyone trips up on this and creates confusing output.
Repository:
rC Clang
https://reviews.llvm.org/D50661
Files:
lib/ARCMigrate/TransGCAttrs.cpp
lib/AST/CommentLexer.cpp
lib/Analysis/LiveVariables.cpp
lib/Basic/Diagnostic.cpp
lib/Basic/SourceLocation.cpp
lib/Lex/Preprocessor.cpp
Index: lib/Lex/Preprocessor.cpp
===================================================================
--- lib/Lex/Preprocessor.cpp
+++ lib/Lex/Preprocessor.cpp
@@ -250,7 +250,7 @@
}
void Preprocessor::DumpLocation(SourceLocation Loc) const {
- Loc.dump(SourceMgr);
+ Loc.print(llvm::errs(), SourceMgr);
}
void Preprocessor::DumpMacro(const MacroInfo &MI) const {
Index: lib/Basic/SourceLocation.cpp
===================================================================
--- lib/Basic/SourceLocation.cpp
+++ lib/Basic/SourceLocation.cpp
@@ -77,6 +77,7 @@
LLVM_DUMP_METHOD void SourceLocation::dump(const SourceManager &SM) const {
print(llvm::errs(), SM);
+ llvm::errs() << '\n';
}
//===----------------------------------------------------------------------===//
Index: lib/Basic/Diagnostic.cpp
===================================================================
--- lib/Basic/Diagnostic.cpp
+++ lib/Basic/Diagnostic.cpp
@@ -239,7 +239,7 @@
void DiagnosticsEngine::DiagStateMap::dump(SourceManager &SrcMgr,
StringRef DiagName) const {
llvm::errs() << "diagnostic state at ";
- CurDiagStateLoc.dump(SrcMgr);
+ CurDiagStateLoc.print(llvm::errs(), SrcMgr);
llvm::errs() << ": " << CurDiagState << "\n";
for (auto &F : Files) {
@@ -261,7 +261,7 @@
<< Decomp.first.getHashValue() << "> ";
SrcMgr.getLocForStartOfFile(Decomp.first)
.getLocWithOffset(Decomp.second)
- .dump(SrcMgr);
+ .print(llvm::errs(), SrcMgr);
}
if (File.HasLocalTransitions)
llvm::errs() << " has_local_transitions";
@@ -281,7 +281,7 @@
llvm::errs() << " ";
SrcMgr.getLocForStartOfFile(ID)
.getLocWithOffset(Transition.Offset)
- .dump(SrcMgr);
+ .print(llvm::errs(), SrcMgr);
llvm::errs() << ": state " << Transition.State << ":\n";
};
Index: lib/Analysis/LiveVariables.cpp
===================================================================
--- lib/Analysis/LiveVariables.cpp
+++ lib/Analysis/LiveVariables.cpp
@@ -626,7 +626,7 @@
de = declVec.end(); di != de; ++di) {
llvm::errs() << " " << (*di)->getDeclName().getAsString()
<< " <";
- (*di)->getLocation().dump(M);
+ (*di)->getLocation().print(llvm::errs(), M);
llvm::errs() << ">\n";
}
}
Index: lib/AST/CommentLexer.cpp
===================================================================
--- lib/AST/CommentLexer.cpp
+++ lib/AST/CommentLexer.cpp
@@ -21,7 +21,7 @@
void Token::dump(const Lexer &L, const SourceManager &SM) const {
llvm::errs() << "comments::Token Kind=" << Kind << " ";
- Loc.dump(SM);
+ Loc.print(llvm::errs(), SM);
llvm::errs() << " " << Length << " \"" << L.getSpelling(*this, SM) << "\"\n";
}
Index: lib/ARCMigrate/TransGCAttrs.cpp
===================================================================
--- lib/ARCMigrate/TransGCAttrs.cpp
+++ lib/ARCMigrate/TransGCAttrs.cpp
@@ -340,7 +340,7 @@
llvm::errs() << "KIND: "
<< (Attr.Kind == GCAttrOccurrence::Strong ? "strong" : "weak");
llvm::errs() << "\nLOC: ";
- Attr.Loc.dump(Pass.Ctx.getSourceManager());
+ Attr.Loc.print(llvm::errs(), Pass.Ctx.getSourceManager());
llvm::errs() << "\nTYPE: ";
Attr.ModifiedType.dump();
if (Attr.Dcl) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50661.160434.patch
Type: text/x-patch
Size: 3387 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180813/49776958/attachment-0001.bin>
More information about the cfe-commits
mailing list