[clang] Thread safety analysis: Fix a bug in handling temporary constructors (PR #74020)

Ziqing Luo via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 4 22:05:11 PST 2023


================
@@ -2487,15 +2486,15 @@ void ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContext &AC) {
 
           // Clean up constructed object even if there are no attributes to
           // keep the number of objects in limbo as small as possible.
-          if (auto Object = LocksetBuilder.ConstructedObjects.find(
+          if (auto Object = LocksetBuilder.Analyzer->ConstructedObjects.find(
                   TD.getBindTemporaryExpr()->getSubExpr());
-              Object != LocksetBuilder.ConstructedObjects.end()) {
+              Object != LocksetBuilder.Analyzer->ConstructedObjects.end()) {
             const auto *DD = TD.getDestructorDecl(AC.getASTContext());
             if (DD->hasAttrs())
               // TODO: the location here isn't quite correct.
               LocksetBuilder.handleCall(nullptr, DD, Object->second,
                                         TD.getBindTemporaryExpr()->getEndLoc());
-            LocksetBuilder.ConstructedObjects.erase(Object);
+            LocksetBuilder.Analyzer->ConstructedObjects.erase(Object);
----------------
ziqingluo-90 wrote:

Done

https://github.com/llvm/llvm-project/pull/74020


More information about the cfe-commits mailing list