summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2015-12-24 02:55:45 +0000
committerCraig Topper <craig.topper@gmail.com>2015-12-24 02:55:45 +0000
commit0a1f1fe5a21ea65b0cf08c139ce5c2c9ffc91ba1 (patch)
tree837be2a77ccd7851cb41be153de0ad065da8830b /clang
parent668f79304924ddc78eaa008e22ed91b766970bf3 (diff)
downloadbcm5719-llvm-0a1f1fe5a21ea65b0cf08c139ce5c2c9ffc91ba1.tar.gz
bcm5719-llvm-0a1f1fe5a21ea65b0cf08c139ce5c2c9ffc91ba1.zip
[StaticAnalyzer] Use front() and back() instead of dereferencing begin() and rbegin(). Makes the code a little cleaner. NFC
llvm-svn: 256358
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp10
-rw-r--r--clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp2
2 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
index 183acbe1d91..b3edb8569bd 100644
--- a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
+++ b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
@@ -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.
diff --git a/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp b/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
index 3e428fa9224..55e1222e0ac 100644
--- a/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
+++ b/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
@@ -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(),
OpenPOWER on IntegriCloud