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!

llvm-svn: 279946
This commit is contained in:
Saleem Abdulrasool 2016-08-28 21:33:30 +00:00
parent 2fc65041be
commit 61c0b0c32a
1 changed files with 5 additions and 6 deletions

View 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);