blob: 8db4615df2c493abad5531daa4ceaf8ee4081c23 [file] [log] [blame]
Chris Lattnera2f42b12008-04-11 07:06:57 +00001//===- 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//
10// This file defines the IdentifierResolver class,which is used for lexical
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
18namespace clang {
19 class IdentifierInfo;
20 class NamedDecl;
21 class Scope;
22
23/// IdentifierResolver - Keeps track of shadowed decls on enclosing scopes.
24/// it manages the shadowing chains of identifiers and implements efficent decl
25/// lookup based on an identifier.
26class IdentifierResolver {
27public:
28 IdentifierResolver();
29 ~IdentifierResolver();
30
31 /// AddDecl - Link the decl to its shadowed decl chain
32 void AddDecl(NamedDecl *D, Scope *S);
33
34 /// AddGlobalDecl - Link the decl at the top of the shadowed decl chain
35 void AddGlobalDecl(NamedDecl *D);
36
37 /// RemoveDecl - Unlink the decl from its shadowed decl chain
38 /// The decl must already be part of the decl chain.
39 void RemoveDecl(NamedDecl *D);
40
41 /// Lookup - Find the non-shadowed decl that belongs to a particular
42 /// Decl::IdentifierNamespace.
43 NamedDecl *Lookup(const IdentifierInfo *II, unsigned NSI);
44
45private:
46 class IdDeclInfoMap;
47 IdDeclInfoMap &IdDeclInfos;
48};
49
50} // end namespace clang
51
52#endif