forked from OSchip/llvm-project
Added AddMethodToCXXRecordType. This is not yet
tested, but I'm committing because it's not used anywhere and I want to avoid conflicts. llvm-svn: 114123
This commit is contained in:
parent
ee74402fe6
commit
e44f1fbb4b
|
@ -93,7 +93,13 @@ public:
|
|||
uint32_t bit_size);
|
||||
|
||||
void *
|
||||
GetBuiltInType_void();
|
||||
GetBuiltInType_void(clang::ASTContext *ast_context);
|
||||
|
||||
void *
|
||||
GetBuiltInType_void()
|
||||
{
|
||||
return ClangASTContext::GetBuiltInType_void(m_ast_context_ap.get());
|
||||
}
|
||||
|
||||
void *
|
||||
GetBuiltInType_objc_id();
|
||||
|
@ -153,6 +159,23 @@ public:
|
|||
clang::DeclContext *decl_ctx,
|
||||
lldb::LanguageType language);
|
||||
|
||||
static bool
|
||||
AddMethodToCXXRecordType(clang::ASTContext *ast_context,
|
||||
void *record_clang_type,
|
||||
const char *name,
|
||||
void *method_type);
|
||||
|
||||
bool
|
||||
AddMethodToCXXRecordType(void *record_clang_type,
|
||||
const char *name,
|
||||
void *method_type)
|
||||
{
|
||||
return ClangASTContext::AddMethodToCXXRecordType(ast_context,
|
||||
record_clang_type,
|
||||
name,
|
||||
method_type);
|
||||
}
|
||||
|
||||
static bool
|
||||
AddFieldToRecordType (clang::ASTContext *ast_context,
|
||||
void *record_qual_type,
|
||||
|
|
|
@ -658,9 +658,9 @@ ClangASTContext::GetBuiltinTypeForDWARFEncodingAndBitSize (const char *type_name
|
|||
}
|
||||
|
||||
void *
|
||||
ClangASTContext::GetBuiltInType_void()
|
||||
ClangASTContext::GetBuiltInType_void(clang::ASTContext *ast_context)
|
||||
{
|
||||
return getASTContext()->VoidTy.getAsOpaquePtr();
|
||||
return ast_context->VoidTy.getAsOpaquePtr();
|
||||
}
|
||||
|
||||
void *
|
||||
|
@ -803,6 +803,57 @@ ClangASTContext::CreateRecordType (const char *name, int kind, DeclContext *decl
|
|||
return ast_context->getTagDeclType(decl).getAsOpaquePtr();
|
||||
}
|
||||
|
||||
bool
|
||||
ClangASTContext::AddMethodToCXXRecordType
|
||||
(
|
||||
clang::ASTContext *ast_context,
|
||||
void *record_clang_type,
|
||||
const char *name,
|
||||
void *method_type
|
||||
)
|
||||
{
|
||||
if (!record_clang_type || !method_type || !name)
|
||||
return false;
|
||||
|
||||
assert(ast_context);
|
||||
|
||||
IdentifierTable *identifier_table = &ast_context->Idents;
|
||||
|
||||
assert(identifier_table);
|
||||
|
||||
QualType record_qual_type(QualType::getFromOpaquePtr(record_clang_type));
|
||||
clang::Type *record_type(record_qual_type.getTypePtr());
|
||||
|
||||
if (!record_type)
|
||||
return false;
|
||||
|
||||
RecordType *record_recty(dyn_cast<RecordType>(record_type));
|
||||
|
||||
if (!record_recty)
|
||||
return false;
|
||||
|
||||
RecordDecl *record_decl = record_recty->getDecl();
|
||||
|
||||
if (!record_decl)
|
||||
return false;
|
||||
|
||||
CXXRecordDecl *cxx_record_decl = dyn_cast<CXXRecordDecl>(record_decl);
|
||||
|
||||
if (!cxx_record_decl)
|
||||
return false;
|
||||
|
||||
CXXMethodDecl *cxx_method_decl = CXXMethodDecl::Create(*ast_context,
|
||||
cxx_record_decl,
|
||||
SourceLocation(),
|
||||
DeclarationName(&identifier_table->get(name)),
|
||||
QualType::getFromOpaquePtr(method_type),
|
||||
NULL);
|
||||
|
||||
cxx_record_decl->addDecl(cxx_method_decl);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ClangASTContext::AddFieldToRecordType
|
||||
(
|
||||
|
|
Loading…
Reference in New Issue