Fixed some warnings after enabling some stricter warnings in the Xcode project

settings.

Also fixed an issue where we weren't creating anonymous namepaces correctly:
<rdar://problem/10371295>

llvm-svn: 143403
This commit is contained in:
Greg Clayton 2011-10-31 23:51:19 +00:00
parent 549f737453
commit 9d3d6886e6
7 changed files with 107 additions and 30 deletions

View File

@ -3592,7 +3592,7 @@
LLDB_CONFIGURATION_DEBUG,
);
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = NO;
@ -3600,6 +3600,8 @@
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
GCC_WARN_MISSING_PARENTHESES = YES;
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VALUE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
LLVM_BUILD_DIR = "$(SRCROOT)/llvm";
@ -3628,7 +3630,7 @@
LLDB_CONFIGURATION_RELEASE,
);
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = NO;
@ -3636,6 +3638,8 @@
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
GCC_WARN_MISSING_PARENTHESES = YES;
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VALUE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
LLVM_BUILD_DIR = "$(SRCROOT)/llvm";
@ -3913,7 +3917,7 @@
LLDB_CONFIGURATION_BUILD_AND_INTEGRATION,
);
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = NO;
@ -3921,6 +3925,8 @@
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
GCC_WARN_MISSING_PARENTHESES = YES;
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VALUE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
LLVM_BUILD_DIR = "$(OBJROOT)/llvm";

View File

