misra.py: Fix crash on c++ code (#2414)

This commit is contained in:
Georgy Komarov 2019-12-01 16:51:12 +03:00 committed by Daniel Marjamäki
parent a71f58ffc2
commit c1770414ba
2 changed files with 9 additions and 1 deletions

View File

@ -124,7 +124,7 @@ def getEssentialTypeCategory(expr):
return e1
if expr.valueType:
return expr.valueType.sign
if expr.valueType and expr.valueType.typeScope:
if expr.valueType and expr.valueType.typeScope and expr.valueType.typeScope.className:
return "enum<" + expr.valueType.typeScope.className + ">"
if expr.variable:
typeToken = expr.variable.typeStartToken

View File

@ -10,6 +10,14 @@ class misra_21_1_C {
misra_21_1_C operator=(const misra_21_1_C &);
};
class C2 {
public:
C2();
private:
void* f;
};
C2::C2() : f(NULL) {}
static bool test_misra_21_1_crash()
{
auto misra_21_1_C a, b;