ClangExternalASTSourceCallbacks.cpp [plain text]
#include "lldb/Symbol/ClangExternalASTSourceCallbacks.h"
#if !defined(NDEBUG) && !defined(LLVM_NDEBUG_OFF)
#define LLDB_DEFINED_NDEBUG_FOR_CLANG
#define NDEBUG
#include <assert.h>
#endif
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclarationName.h"
#ifdef LLDB_DEFINED_NDEBUG_FOR_CLANG
#undef NDEBUG
#undef LLDB_DEFINED_NDEBUG_FOR_CLANG
#include <assert.h>
#endif
#include "lldb/Core/Log.h"
using namespace clang;
using namespace lldb_private;
bool
ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName
(
const clang::DeclContext *decl_ctx,
clang::DeclarationName clang_decl_name
)
{
if (m_callback_find_by_name)
{
llvm::SmallVector <clang::NamedDecl *, 3> results;
m_callback_find_by_name (m_callback_baton, decl_ctx, clang_decl_name, &results);
SetExternalVisibleDeclsForName(decl_ctx, clang_decl_name, results);
return (results.size() != 0);
}
std::string decl_name (clang_decl_name.getAsString());
switch (clang_decl_name.getNameKind()) {
case clang::DeclarationName::Identifier:
if (clang_decl_name.getAsIdentifierInfo()->getBuiltinID() != 0)
{
SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
return false;
}
break;
case clang::DeclarationName::ObjCZeroArgSelector:
SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
return false;
case clang::DeclarationName::ObjCOneArgSelector:
SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
return false;
case clang::DeclarationName::ObjCMultiArgSelector:
SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
return false;
case clang::DeclarationName::CXXConstructorName:
SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
return false;
case clang::DeclarationName::CXXDestructorName:
SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
return false;
case clang::DeclarationName::CXXConversionFunctionName:
SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
return false;
case clang::DeclarationName::CXXOperatorName:
SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
return false;
case clang::DeclarationName::CXXLiteralOperatorName:
SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
return false;
case clang::DeclarationName::CXXUsingDirective:
SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
return false;
}
SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
return false;
}
void
ClangExternalASTSourceCallbacks::CompleteType (TagDecl *tag_decl)
{
if (m_callback_tag_decl)
m_callback_tag_decl (m_callback_baton, tag_decl);
}
void
ClangExternalASTSourceCallbacks::CompleteType (ObjCInterfaceDecl *objc_decl)
{
if (m_callback_objc_decl)
m_callback_objc_decl (m_callback_baton, objc_decl);
}
bool
ClangExternalASTSourceCallbacks::layoutRecordType(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,
llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets)
{
if (m_callback_layout_record_type)
return m_callback_layout_record_type(m_callback_baton,
Record,
Size,
Alignment,
FieldOffsets,
BaseOffsets,
VirtualBaseOffsets);
return false;
}