forked from qt-creator/qt-creator
Fixed auto-test, added constant, and added a bit of doxymentation.
This commit is contained in:
@@ -16,7 +16,7 @@ FindCdbBreakpoint::FindCdbBreakpoint(TranslationUnit *unit)
|
|||||||
unsigned FindCdbBreakpoint::searchFrom(unsigned line)
|
unsigned FindCdbBreakpoint::searchFrom(unsigned line)
|
||||||
{
|
{
|
||||||
m_initialLine = line;
|
m_initialLine = line;
|
||||||
m_breakpointLine = 0;
|
m_breakpointLine = NO_LINE_FOUND;
|
||||||
|
|
||||||
accept(translationUnit()->ast());
|
accept(translationUnit()->ast());
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ unsigned FindCdbBreakpoint::endLine(AST *ast) const
|
|||||||
if (ast)
|
if (ast)
|
||||||
return endLine(ast->lastToken() - 1);
|
return endLine(ast->lastToken() - 1);
|
||||||
else
|
else
|
||||||
return 0;
|
return NO_LINE_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FindCdbBreakpoint::preVisit(AST *ast)
|
bool FindCdbBreakpoint::preVisit(AST *ast)
|
||||||
@@ -95,13 +95,13 @@ bool FindCdbBreakpoint::visit(CompoundStatementAST *ast)
|
|||||||
bool FindCdbBreakpoint::visit(DeclarationStatementAST *ast)
|
bool FindCdbBreakpoint::visit(DeclarationStatementAST *ast)
|
||||||
{
|
{
|
||||||
foundLine(ast->lastToken() - 1);
|
foundLine(ast->lastToken() - 1);
|
||||||
return m_breakpointLine == 0;
|
return m_breakpointLine == NO_LINE_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FindCdbBreakpoint::visit(DoStatementAST *ast)
|
bool FindCdbBreakpoint::visit(DoStatementAST *ast)
|
||||||
{
|
{
|
||||||
accept(ast->statement);
|
accept(ast->statement);
|
||||||
if (m_breakpointLine == 0)
|
if (m_breakpointLine == NO_LINE_FOUND)
|
||||||
foundLine(ast->rparen_token);
|
foundLine(ast->rparen_token);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@@ -9,12 +9,22 @@ namespace CPlusPlus {
|
|||||||
class CPLUSPLUS_EXPORT FindCdbBreakpoint: protected ASTVisitor
|
class CPLUSPLUS_EXPORT FindCdbBreakpoint: protected ASTVisitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static const unsigned NO_LINE_FOUND = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FindCdbBreakpoint(TranslationUnit *unit);
|
FindCdbBreakpoint(TranslationUnit *unit);
|
||||||
|
|
||||||
unsigned operator()(unsigned line)
|
unsigned operator()(unsigned line)
|
||||||
{ return searchFrom(line); }
|
{ return searchFrom(line); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search for the next breakable line of code.
|
||||||
|
*
|
||||||
|
* \param line the starting line from where the next breakable code line
|
||||||
|
* should be found
|
||||||
|
* \return the next breakable code line (1-based), or \c NO_LINE_FOUND if
|
||||||
|
* no line could be found.
|
||||||
|
*/
|
||||||
unsigned searchFrom(unsigned line);
|
unsigned searchFrom(unsigned line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Reference in New Issue
Block a user