[Lldb-commits] [lldb] r142011 - in /lldb/trunk: include/lldb/Symbol/ClangASTContext.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Symbol/ClangASTContext.cpp
Greg Clayton
gclayton at apple.com
Fri Oct 14 15:47:18 PDT 2011
Author: gclayton
Date: Fri Oct 14 17:47:18 2011
New Revision: 142011
URL: http://llvm.org/viewvc/llvm-project?rev=142011&view=rev
Log:
Add function decls to their parent decl context.
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp
Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=142011&r1=142010&r2=142011&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Fri Oct 14 17:47:18 2011
@@ -547,7 +547,8 @@
//------------------------------------------------------------------
clang::FunctionDecl *
- CreateFunctionDeclaration (const char *name,
+ CreateFunctionDeclaration (clang::DeclContext *decl_ctx,
+ const char *name,
lldb::clang_type_t function_Type,
int storage,
bool is_inline);
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=142011&r1=142010&r2=142011&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Oct 14 17:47:18 2011
@@ -4368,7 +4368,8 @@
if (!type_handled)
{
// We just have a function that isn't part of a class
- clang::FunctionDecl *function_decl = ast.CreateFunctionDeclaration (type_name_cstr,
+ clang::FunctionDecl *function_decl = ast.CreateFunctionDeclaration (containing_decl_ctx,
+ type_name_cstr,
clang_type,
storage,
is_inline);
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=142011&r1=142010&r2=142011&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Oct 14 17:47:18 2011
@@ -4145,41 +4145,42 @@
#pragma mark Function Types
FunctionDecl *
-ClangASTContext::CreateFunctionDeclaration (const char *name, clang_type_t function_clang_type, int storage, bool is_inline)
+ClangASTContext::CreateFunctionDeclaration (DeclContext *decl_ctx, const char *name, clang_type_t function_clang_type, int storage, bool is_inline)
{
- if (name)
- {
- ASTContext *ast = getASTContext();
- assert (ast != NULL);
+ FunctionDecl *func_decl = NULL;
+ ASTContext *ast = getASTContext();
+ if (decl_ctx == NULL)
+ decl_ctx = ast->getTranslationUnitDecl();
- if (name && name[0])
- {
- return FunctionDecl::Create(*ast,
- ast->getTranslationUnitDecl(),
- SourceLocation(),
- SourceLocation(),
- DeclarationName (&ast->Idents.get(name)),
- QualType::getFromOpaquePtr(function_clang_type),
- NULL,
- (FunctionDecl::StorageClass)storage,
- (FunctionDecl::StorageClass)storage,
- is_inline);
- }
- else
- {
- return FunctionDecl::Create(*ast,
- ast->getTranslationUnitDecl(),
- SourceLocation(),
- SourceLocation(),
- DeclarationName (),
- QualType::getFromOpaquePtr(function_clang_type),
- NULL,
- (FunctionDecl::StorageClass)storage,
- (FunctionDecl::StorageClass)storage,
- is_inline);
- }
+ if (name && name[0])
+ {
+ func_decl = FunctionDecl::Create (*ast,
+ decl_ctx,
+ SourceLocation(),
+ SourceLocation(),
+ DeclarationName (&ast->Idents.get(name)),
+ QualType::getFromOpaquePtr(function_clang_type),
+ NULL,
+ (FunctionDecl::StorageClass)storage,
+ (FunctionDecl::StorageClass)storage,
+ is_inline);
}
- return NULL;
+ else
+ {
+ func_decl = FunctionDecl::Create (*ast,
+ decl_ctx,
+ SourceLocation(),
+ SourceLocation(),
+ DeclarationName (),
+ QualType::getFromOpaquePtr(function_clang_type),
+ NULL,
+ (FunctionDecl::StorageClass)storage,
+ (FunctionDecl::StorageClass)storage,
+ is_inline);
+ }
+ if (func_decl)
+ decl_ctx->addDecl (func_decl);
+ return func_decl;
}
clang_type_t
@@ -4204,10 +4205,10 @@
proto_info.NumExceptions = 0;
proto_info.Exceptions = NULL;
- return ast->getFunctionType(QualType::getFromOpaquePtr(result_type),
- qual_type_args.empty() ? NULL : &qual_type_args.front(),
- qual_type_args.size(),
- proto_info).getAsOpaquePtr(); // NoReturn);
+ return ast->getFunctionType (QualType::getFromOpaquePtr(result_type),
+ qual_type_args.empty() ? NULL : &qual_type_args.front(),
+ qual_type_args.size(),
+ proto_info).getAsOpaquePtr(); // NoReturn);
}
ParmVarDecl *
@@ -5218,6 +5219,8 @@
name ? &identifier_table->get(name) : NULL, // Identifier
ast->CreateTypeSourceInfo(qual_type));
+ //decl_ctx->addDecl (decl);
+
decl->setAccess(AS_public); // TODO respect proper access specifier
// Get a uniqued QualType for the typedef decl type
More information about the lldb-commits
mailing list