Author: ctopper Date: Wed Dec 23 20:55:45 2015 New Revision: 256358 URL: http://llvm.org/viewvc/llvm-project?rev=256358&view=rev Log: [StaticAnalyzer] Use front() and back() instead of dereferencing begin() and rbegin(). Makes the code a little cleaner. NFC
Modified: cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp Modified: cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp?rev=256358&r1=256357&r2=256358&view=diff ============================================================================== --- cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp Wed Dec 23 20:55:45 2015 @@ -123,10 +123,10 @@ void HTMLDiagnostics::ReportDiag(const P // 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 P // 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 P 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. Modified: cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp?rev=256358&r1=256357&r2=256358&view=diff ============================================================================== --- cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp Wed Dec 23 20:55:45 2015 @@ -295,7 +295,7 @@ void PlistDiagnostics::FlushDiagnosticsI 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(), _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits