Chris Lattner | a2f42b1 | 2008-04-11 07:06:57 +0000 | [diff] [blame] | 1 | //===- IdentifierResolver.h - Lexical Scope Name lookup ---------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
Argyrios Kyrtzidis | 321f278 | 2008-04-12 01:50:47 +0000 | [diff] [blame] | 10 | // This file defines the IdentifierResolver class, which is used for lexical |
Chris Lattner | a2f42b1 | 2008-04-11 07:06:57 +0000 | [diff] [blame] | 11 | // scoped lookup, based on identifier. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef LLVM_CLANG_AST_SEMA_IDENTIFIERRESOLVER_H |
| 16 | #define LLVM_CLANG_AST_SEMA_IDENTIFIERRESOLVER_H |
| 17 | |
| 18 | namespace clang { |
| 19 | class IdentifierInfo; |
| 20 | class NamedDecl; |
| 21 | class Scope; |
| 22 | |
| 23 | /// IdentifierResolver - Keeps track of shadowed decls on enclosing scopes. |
Argyrios Kyrtzidis | 321f278 | 2008-04-12 01:50:47 +0000 | [diff] [blame] | 24 | /// It manages the shadowing chains of identifiers and implements efficent decl |
Chris Lattner | a2f42b1 | 2008-04-11 07:06:57 +0000 | [diff] [blame] | 25 | /// lookup based on an identifier. |
| 26 | class IdentifierResolver { |
| 27 | public: |
| 28 | IdentifierResolver(); |
| 29 | ~IdentifierResolver(); |
| 30 | |
Argyrios Kyrtzidis | 321f278 | 2008-04-12 01:50:47 +0000 | [diff] [blame] | 31 | /// AddDecl - Link the decl to its shadowed decl chain. |
Chris Lattner | a2f42b1 | 2008-04-11 07:06:57 +0000 | [diff] [blame] | 32 | void AddDecl(NamedDecl *D, Scope *S); |
| 33 | |
Argyrios Kyrtzidis | 321f278 | 2008-04-12 01:50:47 +0000 | [diff] [blame] | 34 | /// AddGlobalDecl - Link the decl at the top of the shadowed decl chain. |
Chris Lattner | a2f42b1 | 2008-04-11 07:06:57 +0000 | [diff] [blame] | 35 | void AddGlobalDecl(NamedDecl *D); |
| 36 | |
Argyrios Kyrtzidis | 321f278 | 2008-04-12 01:50:47 +0000 | [diff] [blame] | 37 | /// RemoveDecl - Unlink the decl from its shadowed decl chain. |
Chris Lattner | a2f42b1 | 2008-04-11 07:06:57 +0000 | [diff] [blame] | 38 | /// The decl must already be part of the decl chain. |
| 39 | void RemoveDecl(NamedDecl *D); |
| 40 | |
Douglas Gregor | 2ce52f3 | 2008-04-13 21:07:44 +0000 | [diff] [blame] | 41 | /// Lookup - Find the non-shadowed decl that belongs to one or more |
| 42 | /// of the specified Decl::IdentifierNamespaces. |
Chris Lattner | a2f42b1 | 2008-04-11 07:06:57 +0000 | [diff] [blame] | 43 | NamedDecl *Lookup(const IdentifierInfo *II, unsigned NSI); |
| 44 | |
| 45 | private: |
Argyrios Kyrtzidis | 7bc198f | 2008-04-14 00:09:21 +0000 | [diff] [blame] | 46 | // An instance of IdDeclInfoMap class, that's hidden away in the |
| 47 | // implementation file. |
| 48 | void *IdDeclInfos; |
Chris Lattner | a2f42b1 | 2008-04-11 07:06:57 +0000 | [diff] [blame] | 49 | }; |
| 50 | |
| 51 | } // end namespace clang |
| 52 | |
| 53 | #endif |