r279946 - AST: improve layout of SimpleTypoCorrector

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 28 14:33:31 PDT 2016


Author: compnerd
Date: Sun Aug 28 16:33:30 2016
New Revision: 279946

URL: http://llvm.org/viewvc/llvm-project?rev=279946&view=rev
Log:
AST: improve layout of SimpleTypoCorrector

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

Patch by Alexander Shaposhnikov!

Modified:
    cfe/trunk/lib/AST/CommentSema.cpp

Modified: cfe/trunk/lib/AST/CommentSema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentSema.cpp?rev=279946&r1=279945&r2=279946&view=diff
==============================================================================
--- cfe/trunk/lib/AST/CommentSema.cpp (original)
+++ cfe/trunk/lib/AST/CommentSema.cpp Sun Aug 28 16:33:30 2016
@@ -950,20 +950,19 @@ unsigned Sema::resolveParmVarReference(S
 
 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),
-      BestIndex(0), NextIndex(0)
-  { }
+  explicit SimpleTypoCorrector(StringRef Typo)
+      : BestDecl(nullptr), Typo(Typo), MaxEditDistance((Typo.size() + 2) / 3),
+        BestEditDistance(MaxEditDistance + 1), BestIndex(0), NextIndex(0) {}
 
   void addDecl(const NamedDecl *ND);
 




More information about the cfe-commits mailing list