Clang libtool crashing with error "Assertion `Name.isIdentifier() && "Name is not a simple identifier"' failed"

Hello

I am trying to build a static-analyzer for C/C++ programs using clang 3.9 libtool. My code crashes for some C++ programs, with the assertion error “”" Assertion `Name.isIdentifier() && “Name is not a simple identifier”’ failed “”".

It is caused by clang::FunctionDecl::getName function call which I am calling to get the name of the function declaration.

Can someone please help with possible reasons and potential fixes of this error? As far as I know this was some bug till 3.8 but has been fixed now. I have built clang 3.9 from sources.

Thanks

Abhishek Kumar

There are many kinds of DeclarationName in Clang:

enum NameKind {
Identifier,
ObjCZeroArgSelector,
ObjCOneArgSelector,
ObjCMultiArgSelector,
CXXConstructorName,
CXXDestructorName,
CXXConversionFunctionName,
CXXOperatorName,
CXXLiteralOperatorName,
CXXUsingDirective
};

getName only works on simple identifiers. You can use getNameAsString or printName if you want clang to synthesize a string for a non-identifier name.