diff options
author | DeLesley Hutchins <delesley@google.com> | 2012-07-02 22:16:54 +0000 |
---|---|---|
committer | DeLesley Hutchins <delesley@google.com> | 2012-07-02 22:16:54 +0000 |
commit | 879a4334e4c4cab0c22ba91492ffc2838bbc21fc (patch) | |
tree | 360da565d7dc9daa73a6a06fbeabafebe6463bf9 /lib/Analysis/ThreadSafety.cpp | |
parent | c36eda1113e014400d32fbbb99be36ff0b41f795 (diff) |
Thread safety analysis: fixed incorrect error message at the end of a locks_required function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159607 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ThreadSafety.cpp')
-rw-r--r-- | lib/Analysis/ThreadSafety.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/Analysis/ThreadSafety.cpp b/lib/Analysis/ThreadSafety.cpp index e29b2a9d06..b82bc55dff 100644 --- a/lib/Analysis/ThreadSafety.cpp +++ b/lib/Analysis/ThreadSafety.cpp @@ -951,7 +951,13 @@ public: const CFGBlock *CurrBlock); Lockset intersectAndWarn(const Lockset &LSet1, const Lockset &LSet2, - SourceLocation JoinLoc, LockErrorKind LEK); + SourceLocation JoinLoc, + LockErrorKind LEK1, LockErrorKind LEK2); + + Lockset intersectAndWarn(const Lockset &LSet1, const Lockset &LSet2, + SourceLocation JoinLoc, LockErrorKind LEK1) { + return intersectAndWarn(LSet1, LSet2, JoinLoc, LEK1, LEK1); + } void runAnalysis(AnalysisDeclContext &AC); }; @@ -1541,11 +1547,13 @@ void BuildLockset::VisitDeclStmt(DeclStmt *S) { /// \param LSet1 The first lockset. /// \param LSet2 The second lockset. /// \param JoinLoc The location of the join point for error reporting -/// \param LEK The error message to report. +/// \param LEK1 The error message to report if a mutex is missing from LSet1 +/// \param LEK2 The error message to report if a mutex is missing from Lset2 Lockset ThreadSafetyAnalyzer::intersectAndWarn(const Lockset &LSet1, const Lockset &LSet2, SourceLocation JoinLoc, - LockErrorKind LEK) { + LockErrorKind LEK1, + LockErrorKind LEK2) { Lockset Intersection = LSet1; for (Lockset::iterator I = LSet2.begin(), E = LSet2.end(); I != E; ++I) { @@ -1564,7 +1572,7 @@ Lockset ThreadSafetyAnalyzer::intersectAndWarn(const Lockset &LSet1, if (!LSet2LockData.Managed) Handler.handleMutexHeldEndOfScope(LSet2Mutex.getName(), LSet2LockData.AcquireLoc, - JoinLoc, LEK); + JoinLoc, LEK1); } } @@ -1576,7 +1584,7 @@ Lockset ThreadSafetyAnalyzer::intersectAndWarn(const Lockset &LSet1, if (!MissingLock.Managed) Handler.handleMutexHeldEndOfScope(Mutex.getName(), MissingLock.AcquireLoc, - JoinLoc, LEK); + JoinLoc, LEK2); Intersection = LocksetFactory.remove(Intersection, Mutex); } } @@ -1818,7 +1826,8 @@ void ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContext &AC) { // FIXME: Should we call this function for all blocks which exit the function? intersectAndWarn(Initial->EntrySet, Final->ExitSet, Final->ExitLoc, - LEK_LockedAtEndOfFunction); + LEK_LockedAtEndOfFunction, + LEK_NotLockedAtEndOfFunction); } } // end anonymous namespace |