зеркало из https://github.com/microsoft/clang-1.git
Visit if, switch statements properly
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94126 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
1ef2fc1888
Коммит
f5bab418ae
|
@ -224,6 +224,9 @@ public:
|
|||
// Statement visitors
|
||||
bool VisitStmt(Stmt *S);
|
||||
bool VisitDeclStmt(DeclStmt *S);
|
||||
// FIXME: LabelStmt label?
|
||||
bool VisitIfStmt(IfStmt *S);
|
||||
bool VisitSwitchStmt(SwitchStmt *S);
|
||||
};
|
||||
|
||||
} // end anonymous namespace
|
||||
|
@ -677,6 +680,35 @@ bool CursorVisitor::VisitDeclStmt(DeclStmt *S) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool CursorVisitor::VisitIfStmt(IfStmt *S) {
|
||||
if (VarDecl *Var = S->getConditionVariable()) {
|
||||
if (Visit(MakeCXCursor(Var, TU)))
|
||||
return true;
|
||||
} else if (S->getCond() && Visit(MakeCXCursor(S->getCond(), StmtParent, TU)))
|
||||
return true;
|
||||
|
||||
if (S->getThen() && Visit(MakeCXCursor(S->getThen(), StmtParent, TU)))
|
||||
return true;
|
||||
|
||||
if (S->getElse() && Visit(MakeCXCursor(S->getElse(), StmtParent, TU)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CursorVisitor::VisitSwitchStmt(SwitchStmt *S) {
|
||||
if (VarDecl *Var = S->getConditionVariable()) {
|
||||
if (Visit(MakeCXCursor(Var, TU)))
|
||||
return true;
|
||||
} else if (S->getCond() && Visit(MakeCXCursor(S->getCond(), StmtParent, TU)))
|
||||
return true;
|
||||
|
||||
if (S->getBody() && Visit(MakeCXCursor(S->getBody(), StmtParent, TU)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
CXString CIndexer::createCXString(const char *String, bool DupString){
|
||||
CXString Str;
|
||||
if (DupString) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче