[llvm-bugs] [Bug 47650] New: Crash in MicrosoftMangle.cpp mangleType

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 25 13:46:00 PDT 2020


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: unassignedclangbugs at nondot.org
          Reporter: bigwalrus at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200925/ca1e94c8/attachment-0001.html>


More information about the llvm-bugs mailing list