From bb74ef4e3b6243f20c588fea90974313f7235bb6 Mon Sep 17 00:00:00 2001 From: Aaron Ballman <aaron@aaronballman.com> Date: Fri, 15 Aug 2014 12:38:17 +0000 Subject: [PATCH] Const-correctness, return-after-else, and formatting updates. NFC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215706 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/AnalysisBasedWarnings.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp index 93ee16b4c52..20b7a0240db 100644 --- a/lib/Sema/AnalysisBasedWarnings.cpp +++ b/lib/Sema/AnalysisBasedWarnings.cpp @@ -1454,22 +1454,22 @@ class ThreadSafetyReporter : public clang::threadSafety::ThreadSafetyHandler { const FunctionDecl *CurrentFunction; bool Verbose; - OptionalNotes getNotes() { + OptionalNotes getNotes() const { if (Verbose && CurrentFunction) { PartialDiagnosticAt FNote(CurrentFunction->getBody()->getLocStart(), - S.PDiag(diag::note_thread_warning_in_fun) - << CurrentFunction->getNameAsString()); + S.PDiag(diag::note_thread_warning_in_fun) + << CurrentFunction->getNameAsString()); return OptionalNotes(1, FNote); } - else return OptionalNotes(); + return OptionalNotes(); } - OptionalNotes getNotes(const PartialDiagnosticAt &Note) { + OptionalNotes getNotes(const PartialDiagnosticAt &Note) const { OptionalNotes ONS(1, Note); if (Verbose && CurrentFunction) { PartialDiagnosticAt FNote(CurrentFunction->getBody()->getLocStart(), - S.PDiag(diag::note_thread_warning_in_fun) - << CurrentFunction->getNameAsString()); + S.PDiag(diag::note_thread_warning_in_fun) + << CurrentFunction->getNameAsString()); ONS.push_back(FNote); } return ONS; @@ -1629,13 +1629,11 @@ class ThreadSafetyReporter : public clang::threadSafety::ThreadSafetyHandler { << LockName << LK); if (Verbose && POK == POK_VarAccess) { PartialDiagnosticAt Note(D->getLocation(), - S.PDiag(diag::note_guarded_by_declared_here) << - D->getNameAsString()); + S.PDiag(diag::note_guarded_by_declared_here) + << D->getNameAsString()); Warnings.push_back(DelayedDiag(Warning, getNotes(Note))); - } - else { + } else Warnings.push_back(DelayedDiag(Warning, getNotes())); - } } } -- GitLab