PDBASTParser.h revision 344779
156722Sshin//===-- PDBASTParser.h ------------------------------------------*- C++ -*-===//
256722Sshin//
356722Sshin//                     The LLVM Compiler Infrastructure
456722Sshin//
556722Sshin// This file is distributed under the University of Illinois Open Source
656722Sshin// License. See LICENSE.TXT for details.
756722Sshin//
856722Sshin//===----------------------------------------------------------------------===//
956722Sshin
1056722Sshin#ifndef LLDB_PLUGINS_SYMBOLFILE_PDB_PDBASTPARSER_H
1156722Sshin#define LLDB_PLUGINS_SYMBOLFILE_PDB_PDBASTPARSER_H
1256722Sshin
1356722Sshin#include "lldb/lldb-forward.h"
1456722Sshin
1556722Sshin#include "lldb/Symbol/ClangASTImporter.h"
1656722Sshin
1756722Sshinclass SymbolFilePDB;
1856722Sshin
1956722Sshinnamespace clang {
2056722Sshinclass CharUnits;
2156722Sshinclass CXXRecordDecl;
2256722Sshinclass FieldDecl;
2356722Sshinclass RecordDecl;
2456722Sshin} // namespace clang
2556722Sshin
2656722Sshinnamespace lldb_private {
2756722Sshinclass ClangASTContext;
2856722Sshinclass CompilerType;
2956722Sshin} // namespace lldb_private
3056722Sshin
3156722Sshinnamespace llvm {
3256722Sshinnamespace pdb {
3356722Sshintemplate <typename ChildType> class ConcreteSymbolEnumerator;
3456722Sshin
3556722Sshinclass PDBSymbol;
3656722Sshinclass PDBSymbolData;
3756722Sshinclass PDBSymbolFunc;
3856722Sshinclass PDBSymbolTypeBaseClass;
3956722Sshinclass PDBSymbolTypeBuiltin;
4056722Sshinclass PDBSymbolTypeUDT;
4156722Sshin} // namespace pdb
4256722Sshin} // namespace llvm
4356722Sshin
4456722Sshinclass PDBASTParser {
4556722Sshinpublic:
4656722Sshin  PDBASTParser(lldb_private::ClangASTContext &ast);
4756722Sshin  ~PDBASTParser();
4856722Sshin
4956722Sshin  lldb::TypeSP CreateLLDBTypeFromPDBType(const llvm::pdb::PDBSymbol &type);
5056722Sshin  bool CompleteTypeFromPDB(lldb_private::CompilerType &compiler_type);
5156722Sshin
5256722Sshin  clang::Decl *GetDeclForSymbol(const llvm::pdb::PDBSymbol &symbol);
5356722Sshin
5456722Sshin  clang::DeclContext *
5556722Sshin  GetDeclContextForSymbol(const llvm::pdb::PDBSymbol &symbol);
5656722Sshin  clang::DeclContext *
5756722Sshin  GetDeclContextContainingSymbol(const llvm::pdb::PDBSymbol &symbol);
5856722Sshin
5956722Sshin  void ParseDeclsForDeclContext(const clang::DeclContext *decl_context);
6056722Sshin
6156722Sshin  clang::NamespaceDecl *FindNamespaceDecl(const clang::DeclContext *parent,
6256722Sshin                                          llvm::StringRef name);
6356722Sshin
6456722Sshin  lldb_private::ClangASTImporter &GetClangASTImporter() {
6556722Sshin    return m_ast_importer;
6656722Sshin  }
6756722Sshin
6856722Sshinprivate:
6956722Sshin  typedef llvm::DenseMap<clang::CXXRecordDecl *, lldb::user_id_t>
7064342Sume      CXXRecordDeclToUidMap;
7156722Sshin  typedef llvm::DenseMap<lldb::user_id_t, clang::Decl *> UidToDeclMap;
7256722Sshin  typedef std::set<clang::NamespaceDecl *> NamespacesSet;
7356722Sshin  typedef llvm::DenseMap<clang::DeclContext *, NamespacesSet>
7456722Sshin      ParentToNamespacesMap;
7556722Sshin  typedef llvm::DenseMap<clang::DeclContext *, lldb::user_id_t>
7656722Sshin      DeclContextToUidMap;
7756722Sshin  typedef llvm::pdb::ConcreteSymbolEnumerator<llvm::pdb::PDBSymbolData>
7856722Sshin      PDBDataSymbolEnumerator;
7978064Sume  typedef llvm::pdb::ConcreteSymbolEnumerator<llvm::pdb::PDBSymbolTypeBaseClass>
8056722Sshin      PDBBaseClassSymbolEnumerator;
8156722Sshin  typedef llvm::pdb::ConcreteSymbolEnumerator<llvm::pdb::PDBSymbolFunc>
8256722Sshin      PDBFuncSymbolEnumerator;
8356722Sshin
8456722Sshin  bool AddEnumValue(lldb_private::CompilerType enum_type,
8556722Sshin                    const llvm::pdb::PDBSymbolData &data);
8656722Sshin  bool CompleteTypeFromUDT(lldb_private::SymbolFile &symbol_file,
8756722Sshin                           lldb_private::CompilerType &compiler_type,
8856722Sshin                           llvm::pdb::PDBSymbolTypeUDT &udt);
8956722Sshin  void
9056722Sshin  AddRecordMembers(lldb_private::SymbolFile &symbol_file,
9178238Sassar                   lldb_private::CompilerType &record_type,
9278238Sassar                   PDBDataSymbolEnumerator &members_enum,
9356722Sshin                   lldb_private::ClangASTImporter::LayoutInfo &layout_info);
9456722Sshin  void
9556722Sshin  AddRecordBases(lldb_private::SymbolFile &symbol_file,
9656722Sshin                 lldb_private::CompilerType &record_type, int record_kind,
9756722Sshin                 PDBBaseClassSymbolEnumerator &bases_enum,
9856722Sshin                 lldb_private::ClangASTImporter::LayoutInfo &layout_info) const;
9956722Sshin  void AddRecordMethods(lldb_private::SymbolFile &symbol_file,
10056722Sshin                        lldb_private::CompilerType &record_type,
10156722Sshin                        PDBFuncSymbolEnumerator &methods_enum);
10256722Sshin  clang::CXXMethodDecl *
10356722Sshin  AddRecordMethod(lldb_private::SymbolFile &symbol_file,
10456722Sshin                  lldb_private::CompilerType &record_type,
10556722Sshin                  const llvm::pdb::PDBSymbolFunc &method) const;
10656722Sshin
10756722Sshin  lldb_private::ClangASTContext &m_ast;
10878238Sassar  lldb_private::ClangASTImporter m_ast_importer;
10956722Sshin
11056722Sshin  CXXRecordDeclToUidMap m_forward_decl_to_uid;
11156722Sshin  UidToDeclMap m_uid_to_decl;
11256722Sshin  ParentToNamespacesMap m_parent_to_namespaces;
11356722Sshin  NamespacesSet m_namespaces;
11475552Sjesper  DeclContextToUidMap m_decl_context_to_uid;
11556722Sshin};
11656722Sshin
11756722Sshin#endif // LLDB_PLUGINS_SYMBOLFILE_PDB_PDBASTPARSER_H
11878238Sassar