https://bugs.llvm.org/show_bug.cgi?id=47650

            Bug ID: 47650
           Summary: Crash in MicrosoftMangle.cpp mangleType
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: bigwal...@gmail.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@metafoo.co.uk

clang msvc-compat

I'm using clang::parseAST to parse wrl\event.h from the Windows 10 SDK. In my
Visitor::VisitFunctionDecl, I'm using the mangler to generate mangled names and
it is crashing on Microsoft::WRL::Callback.

The type is TemplateTypeParam, not RecordType, hence the crash.

I suspect the function in question is this:

// Construct a COM/WinRT delegate, an object with an Invoke() method, from an
object and member function.
template<typename TDelegateInterface, typename TCallbackObject, typename...
TArgs>
ComPtr<typename
Details::DelegateArgTraitsHelper<TDelegateInterface>::Interface> Callback(_In_
TCallbackObject *object, _In_ HRESULT(TCallbackObject::* method)(TArgs...))
throw()
{
    return Callback<TDelegateInterface>([=](auto&& ...args) { return
((*object).*(method))(args ...); });
}

        ocgen.exe!clang::Type::castAs<clang::RecordType>() Line 83      C++
>       ocgen.exe!`anonymous 
> namespace'::MicrosoftCXXNameMangler::mangleType(const 
> clang::MemberPointerType * T, clang::Qualifiers Quals, clang::SourceRange 
> Range) Line 2575   C++
        ocgen.exe!`anonymous
namespace'::MicrosoftCXXNameMangler::mangleType(clang::QualType T,
clang::SourceRange Range,
`anonymous-namespace'::MicrosoftCXXNameMangler::QualifierMangleMode QMM) Line
48      C++
        ocgen.exe!`anonymous
namespace'::MicrosoftCXXNameMangler::mangleFunctionArgumentType(clang::QualType
T, clang::SourceRange Range) Line 1785     C++
        ocgen.exe!`anonymous
namespace'::MicrosoftCXXNameMangler::mangleFunctionType(const
clang::FunctionType * T, const clang::FunctionDecl * D, bool ForceThisQuals,
bool MangleExceptionSpec) Line 2300     C++
        ocgen.exe!`anonymous
namespace'::MicrosoftCXXNameMangler::mangleFunctionEncoding(const
clang::FunctionDecl * FD, bool ShouldMangle) Line 533    C++
        ocgen.exe!`anonymous namespace'::MicrosoftCXXNameMangler::mangle(const
clang::NamedDecl * D, llvm::StringRef Prefix) Line 499   C++
        ocgen.exe!`anonymous
namespace'::MicrosoftMangleContextImpl::mangleCXXName(const clang::NamedDecl *
D, llvm::raw_ostream & Out) Line 2965       C++
        ocgen.exe!clang::MangleContext::mangleName(const clang::NamedDecl * D,
llvm::raw_ostream & Out) Line 153        C++
<trim>

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to