From bef47f0b8312f854a127c1611bb9549eb960efcb Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Sat, 20 Feb 2016 23:09:14 +0000 Subject: [PATCH] Lex: Use dbgs() instead of fprintf() in HeaderMap::dump() This way it's easy to change HeaderMapImpl::getString() to return a StringRef. There's a slight change here, because I used `errs()` instead of `dbgs()`. But `dbgs()` is more appropriate for a dump method. llvm-svn: 261456 --- clang/lib/Lex/HeaderMap.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/clang/lib/Lex/HeaderMap.cpp b/clang/lib/Lex/HeaderMap.cpp index 220e70d..394a51d 100644 --- a/clang/lib/Lex/HeaderMap.cpp +++ b/clang/lib/Lex/HeaderMap.cpp @@ -20,7 +20,7 @@ #include "llvm/Support/MathExtras.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/SwapByteOrder.h" -#include +#include "llvm/Support/Debug.h" #include using namespace clang; @@ -168,9 +168,8 @@ LLVM_DUMP_METHOD void HeaderMapImpl::dump() const { const HMapHeader &Hdr = getHeader(); unsigned NumBuckets = getEndianAdjustedWord(Hdr.NumBuckets); - fprintf(stderr, "Header Map %s:\n %d buckets, %d entries\n", - getFileName(), NumBuckets, - getEndianAdjustedWord(Hdr.NumEntries)); + llvm::dbgs() << "Header Map " << getFileName() << ":\n " << NumBuckets + << ", " << getEndianAdjustedWord(Hdr.NumEntries) << "\n"; for (unsigned i = 0; i != NumBuckets; ++i) { HMapBucket B = getBucket(i); @@ -179,7 +178,8 @@ LLVM_DUMP_METHOD void HeaderMapImpl::dump() const { const char *Key = getString(B.Key); const char *Prefix = getString(B.Prefix); const char *Suffix = getString(B.Suffix); - fprintf(stderr, " %d. %s -> '%s' '%s'\n", i, Key, Prefix, Suffix); + llvm::dbgs() << " " << i << ". " << Key << " -> '" << Prefix << "' '" + << Suffix << "'\n"; } } -- 2.7.4