summaryrefslogtreecommitdiff
path: root/source/Core/Module.cpp
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2015-02-06 21:38:51 +0000
committerEd Maste <emaste@FreeBSD.org>2015-02-06 21:38:51 +0000
commit205afe679855a4ce8149cdaa94d3f0868ce796dc (patch)
tree09bc83f73246ee3c7a779605cd0122093d2a8a19 /source/Core/Module.cpp
parent0cac4ca3916ac24ab6139d03cbfd18db9e715bfe (diff)
downloadsrc-test2-205afe679855a4ce8149cdaa94d3f0868ce796dc.tar.gz
src-test2-205afe679855a4ce8149cdaa94d3f0868ce796dc.zip
Notes
Diffstat (limited to 'source/Core/Module.cpp')
-rw-r--r--source/Core/Module.cpp37
1 files changed, 17 insertions, 20 deletions
diff --git a/source/Core/Module.cpp b/source/Core/Module.cpp
index 6f16ada49824..900eea2e0419 100644
--- a/source/Core/Module.cpp
+++ b/source/Core/Module.cpp
@@ -1309,6 +1309,10 @@ Module::GetObjectFile()
// unknown.
m_objfile_sp->GetArchitecture (m_arch);
}
+ else
+ {
+ ReportError ("failed to load objfile for %s", GetFileSpec().GetPath().c_str());
+ }
}
}
return m_objfile_sp.get();
@@ -1706,8 +1710,9 @@ Module::PrepareForFunctionNameLookup (const ConstString &name,
const char *name_cstr = name.GetCString();
lookup_name_type_mask = eFunctionNameTypeNone;
match_name_after_lookup = false;
- const char *base_name_start = NULL;
- const char *base_name_end = NULL;
+
+ llvm::StringRef basename;
+ llvm::StringRef context;
if (name_type_mask & eFunctionNameTypeAuto)
{
@@ -1721,16 +1726,16 @@ Module::PrepareForFunctionNameLookup (const ConstString &name,
lookup_name_type_mask |= eFunctionNameTypeSelector;
CPPLanguageRuntime::MethodName cpp_method (name);
- llvm::StringRef basename (cpp_method.GetBasename());
+ basename = cpp_method.GetBasename();
if (basename.empty())
{
- if (CPPLanguageRuntime::StripNamespacesFromVariableName (name_cstr, base_name_start, base_name_end))
+ if (CPPLanguageRuntime::ExtractContextAndIdentifier (name_cstr, context, basename))
lookup_name_type_mask |= (eFunctionNameTypeMethod | eFunctionNameTypeBase);
+ else
+ lookup_name_type_mask = eFunctionNameTypeFull;
}
else
{
- base_name_start = basename.data();
- base_name_end = base_name_start + basename.size();
lookup_name_type_mask |= (eFunctionNameTypeMethod | eFunctionNameTypeBase);
}
}
@@ -1745,9 +1750,7 @@ Module::PrepareForFunctionNameLookup (const ConstString &name,
CPPLanguageRuntime::MethodName cpp_method (name);
if (cpp_method.IsValid())
{
- llvm::StringRef basename (cpp_method.GetBasename());
- base_name_start = basename.data();
- base_name_end = base_name_start + basename.size();
+ basename = cpp_method.GetBasename();
if (!cpp_method.GetQualifiers().empty())
{
@@ -1760,12 +1763,9 @@ Module::PrepareForFunctionNameLookup (const ConstString &name,
}
else
{
- if (!CPPLanguageRuntime::StripNamespacesFromVariableName (name_cstr, base_name_start, base_name_end))
- {
- lookup_name_type_mask &= ~(eFunctionNameTypeMethod | eFunctionNameTypeBase);
- if (lookup_name_type_mask == eFunctionNameTypeNone)
- return;
- }
+ // If the CPP method parser didn't manage to chop this up, try to fill in the base name if we can.
+ // If a::b::c is passed in, we need to just look up "c", and then we'll filter the result later.
+ CPPLanguageRuntime::ExtractContextAndIdentifier (name_cstr, context, basename);
}
}
@@ -1780,16 +1780,13 @@ Module::PrepareForFunctionNameLookup (const ConstString &name,
}
}
- if (base_name_start &&
- base_name_end &&
- base_name_start != name_cstr &&
- base_name_start < base_name_end)
+ if (!basename.empty())
{
// The name supplied was a partial C++ path like "a::count". In this case we want to do a
// lookup on the basename "count" and then make sure any matching results contain "a::count"
// so that it would match "b::a::count" and "a::count". This is why we set "match_name_after_lookup"
// to true
- lookup_name.SetCStringWithLength(base_name_start, base_name_end - base_name_start);
+ lookup_name.SetString(basename);
match_name_after_lookup = true;
}
else