@@ -2265,8 +2265,11 @@ void ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContext &AC) {
2265
2265
const PostOrderCFGView *SortedGraph = walker.getSortedGraph ();
2266
2266
PostOrderCFGView::CFGBlockSet VisitedBlocks (CFGraph);
2267
2267
2268
+ CFGBlockInfo &Initial = BlockInfo[CFGraph->getEntry ().getBlockID ()];
2269
+ CFGBlockInfo &Final = BlockInfo[CFGraph->getExit ().getBlockID ()];
2270
+
2268
2271
// Mark entry block as reachable
2269
- BlockInfo[CFGraph-> getEntry (). getBlockID ()] .Reachable = true ;
2272
+ Initial .Reachable = true ;
2270
2273
2271
2274
// Compute SSA names for local variables
2272
2275
LocalVarMap.traverseCFG (CFGraph, SortedGraph, BlockInfo);
@@ -2282,8 +2285,8 @@ void ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContext &AC) {
2282
2285
// to initial lockset. Also turn off checking for lock and unlock functions.
2283
2286
// FIXME: is there a more intelligent way to check lock/unlock functions?
2284
2287
if (!SortedGraph->empty () && D->hasAttrs ()) {
2285
- const CFGBlock *FirstBlock = *SortedGraph-> begin ( );
2286
- FactSet &InitialLockset = BlockInfo[FirstBlock-> getBlockID ()] .EntrySet ;
2288
+ assert (*SortedGraph-> begin () == &CFGraph-> getEntry () );
2289
+ FactSet &InitialLockset = Initial .EntrySet ;
2287
2290
2288
2291
CapExprSet ExclusiveLocksToAdd;
2289
2292
CapExprSet SharedLocksToAdd;
@@ -2455,15 +2458,12 @@ void ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContext &AC) {
2455
2458
}
2456
2459
}
2457
2460
2458
- CFGBlockInfo *Initial = &BlockInfo[CFGraph->getEntry ().getBlockID ()];
2459
- CFGBlockInfo *Final = &BlockInfo[CFGraph->getExit ().getBlockID ()];
2460
-
2461
2461
// Skip the final check if the exit block is unreachable.
2462
- if (!Final-> Reachable )
2462
+ if (!Final. Reachable )
2463
2463
return ;
2464
2464
2465
2465
// By default, we expect all locks held on entry to be held on exit.
2466
- FactSet ExpectedExitSet = Initial-> EntrySet ;
2466
+ FactSet ExpectedExitSet = Initial. EntrySet ;
2467
2467
2468
2468
// Adjust the expected exit set by adding or removing locks, as declared
2469
2469
// by *-LOCK_FUNCTION and UNLOCK_FUNCTION. The intersect below will then
@@ -2479,7 +2479,7 @@ void ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContext &AC) {
2479
2479
ExpectedExitSet.removeLock (FactMan, Lock);
2480
2480
2481
2481
// FIXME: Should we call this function for all blocks which exit the function?
2482
- intersectAndWarn (ExpectedExitSet, Final-> ExitSet , Final-> ExitLoc ,
2482
+ intersectAndWarn (ExpectedExitSet, Final. ExitSet , Final. ExitLoc ,
2483
2483
LEK_LockedAtEndOfFunction, LEK_NotLockedAtEndOfFunction);
2484
2484
2485
2485
Handler.leaveFunction (CurrentFunction);
0 commit comments