diff options
Diffstat (limited to 'clang/lib/Sema/IdentifierResolver.cpp')
-rw-r--r-- | clang/lib/Sema/IdentifierResolver.cpp | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/clang/lib/Sema/IdentifierResolver.cpp b/clang/lib/Sema/IdentifierResolver.cpp index 0bdb19490bc..f31c5174bf1 100644 --- a/clang/lib/Sema/IdentifierResolver.cpp +++ b/clang/lib/Sema/IdentifierResolver.cpp @@ -1,4 +1,4 @@ -//===- IdentifierResolver.cpp - Lexical Scope Name lookup -------*- C++ -*-===// +//===- IdentifierResolver.cpp - Lexical Scope Name lookup -----------------===// // // The LLVM Compiler Infrastructure // @@ -14,10 +14,16 @@ #include "clang/Sema/IdentifierResolver.h" #include "clang/AST/Decl.h" +#include "clang/AST/DeclBase.h" +#include "clang/AST/DeclarationName.h" +#include "clang/Basic/IdentifierTable.h" #include "clang/Basic/LangOptions.h" #include "clang/Lex/ExternalPreprocessorSource.h" #include "clang/Lex/Preprocessor.h" #include "clang/Sema/Scope.h" +#include "llvm/Support/ErrorHandling.h" +#include <cassert> +#include <cstdint> using namespace clang; @@ -35,17 +41,17 @@ class IdentifierResolver::IdDeclInfoMap { /// impossible to add something to a pre-C++0x STL container without /// a completely unnecessary copy. struct IdDeclInfoPool { - IdDeclInfoPool(IdDeclInfoPool *Next) : Next(Next) {} - IdDeclInfoPool *Next; IdDeclInfo Pool[POOL_SIZE]; + + IdDeclInfoPool(IdDeclInfoPool *Next) : Next(Next) {} }; - IdDeclInfoPool *CurPool; - unsigned int CurIndex; + IdDeclInfoPool *CurPool = nullptr; + unsigned int CurIndex = POOL_SIZE; public: - IdDeclInfoMap() : CurPool(nullptr), CurIndex(POOL_SIZE) {} + IdDeclInfoMap() = default; ~IdDeclInfoMap() { IdDeclInfoPool *Cur = CurPool; @@ -60,7 +66,6 @@ public: IdDeclInfo &operator[](DeclarationName Name); }; - //===----------------------------------------------------------------------===// // IdDeclInfo Implementation //===----------------------------------------------------------------------===// @@ -83,9 +88,7 @@ void IdentifierResolver::IdDeclInfo::RemoveDecl(NamedDecl *D) { //===----------------------------------------------------------------------===// IdentifierResolver::IdentifierResolver(Preprocessor &PP) - : LangOpt(PP.getLangOpts()), PP(PP), - IdDeclInfos(new IdDeclInfoMap) { -} + : LangOpt(PP.getLangOpts()), PP(PP), IdDeclInfos(new IdDeclInfoMap) {} IdentifierResolver::~IdentifierResolver() { delete IdDeclInfos; @@ -245,12 +248,14 @@ IdentifierResolver::begin(DeclarationName Name) { } namespace { - enum DeclMatchKind { - DMK_Different, - DMK_Replace, - DMK_Ignore - }; -} + +enum DeclMatchKind { + DMK_Different, + DMK_Replace, + DMK_Ignore +}; + +} // namespace /// \brief Compare two declarations to see whether they are different or, /// if they are the same, whether the new declaration should replace the |