diff options
author | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2013-02-07 09:02:56 +0100 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2013-02-12 11:49:07 +0100 |
commit | aafbf2eaf041c9afd518db6dddc7ea702b05c599 (patch) | |
tree | 7d715a5af2a3ee0b430f2c4eb71da19d0984187d /src/plugins/cpptools/cpppointerdeclarationformatter.h | |
parent | bd7dfeee921474975268abcea62fa7c90bd31953 (diff) | |
download | qt-creator-aafbf2eaf041c9afd518db6dddc7ea702b05c599.tar.gz |
C++: Make pointer declaration formatter more robust
- Abort on expanded tokens
- Abort on simple declarations starting with "class"/"struct"/"enum"
- Abort if rewritten declaration does not contain '*'/'&'
Change-Id: Ifddb6f20d6bc5c0afc3fcd1d742615198515a04c
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/plugins/cpptools/cpppointerdeclarationformatter.h')
-rw-r--r-- | src/plugins/cpptools/cpppointerdeclarationformatter.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/plugins/cpptools/cpppointerdeclarationformatter.h b/src/plugins/cpptools/cpppointerdeclarationformatter.h index e43a58bc49..cc0e1b8d7f 100644 --- a/src/plugins/cpptools/cpppointerdeclarationformatter.h +++ b/src/plugins/cpptools/cpppointerdeclarationformatter.h @@ -106,9 +106,18 @@ protected: bool visit(ForeachStatementAST *ast); private: + class TokenRange { + public: + TokenRange() : start(0), end(0) {} + TokenRange(unsigned start, unsigned end) : start(start), end(end) {} + unsigned start; + unsigned end; + }; + void processIfWhileForStatement(ExpressionAST *expression, Symbol *symbol); - void checkAndRewrite(Symbol *symbol, Range range, unsigned charactersToRemove = 0); + void checkAndRewrite(Symbol *symbol, TokenRange range, unsigned charactersToRemove = 0); QString rewriteDeclaration(FullySpecifiedType type, const Name *name) const; + void printCandidate(AST *ast); const CppRefactoringFilePtr m_cppRefactoringFile; const Overview &m_overview; |