]> granicus.if.org Git - clang/commitdiff
[StaticAnalyzer] Use front() and back() instead of dereferencing begin() and rbegin...
authorCraig Topper <craig.topper@gmail.com>
Thu, 24 Dec 2015 02:55:45 +0000 (02:55 +0000)
committerCraig Topper <craig.topper@gmail.com>
Thu, 24 Dec 2015 02:55:45 +0000 (02:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256358 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
lib/StaticAnalyzer/Core/PlistDiagnostics.cpp

index 183acbe1d91e4c6c134540bd2c5287cfa11b5b7f..b3edb8569bd6c00c9b1871fb19140f1f9dbcb381 100644 (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.
 
index 3e428fa9224ccaec4b1f89a622d18eff0d299acb..55e1222e0ac6c0307e0747b37f1d862561e88db7 100644 (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(),