[Lldb-commits] [lldb] r143469 - in /lldb/trunk: include/lldb/Symbol/ClangASTContext.h source/Expression/ClangExpressionDeclMap.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Symbol/ClangASTContext.cpp
Sean Callanan
scallanan at apple.com
Tue Nov 1 11:07:13 PDT 2011
Author: spyffe
Date: Tue Nov 1 13:07:13 2011
New Revision: 143469
URL: http://llvm.org/viewvc/llvm-project?rev=143469&view=rev
Log:
Added the capability (turned off for now) to mark a
method as __attribute__ ((used)) when adding it to a
class. This functionality is useful when stopped in
anonymous namespaces: expressions attached to classes
in anonymous namespaces are typically elided by Clang's
CodeGen because they have no namespaces are intended
not to be externally visible. __attribute__ ((used))
forces CodeGen to emit the function.
Right now, __attribute__ ((used)) causes the JIT not to
emit the function, so we're not enabling it until we
fix that.
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
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=143469&r1=143468&r2=143469&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Tue Nov 1 13:07:13 2011
@@ -279,7 +279,8 @@
bool is_virtual,
bool is_static,
bool is_inline,
- bool is_explicit);
+ bool is_explicit,
+ bool is_attr_used);
clang::CXXMethodDecl *
AddMethodToCXXRecordType (lldb::clang_type_t record_opaque_type,
@@ -289,7 +290,8 @@
bool is_virtual,
bool is_static,
bool is_inline,
- bool is_explicit)
+ bool is_explicit,
+ bool is_attr_used)
{
return ClangASTContext::AddMethodToCXXRecordType (getASTContext(),
@@ -300,7 +302,8 @@
is_virtual,
is_static,
is_inline,
- is_explicit);
+ is_explicit,
+ is_attr_used);
}
class TemplateParameterInfos
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=143469&r1=143468&r2=143469&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Tue Nov 1 13:07:13 2011
@@ -3005,17 +3005,18 @@
args[0] = ClangASTContext::GetVoidPtrType(parser_ast_context, false);
- void *method_type = ClangASTContext::CreateFunctionType (parser_ast_context,
- ClangASTContext::GetBuiltInType_void(parser_ast_context),
- args,
- 1,
- false,
- ClangASTContext::GetTypeQualifiers(copied_type));
-
+ clang_type_t method_type = ClangASTContext::CreateFunctionType (parser_ast_context,
+ ClangASTContext::GetBuiltInType_void(parser_ast_context),
+ args,
+ 1,
+ false,
+ ClangASTContext::GetTypeQualifiers(copied_type));
+
const bool is_virtual = false;
const bool is_static = false;
const bool is_inline = false;
const bool is_explicit = false;
+ const bool is_attr_used = false;
ClangASTContext::AddMethodToCXXRecordType (parser_ast_context,
copied_type,
@@ -3025,7 +3026,8 @@
is_virtual,
is_static,
is_inline,
- is_explicit);
+ is_explicit,
+ is_attr_used);
}
context.AddTypeDecl(copied_type);
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=143469&r1=143468&r2=143469&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Nov 1 13:07:13 2011
@@ -4570,6 +4570,8 @@
m_obj_file->GetFileSpec().GetDirectory().GetCString(),
m_obj_file->GetFileSpec().GetFilename().GetCString());
+ const bool is_attr_used = false;
+
cxx_method_decl = ast.AddMethodToCXXRecordType (class_opaque_type,
type_name_cstr,
clang_type,
@@ -4577,7 +4579,8 @@
is_virtual,
is_static,
is_inline,
- is_explicit);
+ is_explicit,
+ is_attr_used);
LinkDeclContextToDIE(ClangASTContext::GetAsDeclContext(cxx_method_decl), die);
type_handled = cxx_method_decl != NULL;
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=143469&r1=143468&r2=143469&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Tue Nov 1 13:07:13 2011
@@ -1574,7 +1574,8 @@
bool is_virtual,
bool is_static,
bool is_inline,
- bool is_explicit
+ bool is_explicit,
+ bool is_attr_used
)
{
if (!record_opaque_type || !method_opaque_type || !name)
@@ -1701,6 +1702,9 @@
cxx_method_decl->setAccess (access_specifier);
cxx_method_decl->setVirtualAsWritten (is_virtual);
+ if (is_attr_used)
+ cxx_method_decl->addAttr(::new (*ast) UsedAttr(SourceRange(), *ast));
+
// Populate the method decl with parameter decls
llvm::SmallVector<ParmVarDecl *, 12> params;
More information about the lldb-commits
mailing list