[cfe-commits] r98437 - /cfe/trunk/lib/Frontend/HTMLDiagnostics.cpp

Benjamin Kramer benny.kra at googlemail.com
Sat Mar 13 03:34:41 PST 2010


Author: d0k
Date: Sat Mar 13 05:34:41 2010
New Revision: 98437

URL: http://llvm.org/viewvc/llvm-project?rev=98437&view=rev
Log:
Simplify code.

Modified:
    cfe/trunk/lib/Frontend/HTMLDiagnostics.cpp

Modified: cfe/trunk/lib/Frontend/HTMLDiagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/HTMLDiagnostics.cpp?rev=98437&r1=98436&r2=98437&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/HTMLDiagnostics.cpp (original)
+++ cfe/trunk/lib/Frontend/HTMLDiagnostics.cpp Sat Mar 13 05:34:41 2010
@@ -502,19 +502,13 @@
 }
 
 static void EmitAlphaCounter(llvm::raw_ostream& os, unsigned n) {
-  llvm::SmallString<10> buf;
+  unsigned x = n % ('z' - 'a');
+  n /= 'z' - 'a';
 
-  do {
-    unsigned x = n % ('z' - 'a');
-    buf.push_back('a' + x);
-    n = n / ('z' - 'a');
-  } while (n);
-
-  assert(!buf.empty());
-
-  for (llvm::SmallVectorImpl<char>::reverse_iterator I=buf.rbegin(),
-       E=buf.rend(); I!=E; ++I)
-    os << *I;
+  if (n > 0)
+    EmitAlphaCounter(os, n);
+
+  os << char('a' + x);
 }
 
 unsigned HTMLDiagnostics::ProcessMacroPiece(llvm::raw_ostream& os,





More information about the cfe-commits mailing list