@@ -2864,34 +2864,41 @@ void clang::checkUnsafeBufferUsage(const Decl *D,
2864
2864
it->first ->getNameAsString () +
2865
2865
" ' : has a reference type" ));
2866
2866
#endif
2867
- it = FixablesForAllVars.byVar .erase (it);
2868
- } else if (Tracker.hasUnclaimedUses (it->first )) {
2869
- #ifndef NDEBUG
2870
- auto AllUnclaimed = Tracker.getUnclaimedUses (it->first );
2871
- for (auto UnclaimedDRE : AllUnclaimed) {
2872
- std::string UnclaimedUseTrace =
2873
- getDREAncestorString (UnclaimedDRE, D->getASTContext ());
2874
-
2875
- Handler.addDebugNoteForVar (
2876
- it->first , UnclaimedDRE->getBeginLoc (),
2877
- (" failed to produce fixit for '" + it->first ->getNameAsString () +
2878
- " ' : has an unclaimed use\n The unclaimed DRE trace: " +
2879
- UnclaimedUseTrace));
2880
- }
2881
- #endif
2882
- it = FixablesForAllVars.byVar .erase (it);
2883
- } else if (it->first ->isInitCapture ()) {
2867
+ it = FixablesForAllVars.byVar .erase (it);
2868
+ } else if (Tracker.hasUnclaimedUses (it->first )) {
2869
+ it = FixablesForAllVars.byVar .erase (it);
2870
+ } else if (it->first ->isInitCapture ()) {
2884
2871
#ifndef NDEBUG
2885
2872
Handler.addDebugNoteForVar (it->first , it->first ->getBeginLoc (),
2886
2873
(" failed to produce fixit for '" +
2887
2874
it->first ->getNameAsString () +
2888
2875
" ' : init capture" ));
2889
2876
#endif
2890
- it = FixablesForAllVars.byVar .erase (it);
2891
- } else {
2892
- ++it;
2877
+ it = FixablesForAllVars.byVar .erase (it);
2878
+ } else {
2879
+ ++it;
2880
+ }
2881
+ }
2882
+
2883
+ #ifndef NDEBUG
2884
+ for (const auto &it : UnsafeOps.byVar ) {
2885
+ const VarDecl *const UnsafeVD = it.first ;
2886
+ auto UnclaimedDREs = Tracker.getUnclaimedUses (UnsafeVD);
2887
+ if (UnclaimedDREs.empty ())
2888
+ continue ;
2889
+ const auto UnfixedVDName = UnsafeVD->getNameAsString ();
2890
+ for (const clang::DeclRefExpr *UnclaimedDRE : UnclaimedDREs) {
2891
+ std::string UnclaimedUseTrace =
2892
+ getDREAncestorString (UnclaimedDRE, D->getASTContext ());
2893
+
2894
+ Handler.addDebugNoteForVar (
2895
+ UnsafeVD, UnclaimedDRE->getBeginLoc (),
2896
+ (" failed to produce fixit for '" + UnfixedVDName +
2897
+ " ' : has an unclaimed use\n The unclaimed DRE trace: " +
2898
+ UnclaimedUseTrace));
2893
2899
}
2894
2900
}
2901
+ #endif
2895
2902
2896
2903
// Fixpoint iteration for pointer assignments
2897
2904
using DepMapTy = DenseMap<const VarDecl *, llvm::SetVector<const VarDecl *>>;
0 commit comments