Author: Jan Korous
Date: 2023-01-18T18:54:48-08:00
New Revision: f252333b978c6b5a04d1cea3d92de16490969ff5

URL: 
https://github.com/llvm/llvm-project/commit/f252333b978c6b5a04d1cea3d92de16490969ff5
DIFF: 
https://github.com/llvm/llvm-project/commit/f252333b978c6b5a04d1cea3d92de16490969ff5.diff

LOG: [-Wunsafe-buffer-usage][NFC] Fix Fixables filtering

We have WIP Fixables for local variables and this central part of the machinery
was dropping Fixables attached to local variables instead of keeping those and
dropping everything else.
We are in the process of rewriting our patches for emitting fixits after we
discovered a conceptual problem in our design.
That is why there's currently no tests that would've detected the issue but
that will change very shortly.

Added: 
    

Modified: 
    clang/lib/Analysis/UnsafeBufferUsage.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Analysis/UnsafeBufferUsage.cpp 
b/clang/lib/Analysis/UnsafeBufferUsage.cpp
index ec2a09e89989..2f1417487967 100644
--- a/clang/lib/Analysis/UnsafeBufferUsage.cpp
+++ b/clang/lib/Analysis/UnsafeBufferUsage.cpp
@@ -662,7 +662,7 @@ void clang::checkUnsafeBufferUsage(const Decl *D,
   for (auto it = FixablesForUnsafeVars.byVar.cbegin();
        it != FixablesForUnsafeVars.byVar.cend();) {
     // FIXME: Support ParmVarDecl as well.
-    if (it->first->isLocalVarDecl() || Tracker.hasUnclaimedUses(it->first)) {
+    if (!it->first->isLocalVarDecl() || Tracker.hasUnclaimedUses(it->first)) {
       it = FixablesForUnsafeVars.byVar.erase(it);
     } else {
       ++it;


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to