C++: display enum value in tooltip for simplest case

If it is possible lets calculate enum value for the simplest case.
Example where it works:
enum
{
  enum_val1, // tooltip = "enum_val1 = 0"
  enum_val2 // tooltip = "enum_val2 = 1"
};

enum
{
  enum_val1=10, // tooltip = "enum_val1 = 10"
  enum_val2 // tooltip = "enum_val2 = 11"
};

enum
{
  enum_val1, // tooltip = "enum_val1 = 0"
  enum_val2=10, // tooltip = "enum_val2 = 10"
  enum_val3 // tooltip = "enum_val3 = 11"
};

Example where it does not work:
enum
{
  enum_val1=10+1, // tooltip = "enum_val1 = 10+1"
  enum_val2 // tooltip = "enum_val2"
};

Task-number: QTCREATORBUG-4529
Change-Id: Idd85ed7304018f73f2b068bf1ac28f1abde02f93
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Przemyslaw Gorszkowski
2014-12-02 10:57:08 +01:00
parent f66ee66595
commit 9e159d87a8
3 changed files with 165 additions and 2 deletions

View File

@@ -456,7 +456,7 @@ CppEnumerator::CppEnumerator(CPlusPlus::EnumeratorDeclaration *declaration)
Overview overview;
Symbol *enumSymbol = declaration->enclosingScope()->asEnum();
Symbol *enumSymbol = declaration->enclosingScope();
const QString enumName = overview.prettyName(LookupContext::fullyQualifiedName(enumSymbol));
const QString enumeratorName = overview.prettyName(declaration->name());
QString enumeratorValue;