diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:06:01 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:06:01 +0000 |
| commit | 486754660bb926339aefcf012a3f848592babb8b (patch) | |
| tree | ecdbc446c9876f4f120f701c243373cd3cb43db3 /lib/Sema/IdentifierResolver.cpp | |
| parent | 55e6d896ad333f07bb3b1ba487df214fc268a4ab (diff) | |
Notes
Diffstat (limited to 'lib/Sema/IdentifierResolver.cpp')
| -rw-r--r-- | lib/Sema/IdentifierResolver.cpp | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/lib/Sema/IdentifierResolver.cpp b/lib/Sema/IdentifierResolver.cpp index 0bdb19490bc5..dbd52dee1eea 100644 --- a/lib/Sema/IdentifierResolver.cpp +++ b/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,14 +248,16 @@ IdentifierResolver::begin(DeclarationName Name) { } namespace { - enum DeclMatchKind { - DMK_Different, - DMK_Replace, - DMK_Ignore - }; -} -/// \brief Compare two declarations to see whether they are different or, +enum DeclMatchKind { + DMK_Different, + DMK_Replace, + DMK_Ignore +}; + +} // namespace + +/// Compare two declarations to see whether they are different or, /// if they are the same, whether the new declaration should replace the /// existing declaration. static DeclMatchKind compareDeclarations(NamedDecl *Existing, NamedDecl *New) { |
