aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/IdentifierResolver.h
blob: 34b4764d147bc8c204abf681330d97f572d7223a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//===- IdentifierResolver.h - Lexical Scope Name lookup ---------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the IdentifierResolver class, which is used for lexical
// scoped lookup, based on identifier.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_AST_SEMA_IDENTIFIERRESOLVER_H
#define LLVM_CLANG_AST_SEMA_IDENTIFIERRESOLVER_H

namespace clang {
  class IdentifierInfo;
  class NamedDecl;
  class Scope;

/// IdentifierResolver - Keeps track of shadowed decls on enclosing scopes.
/// It manages the shadowing chains of identifiers and implements efficent decl
/// lookup based on an identifier.
class IdentifierResolver {
public:
  IdentifierResolver();
  ~IdentifierResolver();

  /// AddDecl - Link the decl to its shadowed decl chain.
  void AddDecl(NamedDecl *D, Scope *S);

  /// AddGlobalDecl - Link the decl at the top of the shadowed decl chain.
  void AddGlobalDecl(NamedDecl *D);

  /// RemoveDecl - Unlink the decl from its shadowed decl chain.
  /// The decl must already be part of the decl chain.
  void RemoveDecl(NamedDecl *D);

  /// Lookup - Find the non-shadowed decl that belongs to one or more
  /// of the specified Decl::IdentifierNamespaces.
  NamedDecl *Lookup(const IdentifierInfo *II, unsigned NSI);

private:
  // An instance of IdDeclInfoMap class, that's hidden away in the
  // implementation file.
  void *IdDeclInfos;
};

} // end namespace clang

#endif