[PATCH] D23653: Minor cleanup of SimpleTypoCorrector

Alexander Shaposhnikov via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 18 04:31:45 PDT 2016


alexshap created this revision.
alexshap added reviewers: gribozavr, bkramer.
alexshap added a subscriber: cfe-commits.
alexshap changed the visibility of this Differential Revision from "Public (No Login Required)" to "All Users".

Add the "explicit" specifier to the single-argument constructor of SimpleTypoCorrector.
Reorder the fields to remove excessive padding (8 bytes).

https://reviews.llvm.org/D23653

Files:
  lib/AST/CommentSema.cpp

Index: lib/AST/CommentSema.cpp
===================================================================
--- lib/AST/CommentSema.cpp
+++ lib/AST/CommentSema.cpp
@@ -950,18 +950,18 @@
 
 namespace {
 class SimpleTypoCorrector {
+  const NamedDecl *BestDecl;
   StringRef Typo;
   const unsigned MaxEditDistance;
-
-  const NamedDecl *BestDecl;
   unsigned BestEditDistance;
   unsigned BestIndex;
   unsigned NextIndex;
 
 public:
-  SimpleTypoCorrector(StringRef Typo) :
-      Typo(Typo), MaxEditDistance((Typo.size() + 2) / 3),
-      BestDecl(nullptr), BestEditDistance(MaxEditDistance + 1),
+  explicit SimpleTypoCorrector(StringRef Typo) :
+      BestDecl(nullptr), Typo(Typo),
+      MaxEditDistance((Typo.size() + 2) / 3), 
+      BestEditDistance(MaxEditDistance + 1),
       BestIndex(0), NextIndex(0)
   { }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23653.68508.patch
Type: text/x-patch
Size: 814 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160818/e5106374/attachment-0001.bin>


More information about the cfe-commits mailing list