forked from OSchip/llvm-project
PathDiagnosticLocation: ranges for terminators now only include the first
character instead of the entire range for the IfStmt, ForStmt, etc. We may gradually refine these ranges later, but basically terminator ranges just refer to the first keyword. llvm-svn: 69812
This commit is contained in:
parent
e4f25b706b
commit
22579c4c8f
|
@ -166,8 +166,29 @@ SourceRange PathDiagnosticLocation::asRange() const {
|
|||
case SingleLocK:
|
||||
case RangeK:
|
||||
break;
|
||||
case StmtK:
|
||||
case StmtK: {
|
||||
const Stmt *S = asStmt();
|
||||
switch (S->getStmtClass()) {
|
||||
default:
|
||||
break;
|
||||
// FIXME: Provide better range information for different
|
||||
// terminators.
|
||||
case Stmt::IfStmtClass:
|
||||
case Stmt::WhileStmtClass:
|
||||
case Stmt::DoStmtClass:
|
||||
case Stmt::ForStmtClass:
|
||||
case Stmt::ChooseExprClass:
|
||||
case Stmt::IndirectGotoStmtClass:
|
||||
case Stmt::SwitchStmtClass:
|
||||
case Stmt::ConditionalOperatorClass:
|
||||
case Stmt::ObjCForCollectionStmtClass: {
|
||||
SourceLocation L = S->getLocStart();
|
||||
return SourceRange(L, L);
|
||||
}
|
||||
}
|
||||
|
||||
return S->getSourceRange();
|
||||
}
|
||||
case DeclK:
|
||||
if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D))
|
||||
return MD->getSourceRange();
|
||||
|
|
Loading…
Reference in New Issue