diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2011-07-25 16:28:10 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-09 19:10:17 -0300 |
commit | dda325de53c44decafe8f95a803e561b66dbe43f (patch) | |
tree | eafb14d5c62496cc87922922de4135dcc52e734c /typesystem.cpp | |
parent | 4430af6307cc0aa599f99eb7aaa5570eb80a7bc2 (diff) |
Fixed TypeEntry::isCppPrimitive() to process typedefs and "long long" type.
And added an unit test.
Diffstat (limited to 'typesystem.cpp')
-rw-r--r-- | typesystem.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/typesystem.cpp b/typesystem.cpp index b653bd57b..c54a12db2 100644 --- a/typesystem.cpp +++ b/typesystem.cpp @@ -2095,13 +2095,18 @@ static bool strLess(const char* a, const char* b) bool TypeEntry::isCppPrimitive() const { + if (!isPrimitive()) + return false; if (m_name.contains(' ') || m_type == VoidType) return true; // Keep this sorted!! - static const char* cppTypes[] = { "bool", "char", "double", "float", "int", "long", "short", "wchar_t"}; + static const char* cppTypes[] = { "bool", "char", "double", "float", "int", "long", "long long", "short", "wchar_t"}; const int N = sizeof(cppTypes)/sizeof(char*); - const char** res = qBinaryFind(&cppTypes[0], &cppTypes[N], m_name.toAscii().constData(), strLess); + PrimitiveTypeEntry* aliasedType = ((PrimitiveTypeEntry*)this)->basicAliasedTypeEntry(); + QString typeName = aliasedType ? aliasedType->name() : m_name; + + const char** res = qBinaryFind(&cppTypes[0], &cppTypes[N], typeName.toAscii().constData(), strLess); return res != &cppTypes[N]; } |