@ -375,11 +375,9 @@ Options::SupportsLongOption (const char *long_option)
const OptionDefinition *opt_defs = GetDefinitions ();
if (opt_defs)
{
const char *long_option_name;
const char *long_option_name = long_option;
if (long_option[0] == '-' && long_option[1] == '-')
long_option_name += 2;
else
long_option_name = long_option;
for (uint32_t i = 0; opt_defs[i].long_option; ++i)
{

View File

@ -13185,11 +13185,11 @@ EmulateInstructionARM::SelectInstrSet (Mode arm_or_thumb)
{
default:
return false;
eModeARM:
case eModeARM:
// Clear the T bit.
m_new_inst_cpsr &= ~MASK_CPSR_T;
break;
eModeThumb:
case eModeThumb:
// Set the T bit.
m_new_inst_cpsr |= MASK_CPSR_T;
break;

View File

@ -1012,7 +1012,17 @@ SymbolFileDWARF::ParseCompileUnitLineTable (const SymbolContext &sc)
std::auto_ptr<LineTable> line_table_ap(new LineTable(sc.comp_unit));
if (line_table_ap.get())
{
ParseDWARFLineTableCallbackInfo info = { line_table_ap.get(), m_obj_file->GetSectionList(), 0, 0, m_debug_map_symfile != NULL, false};
ParseDWARFLineTableCallbackInfo info = {
line_table_ap.get(),
m_obj_file->GetSectionList(),
0,
0,
m_debug_map_symfile != NULL,
false,
DWARFDebugLine::Row(),
SectionSP(),
SectionSP()
};
uint32_t offset = cu_line_offset;
DWARFDebugLine::ParseStatementTable(get_debug_line_data(), &offset, ParseDWARFLineTableCallback, &info);
sc.comp_unit->SetLineTable(line_table_ap.release());
@ -3516,14 +3526,14 @@ SymbolFileDWARF::ResolveNamespaceDIE (DWARFCompileUnit *curr_cu, const DWARFDebu
else
{
const char *namespace_name = die->GetAttributeValueAsString(this, curr_cu, DW_AT_name, NULL);
if (namespace_name)
clang::DeclContext *containing_decl_ctx = GetClangDeclContextContainingDIE (curr_cu, die, NULL);
namespace_decl = GetClangASTContext().GetUniqueNamespaceDeclaration (namespace_name, containing_decl_ctx);
LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
if (log)
{
clang::DeclContext *containing_decl_ctx = GetClangDeclContextContainingDIE (curr_cu, die, NULL);
namespace_decl = GetClangASTContext().GetUniqueNamespaceDeclaration (namespace_name, containing_decl_ctx);
LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
if (log)
const char *object_name = m_obj_file->GetModule()->GetObjectName().GetCString();
if (namespace_name)
{
const char *object_name = m_obj_file->GetModule()->GetObjectName().GetCString();
log->Printf ("ASTContext => %p: 0x%8.8llx: DW_TAG_namespace with DW_AT_name(\"%s\") => clang::NamespaceDecl * %p in %s/%s%s%s%s (original = %p)",
GetClangASTContext().getASTContext(),
MakeUserID(die->GetOffset()),
@ -3536,11 +3546,24 @@ SymbolFileDWARF::ResolveNamespaceDIE (DWARFCompileUnit *curr_cu, const DWARFDebu
object_name ? "(" : "",
namespace_decl->getOriginalNamespace());
}
if (namespace_decl)
LinkDeclContextToDIE((clang::DeclContext*)namespace_decl, die);
return namespace_decl;
else
{
log->Printf ("ASTContext => %p: 0x%8.8llx: DW_TAG_namespace (anonymous) => clang::NamespaceDecl * %p in %s/%s%s%s%s (original = %p)",
GetClangASTContext().getASTContext(),
MakeUserID(die->GetOffset()),
namespace_decl,
m_obj_file->GetFileSpec().GetDirectory().GetCString(),
m_obj_file->GetFileSpec().GetFilename().GetCString(),
object_name ? "(" : "",
object_name ? object_name : "",
object_name ? "(" : "",
namespace_decl->getOriginalNamespace());
}
}
if (namespace_decl)
LinkDeclContextToDIE((clang::DeclContext*)namespace_decl, die);
return namespace_decl;
}
}
return NULL;

View File

@ -4299,12 +4299,13 @@ NamespaceDecl *
ClangASTContext::GetUniqueNamespaceDeclaration (const char *name, DeclContext *decl_ctx)
{
NamespaceDecl *namespace_decl = NULL;
ASTContext *ast = getASTContext();
TranslationUnitDecl *translation_unit_decl = ast->getTranslationUnitDecl ();
if (decl_ctx == NULL)
decl_ctx = translation_unit_decl;
if (name)
{
ASTContext *ast = getASTContext();
if (decl_ctx == NULL)
decl_ctx = ast->getTranslationUnitDecl();
IdentifierInfo &identifier_info = ast->Idents.get(name);
DeclarationName decl_name (&identifier_info);
clang::DeclContext::lookup_result result = decl_ctx->lookup(decl_name);
@ -4317,12 +4318,61 @@ ClangASTContext::GetUniqueNamespaceDeclaration (const char *name, DeclContext *d
namespace_decl = NamespaceDecl::Create(*ast, decl_ctx, SourceLocation(), SourceLocation(), &identifier_info);
decl_ctx->addDecl (namespace_decl);
#ifdef LLDB_CONFIGURATION_DEBUG
VerifyDecl(namespace_decl);
#endif
decl_ctx->addDecl (namespace_decl);
}
else
{
if (decl_ctx == translation_unit_decl)
{
namespace_decl = translation_unit_decl->getAnonymousNamespace();
if (namespace_decl)
return namespace_decl;
namespace_decl = NamespaceDecl::Create(*ast, decl_ctx, SourceLocation(), SourceLocation(), NULL);
translation_unit_decl->setAnonymousNamespace (namespace_decl);
translation_unit_decl->addDecl (namespace_decl);
assert (namespace_decl == translation_unit_decl->getAnonymousNamespace());
}
else
{
NamespaceDecl *parent_namespace_decl = cast<NamespaceDecl>(decl_ctx);
if (parent_namespace_decl)
{
namespace_decl = parent_namespace_decl->getAnonymousNamespace();
if (namespace_decl)
return namespace_decl;
namespace_decl = NamespaceDecl::Create(*ast, decl_ctx, SourceLocation(), SourceLocation(), NULL);
parent_namespace_decl->setAnonymousNamespace (namespace_decl);
parent_namespace_decl->addDecl (namespace_decl);
assert (namespace_decl == parent_namespace_decl->getAnonymousNamespace());
}
else
{
// BAD!!!
}
}
if (namespace_decl)
{
// If we make it here, we are creating the anonymous namespace decl
// for the first time, so we need to do the using directive magic
// like SEMA does
UsingDirectiveDecl* using_directive_decl = UsingDirectiveDecl::Create (*ast,
decl_ctx,
SourceLocation(),
SourceLocation(),
NestedNameSpecifierLoc(),
SourceLocation(),
namespace_decl,
decl_ctx);
using_directive_decl->setImplicit();
decl_ctx->addDecl(using_directive_decl);
}
}
#ifdef LLDB_CONFIGURATION_DEBUG
VerifyDecl(namespace_decl);
#endif
return namespace_decl;
}

View File

@ -178,7 +178,7 @@ int main (int argc, char *const *argv, char *const *envp, const char **apple)
cpu_type_t cpu_type = 0;
bool show_usage = false;
char ch;
int ch;
int disable_aslr = 0; // By default we disable ASLR
int pass_env = 1;
std::string unix_socket_name;

View File

@ -73,7 +73,7 @@ main (int argc, char *argv[])
Args log_args;
Error error;
std::string listen_host_port;
char ch;
int ch;
Debugger::Initialize();
// ConnectionMachPort a;