forked from OSchip/llvm-project
Skip checking for a bunch of built-ins when evaluating an expression.
llvm-svn: 116565
This commit is contained in:
parent
59351844e1
commit
ee4b5dd664
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include "clang/AST/ASTContext.h"
|
#include "clang/AST/ASTContext.h"
|
||||||
|
#include "lldb/Core/Log.h"
|
||||||
#include "lldb/Expression/ClangASTSource.h"
|
#include "lldb/Expression/ClangASTSource.h"
|
||||||
#include "lldb/Expression/ClangExpression.h"
|
#include "lldb/Expression/ClangExpression.h"
|
||||||
#include "lldb/Expression/ClangExpressionDeclMap.h"
|
#include "lldb/Expression/ClangExpressionDeclMap.h"
|
||||||
|
@ -37,8 +38,13 @@ Selector ClangASTSource::GetExternalSelector(uint32_t) { return Selector(); }
|
||||||
uint32_t ClangASTSource::GetNumExternalSelectors() { return 0; }
|
uint32_t ClangASTSource::GetNumExternalSelectors() { return 0; }
|
||||||
|
|
||||||
// The core lookup interface.
|
// The core lookup interface.
|
||||||
DeclContext::lookup_result ClangASTSource::FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name) {
|
DeclContext::lookup_result ClangASTSource::FindExternalVisibleDeclsByName
|
||||||
switch (Name.getNameKind()) {
|
(
|
||||||
|
const DeclContext *decl_ctx,
|
||||||
|
DeclarationName decl_name
|
||||||
|
)
|
||||||
|
{
|
||||||
|
switch (decl_name.getNameKind()) {
|
||||||
// Normal identifiers.
|
// Normal identifiers.
|
||||||
case DeclarationName::Identifier:
|
case DeclarationName::Identifier:
|
||||||
break;
|
break;
|
||||||
|
@ -51,7 +57,7 @@ DeclContext::lookup_result ClangASTSource::FindExternalVisibleDeclsByName(const
|
||||||
// Using directives found in this context.
|
// Using directives found in this context.
|
||||||
// Tell Sema we didn't find any or we'll end up getting asked a *lot*.
|
// Tell Sema we didn't find any or we'll end up getting asked a *lot*.
|
||||||
case DeclarationName::CXXUsingDirective:
|
case DeclarationName::CXXUsingDirective:
|
||||||
return SetNoExternalVisibleDeclsForName(DC, Name);
|
return SetNoExternalVisibleDeclsForName(decl_ctx, decl_name);
|
||||||
|
|
||||||
// These aren't looked up like this.
|
// These aren't looked up like this.
|
||||||
case DeclarationName::ObjCZeroArgSelector:
|
case DeclarationName::ObjCZeroArgSelector:
|
||||||
|
@ -66,18 +72,33 @@ DeclContext::lookup_result ClangASTSource::FindExternalVisibleDeclsByName(const
|
||||||
return DeclContext::lookup_result();
|
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;
|
llvm::SmallVector<NamedDecl*, 4> Decls;
|
||||||
|
|
||||||
NameSearchContext NSC(*this, Decls, Name, DC);
|
NameSearchContext NSC(*this, Decls, decl_name, decl_ctx);
|
||||||
|
|
||||||
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());
|
DeclMap.GetDecls(NSC, name.c_str());
|
||||||
return SetExternalVisibleDeclsForName(DC, Name, Decls);
|
return SetExternalVisibleDeclsForName(decl_ctx, decl_name, Decls);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangASTSource::MaterializeVisibleDecls(const DeclContext *DC)
|
void ClangASTSource::MaterializeVisibleDecls(const DeclContext *DC)
|
||||||
|
|
|
@ -907,7 +907,7 @@ ClangExpressionDeclMap::GetDecls(NameSearchContext &context,
|
||||||
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
|
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
|
||||||
|
|
||||||
if (log)
|
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
|
// Back out in all cases where we're not fully initialized
|
||||||
if (!m_exe_ctx || !m_exe_ctx->frame || !m_sym_ctx)
|
if (!m_exe_ctx || !m_exe_ctx->frame || !m_sym_ctx)
|
||||||
|
|
Loading…
Reference in New Issue