diff options
author | Greg Clayton <gclayton@apple.com> | 2011-10-31 23:51:19 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2011-10-31 23:51:19 +0000 |
commit | 9d3d6886e6a6767434bc341a41df23ffc947606e (patch) | |
tree | f52a7be800507ec8e12fa7cf250a0297d828ce75 /lldb/source | |
parent | 549f737453d1de96c61df8146edcff48b9b20877 (diff) | |
download | bcm5719-llvm-9d3d6886e6a6767434bc341a41df23ffc947606e.tar.gz bcm5719-llvm-9d3d6886e6a6767434bc341a41df23ffc947606e.zip |
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
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/Interpreter/Options.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 45 | ||||
-rw-r--r-- | lldb/source/Symbol/ClangASTContext.cpp | 64 |
4 files changed, 94 insertions, 23 deletions
diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp index b795f233149..dbe65798be8 100644 --- a/lldb/source/Interpreter/Options.cpp +++ b/lldb/source/Interpreter/Options.cpp @@ -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) { diff --git a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp index f729dbb4adc..1633d44f889 100644 --- a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp +++ b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp @@ -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; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 1e2a57231a7..f61750a2759 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -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; diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index 444b8fdbf96..abc789f7506 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -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); + 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); + VerifyDecl(namespace_decl); #endif - } return namespace_decl; } |