diff options
| author | Sean Callanan <scallanan@apple.com> | 2010-09-17 02:58:26 +0000 |
|---|---|---|
| committer | Sean Callanan <scallanan@apple.com> | 2010-09-17 02:58:26 +0000 |
| commit | 61da09bbc8c08ce49b0685a8b9061bdbe44873c2 (patch) | |
| tree | 6fc78b59d019a051a2f7fa7293743a5ad450c218 | |
| parent | 7eba1bf0b7115df05beb54069d7542848991d029 (diff) | |
| download | bcm5719-llvm-61da09bbc8c08ce49b0685a8b9061bdbe44873c2.tar.gz bcm5719-llvm-61da09bbc8c08ce49b0685a8b9061bdbe44873c2.zip | |
Re-committed AddMethodToCXXRecordType, now that
the bug I introduced to ClangASTContext is
resolved.
llvm-svn: 114157
| -rw-r--r-- | lldb/include/lldb/Symbol/ClangASTContext.h | 18 | ||||
| -rw-r--r-- | lldb/source/Symbol/ClangASTContext.cpp | 51 |
2 files changed, 69 insertions, 0 deletions
diff --git a/lldb/include/lldb/Symbol/ClangASTContext.h b/lldb/include/lldb/Symbol/ClangASTContext.h index 4503d475417..8c4540c2ce1 100644 --- a/lldb/include/lldb/Symbol/ClangASTContext.h +++ b/lldb/include/lldb/Symbol/ClangASTContext.h @@ -182,6 +182,24 @@ public: bitfield_bit_size); } + 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(getASTContext(), + record_clang_type, + name, + method_type); + } + bool FieldIsBitfield (clang::FieldDecl* field, uint32_t& bitfield_bit_size); diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index 7a868ecd9b0..39cfbccfe65 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -804,6 +804,57 @@ ClangASTContext::CreateRecordType (const char *name, int kind, DeclContext *decl } 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 ( clang::ASTContext *ast_context, |

