[clang] 808004f - [clang][NFC] Reformat expandTabs

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 3 22:53:12 PDT 2023


Author: Timm Bäder
Date: 2023-06-04T07:52:46+02:00
New Revision: 808004f82af7ba3d17ddaffbd809d491aa0a865e

URL: https://github.com/llvm/llvm-project/commit/808004f82af7ba3d17ddaffbd809d491aa0a865e
DIFF: https://github.com/llvm/llvm-project/commit/808004f82af7ba3d17ddaffbd809d491aa0a865e.diff

LOG: [clang][NFC] Reformat expandTabs

Use the proper capitalization here as well as a init capture for better
identifiers.

Added: 
    

Modified: 
    clang/lib/Frontend/TextDiagnostic.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/TextDiagnostic.cpp b/clang/lib/Frontend/TextDiagnostic.cpp
index ad5f1d45cb631..137001dc050d1 100644
--- a/clang/lib/Frontend/TextDiagnostic.cpp
+++ b/clang/lib/Frontend/TextDiagnostic.cpp
@@ -161,15 +161,15 @@ printableTextForNextCharacter(StringRef SourceLine, size_t *i,
 }
 
 static void expandTabs(std::string &SourceLine, unsigned TabStop) {
-  size_t i = SourceLine.size();
-  while (i>0) {
-    i--;
-    if (SourceLine[i]!='\t')
+  size_t I = SourceLine.size();
+  while (I > 0) {
+    I--;
+    if (SourceLine[I] != '\t')
       continue;
-    size_t tmp_i = i;
-    std::pair<SmallString<16>,bool> res
-      = printableTextForNextCharacter(SourceLine, &tmp_i, TabStop);
-    SourceLine.replace(i, 1, res.first.c_str());
+    size_t TmpI = I;
+    auto [Str, Printable] =
+        printableTextForNextCharacter(SourceLine, &TmpI, TabStop);
+    SourceLine.replace(I, 1, Str.c_str());
   }
 }
 


        


More information about the cfe-commits mailing list