[StaticAnalyzer] Use front() and back() instead of dereferencing begin() and rbegin(). Makes the code a little cleaner. NFC

llvm-svn: 256358
This commit is contained in:
Craig Topper 2015-12-24 02:55:45 +00:00
parent 668f793049
commit 0a1f1fe5a2
2 changed files with 6 additions and 6 deletions

View File

@ -123,10 +123,10 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D,
// The path as already been prechecked that all parts of the path are
// from the same file and that it is non-empty.
const SourceManager &SMgr = (*path.begin())->getLocation().getManager();
const SourceManager &SMgr = path.front()->getLocation().getManager();
assert(!path.empty());
FileID FID =
(*path.begin())->getLocation().asLocation().getExpansionLoc().getFileID();
path.front()->getLocation().asLocation().getExpansionLoc().getFileID();
assert(FID.isValid());
// Create a new rewriter to generate HTML.
@ -144,7 +144,7 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D,
// Retrieve the relative position of the declaration which will be used
// for the file name
FullSourceLoc L(
SMgr.getExpansionLoc((*path.rbegin())->getLocation().asLocation()),
SMgr.getExpansionLoc(path.back()->getLocation().asLocation()),
SMgr);
FullSourceLoc FunL(SMgr.getExpansionLoc(Body->getLocStart()), SMgr);
offsetDecl = L.getExpansionLineNumber() - FunL.getExpansionLineNumber();
@ -188,8 +188,8 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D,
DirName += '/';
}
int LineNumber = (*path.rbegin())->getLocation().asLocation().getExpansionLineNumber();
int ColumnNumber = (*path.rbegin())->getLocation().asLocation().getExpansionColumnNumber();
int LineNumber = path.back()->getLocation().asLocation().getExpansionLineNumber();
int ColumnNumber = path.back()->getLocation().asLocation().getExpansionColumnNumber();
// Add the name of the file as an <h1> tag.

View File

@ -295,7 +295,7 @@ void PlistDiagnostics::FlushDiagnosticsImpl(
const SourceManager* SM = nullptr;
if (!Diags.empty())
SM = &(*(*Diags.begin())->path.begin())->getLocation().getManager();
SM = &Diags.front()->path.front()->getLocation().getManager();
for (std::vector<const PathDiagnostic*>::iterator DI = Diags.begin(),