[cfe-dev] Clang assertion

Anders Bakken via cfe-dev cfe-dev at lists.llvm.org
Tue May 31 21:59:42 PDT 2016


Calling this function: clang_Type_getSizeOf

Sometimes leads to this assertion:

rp: /usr/src/clang/3.8.0/llvm-3.8.0/tools/clang/lib/AST/ASTContext.cpp:1790:
clang::TypeInfo clang::ASTContext::getTypeInfoImpl(const clang::Type)
const: Assertion `!A->getDeducedType().isNull() && "cannot request the size
of an undeduced or dependent auto type"' failed.

I try to avoid calling this with conditions like these:

        const CXType type = clang_getCursorType(ref);
        if (type.kind != CXType_LValueReference && type.kind !=
CXType_RValueReference && type.kind != CXType_Unexposed) {

https://github.com/Andersbakken/rtags/blob/master/src/ClangIndexer.cpp#L1087

What are the correct conditions for when this function is legal to call and
not? Also, wouldn't it be better to just return -1 than assert in this
circumstance?

regards

Anders
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160531/5a3ca093/attachment.html>


More information about the cfe-dev mailing list