2013-08-23 13:46:38 -04:00
|
|
|
//===-- ClangExternalASTSourceCallbacks.cpp ---------------------*- C++ -*-===//
|
|
|
|
|
//
|
2019-08-20 16:51:52 -04:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2013-08-23 13:46:38 -04:00
|
|
|
//
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
|
|
#include "lldb/Symbol/ClangExternalASTSourceCallbacks.h"
|
2020-01-17 15:45:01 -05:00
|
|
|
#include "lldb/Symbol/ClangASTContext.h"
|
2013-08-23 13:46:38 -04:00
|
|
|
|
2015-12-30 06:55:28 -05:00
|
|
|
#include "clang/AST/Decl.h"
|
2013-08-23 13:46:38 -04:00
|
|
|
|
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
2020-01-17 15:45:01 -05:00
|
|
|
void ClangExternalASTSourceCallbacks::CompleteType(clang::TagDecl *tag_decl) {
|
|
|
|
|
m_ast.CompleteTagDecl(tag_decl);
|
2013-08-23 13:46:38 -04:00
|
|
|
}
|
|
|
|
|
|
2017-01-02 14:26:05 -05:00
|
|
|
void ClangExternalASTSourceCallbacks::CompleteType(
|
2020-01-17 15:45:01 -05:00
|
|
|
clang::ObjCInterfaceDecl *objc_decl) {
|
|
|
|
|
m_ast.CompleteObjCInterfaceDecl(objc_decl);
|
2013-08-23 13:46:38 -04:00
|
|
|
}
|
|
|
|
|
|
2017-01-02 14:26:05 -05:00
|
|
|
bool ClangExternalASTSourceCallbacks::layoutRecordType(
|
2015-07-03 12:57:06 -04:00
|
|
|
const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
|
|
|
|
|
llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
|
|
|
|
|
llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets,
|
2017-01-02 14:26:05 -05:00
|
|
|
llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
|
|
|
|
|
&VirtualBaseOffsets) {
|
2020-01-17 15:45:01 -05:00
|
|
|
return m_ast.LayoutRecordType(Record, Size, Alignment, FieldOffsets,
|
|
|
|
|
BaseOffsets, VirtualBaseOffsets);
|
2013-08-23 13:46:38 -04:00
|
|
|
}
|
|
|
|
|
|
2017-01-02 14:26:05 -05:00
|
|
|
void ClangExternalASTSourceCallbacks::FindExternalLexicalDecls(
|
|
|
|
|
const clang::DeclContext *decl_ctx,
|
|
|
|
|
llvm::function_ref<bool(clang::Decl::Kind)> IsKindWeWant,
|
|
|
|
|
llvm::SmallVectorImpl<clang::Decl *> &decls) {
|
2020-01-17 15:45:01 -05:00
|
|
|
if (decl_ctx) {
|
2017-01-02 14:26:05 -05:00
|
|
|
clang::TagDecl *tag_decl = llvm::dyn_cast<clang::TagDecl>(
|
|
|
|
|
const_cast<clang::DeclContext *>(decl_ctx));
|
|
|
|
|
if (tag_decl)
|
|
|
|
|
CompleteType(tag_decl);
|
|
|
|
|
}
|
2015-12-30 06:55:28 -05:00
|
|
|
}
|