From 8fb001684fb7740d6bed973f927bc33bc7473ff7 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Mon, 31 Mar 2008 23:14:05 +0000 Subject: [PATCH] Better handling for tabs with message bubbles. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49001 91177308-0d34-0410-b5e6-96231b3b80d8 --- Driver/ASTConsumers.cpp | 12 +++++++----- Driver/HTMLDiagnostics.cpp | 2 +- lib/Rewrite/HTMLRewrite.cpp | 6 ++++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp index 60246865e9..9b3d0974b3 100644 --- a/Driver/ASTConsumers.cpp +++ b/Driver/ASTConsumers.cpp @@ -671,15 +671,17 @@ void GRSimpleValsVisitor::VisitCFG(CFG& C, Decl& CD) { if (!Visualize) { if (FunctionDecl *FD = dyn_cast(&CD)) { - llvm::cerr << "ANALYZE: " << FD->getIdentifier()->getName() << ' ' + llvm::cerr << "ANALYZE: " << Ctx->getSourceManager().getSourceName(FD->getLocation()) - << ' '; + << ' ' + << FD->getIdentifier()->getName() + << '\n'; } else if (ObjCMethodDecl *MD = dyn_cast(&CD)) { - llvm::cerr << "ANALYZE (ObjC Method): '" - << MD->getSelector().getName() << "' " + llvm::cerr << "ANALYZE (ObjC Method): " << Ctx->getSourceManager().getSourceName(MD->getLocation()) - << ' '; + << " '" + << MD->getSelector().getName() << "'\n"; } #if 0 diff --git a/Driver/HTMLDiagnostics.cpp b/Driver/HTMLDiagnostics.cpp index df2bb06636..7f6a369de7 100644 --- a/Driver/HTMLDiagnostics.cpp +++ b/Driver/HTMLDiagnostics.cpp @@ -205,7 +205,7 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, unsigned PosNo = 0; for (const char* c = LineStart; c != TokLogicalPtr; ++c) - PosNo += *c == '\t' ? 8 : 1; + PosNo += *c == '\t' ? 4 : 1; // Create the html for the message. diff --git a/lib/Rewrite/HTMLRewrite.cpp b/lib/Rewrite/HTMLRewrite.cpp index f3371a01f8..f63b8e4056 100644 --- a/lib/Rewrite/HTMLRewrite.cpp +++ b/lib/Rewrite/HTMLRewrite.cpp @@ -36,9 +36,10 @@ void html::EscapeText(Rewriter& R, unsigned FileID, bool EscapeSpaces) { default: break; case ' ': - if (EscapeSpaces) R.ReplaceText(Loc, 1, " ", 5); + if (EscapeSpaces) R.ReplaceText(Loc, 1, " ", 6); break; + case '\t': R.ReplaceText(Loc, 1, "    ", 6*4); break; case '<': R.ReplaceText(Loc, 1, "<", 4); break; case '>': R.ReplaceText(Loc, 1, ">", 4); break; case '&': R.ReplaceText(Loc, 1, "&", 5); break; @@ -60,10 +61,11 @@ std::string html::EscapeText(const std::string& s, bool EscapeSpaces) { os << c; break; case ' ': - if (EscapeSpaces) os << " "; + if (EscapeSpaces) os << " "; else os << ' '; break; + case '\t': for (unsigned i = 0; i < 4; ++i) os << " "; break; case '<': os << "<"; break; case '>': os << ">"; break; case '&': os << "&"; break; -- 2.40.0