]> granicus.if.org Git - clang/commitdiff
AST: improve layout of SimpleTypoCorrector
authorSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 28 Aug 2016 21:33:30 +0000 (21:33 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 28 Aug 2016 21:33:30 +0000 (21:33 +0000)
Add the "explicit" specifier to the single-argument constructor of
SimpleTypoCorrector.  Reorder the fields to remove excessive padding (8 bytes).

Patch by Alexander Shaposhnikov!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@279946 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/CommentSema.cpp

index f5f4f70dcbbf4b15bbb1b0e0bbdb6c7df12e341a..d39a9b26b2a8db1246d553b80176b3b08ca183ac 100644 (file)
@@ -950,20 +950,19 @@ unsigned Sema::resolveParmVarReference(StringRef Name,
 
 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);