/// If this symbol describes a constructor or destructor.
bool IsCtorOrDtor() const;
- /// If this symbol describes a function.
- bool IsFunction() const;
-
/// Get the base name of a function. This doesn't include trailing template
/// arguments, ie "a::b<int>" gives "b". The result will overwrite the
/// internal buffer. It can be obtained via GetBufferRef().
llvm_unreachable("Fully covered switch above!");
}
-bool RichManglingContext::IsFunction() const {
- assert(m_provider != None && "Initialize a provider first");
- switch (m_provider) {
- case ItaniumPartialDemangler:
- return m_ipd.isFunction();
- case PluginCxxLanguage:
- return get<CPlusPlusLanguage::MethodName>(m_cxx_method_parser)->IsValid();
- case None:
- return false;
- }
- llvm_unreachable("Fully covered switch above!");
-}
-
void RichManglingContext::processIPDStrResult(char *ipd_res, size_t res_size) {
// Error case: Clear the buffer.
if (LLVM_UNLIKELY(ipd_res == nullptr)) {
ConstString mangled("_ZN3foo3barEv");
EXPECT_TRUE(RMC.FromItaniumName(mangled));
- EXPECT_TRUE(RMC.IsFunction());
EXPECT_FALSE(RMC.IsCtorOrDtor());
RMC.ParseFunctionDeclContextName();
ConstString demangled("foo::bar()");
EXPECT_TRUE(CxxMethodRMC.FromCxxMethodName(demangled));
- EXPECT_TRUE(ItaniumRMC.IsFunction() == CxxMethodRMC.IsFunction());
EXPECT_TRUE(ItaniumRMC.IsCtorOrDtor() == CxxMethodRMC.IsCtorOrDtor());
ItaniumRMC.ParseFunctionDeclContextName();
{
RichManglingContext CxxMethodRMC;
EXPECT_TRUE(CxxMethodRMC.FromCxxMethodName(ConstString("X")));
-
- // We expect it is not a function.
- EXPECT_FALSE(CxxMethodRMC.IsFunction());
}
// Construct with a function without a context.
EXPECT_TRUE(CxxMethodRMC.FromCxxMethodName(
ConstString("void * operator new(unsigned __int64)")));
- // We expect it is a function.
- EXPECT_TRUE(CxxMethodRMC.IsFunction());
-
// We expect its context is empty.
CxxMethodRMC.ParseFunctionDeclContextName();
EXPECT_TRUE(CxxMethodRMC.GetBufferRef().empty());