diff options
author | Greg Clayton <gclayton@apple.com> | 2010-10-15 03:36:13 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2010-10-15 03:36:13 +0000 |
commit | ee4b5dd6645981f1f163ab977dceff4daf7cc953 (patch) | |
tree | 6ffa1722aeca0844afdf9a1be329047fc830e1f9 | |
parent | 59351844e1c5ee565c82ab4f6be1e10def2aa8ee (diff) | |
download | bcm5719-llvm-ee4b5dd6645981f1f163ab977dceff4daf7cc953.tar.gz bcm5719-llvm-ee4b5dd6645981f1f163ab977dceff4daf7cc953.zip |
Skip checking for a bunch of built-ins when evaluating an expression.
llvm-svn: 116565
-rw-r--r-- | lldb/source/Expression/ClangASTSource.cpp | 47 | ||||
-rw-r--r-- | lldb/source/Expression/ClangExpressionDeclMap.cpp | 2 |
2 files changed, 35 insertions, 14 deletions
diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp index 0808b4ccde5..ef2cd9fe60f 100644 --- a/lldb/source/Expression/ClangASTSource.cpp +++ b/lldb/source/Expression/ClangASTSource.cpp @@ -9,6 +9,7 @@ #include "clang/AST/ASTContext.h" +#include "lldb/Core/Log.h" #include "lldb/Expression/ClangASTSource.h" #include "lldb/Expression/ClangExpression.h" #include "lldb/Expression/ClangExpressionDeclMap.h" @@ -37,8 +38,13 @@ Selector ClangASTSource::GetExternalSelector(uint32_t) { return Selector(); } uint32_t ClangASTSource::GetNumExternalSelectors() { return 0; } // The core lookup interface. -DeclContext::lookup_result ClangASTSource::FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name) { - switch (Name.getNameKind()) { +DeclContext::lookup_result ClangASTSource::FindExternalVisibleDeclsByName +( + const DeclContext *decl_ctx, + DeclarationName decl_name +) +{ + switch (decl_name.getNameKind()) { // Normal identifiers. case DeclarationName::Identifier: break; @@ -51,7 +57,7 @@ DeclContext::lookup_result ClangASTSource::FindExternalVisibleDeclsByName(const // Using directives found in this context. // Tell Sema we didn't find any or we'll end up getting asked a *lot*. case DeclarationName::CXXUsingDirective: - return SetNoExternalVisibleDeclsForName(DC, Name); + return SetNoExternalVisibleDeclsForName(decl_ctx, decl_name); // These aren't looked up like this. case DeclarationName::ObjCZeroArgSelector: @@ -65,19 +71,34 @@ DeclContext::lookup_result ClangASTSource::FindExternalVisibleDeclsByName(const case DeclarationName::CXXConversionFunctionName: return DeclContext::lookup_result(); } + + + std::string name (decl_name.getAsString()); + if (0 == name.compare ("__va_list_tag") || + 0 == name.compare ("__int128_t") || + 0 == name.compare ("__uint128_t") || + 0 == name.compare ("SEL") || + 0 == name.compare ("id") || + 0 == name.compare ("Class") || + 0 == name.compare ("nil") || + 0 == name.compare ("gp_offset") || + 0 == name.compare ("fp_offset") || + 0 == name.compare ("overflow_arg_area") || + 0 == name.compare ("reg_save_area") || + 0 == name.find ("__builtin") ) + { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + if (log) + log->Printf("Ignoring built-in in find external declarations for name: '%s'", name.c_str()); + + return SetNoExternalVisibleDeclsForName(decl_ctx, decl_name); + } llvm::SmallVector<NamedDecl*, 4> Decls; - NameSearchContext NSC(*this, Decls, Name, DC); - - std::string name (Name.getAsString()); - // TODO: Figure out what to do here, after recent changes to the DWARF - // parser where more types are now in type by name index, we were sometimes - // finding our own version of a builtin? Skip it for now until we figure out - // how to get around this properly. - if (name.compare("__va_list_tag") != 0) - DeclMap.GetDecls(NSC, name.c_str()); - return SetExternalVisibleDeclsForName(DC, Name, Decls); + NameSearchContext NSC(*this, Decls, decl_name, decl_ctx); + DeclMap.GetDecls(NSC, name.c_str()); + return SetExternalVisibleDeclsForName(decl_ctx, decl_name, Decls); } void ClangASTSource::MaterializeVisibleDecls(const DeclContext *DC) diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp index b34004d58c3..f7a81d653d8 100644 --- a/lldb/source/Expression/ClangExpressionDeclMap.cpp +++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp @@ -907,7 +907,7 @@ ClangExpressionDeclMap::GetDecls(NameSearchContext &context, Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); if (log) - log->Printf("Hunting for a definition for %s", name); + log->Printf("Hunting for a definition for '%s'", name); // Back out in all cases where we're not fully initialized if (!m_exe_ctx || !m_exe_ctx->frame || !m_sym_ctx) |