Skip to content

Commit 2e6325c

Browse files
committed
Revert "[-Wunsafe-buffer-usage] Group variables associated by pointer assignments"
This reverts commit ee6b08e. One of the added tests warn-unsafe-buffer-usage-multi-decl-warnings.cpp does not seem to be deterministic, and seems to be especially problematic on Windows. Failures of this one test on llvm-clang-x86_64-sie-win: - https://lab.llvm.org/buildbot/#/builders/216/builds/21758 - https://lab.llvm.org/buildbot/#/builders/216/builds/21761 - https://lab.llvm.org/buildbot/#/builders/216/builds/21762 - https://lab.llvm.org/buildbot/#/builders/216/builds/21765 - https://lab.llvm.org/buildbot/#/builders/216/builds/21770 - https://lab.llvm.org/buildbot/#/builders/216/builds/21771 - https://lab.llvm.org/buildbot/#/builders/216/builds/21773 - https://lab.llvm.org/buildbot/#/builders/216/builds/21776 - https://lab.llvm.org/buildbot/#/builders/216/builds/21777 - https://lab.llvm.org/buildbot/#/builders/216/builds/21778 - https://lab.llvm.org/buildbot/#/builders/216/builds/21779 Other random bot failures: - https://lab.llvm.org/buildbot/#/builders/65/builds/9821 - https://lab.llvm.org/buildbot/#/builders/65/builds/9822 - https://lab.llvm.org/buildbot/#/builders/65/builds/9824 - https://lab.llvm.org/buildbot/#/builders/119/builds/13440 - https://lab.llvm.org/buildbot/#/builders/119/builds/13442 - https://lab.llvm.org/buildbot/#/builders/119/builds/13444 - https://lab.llvm.org/buildbot/#/builders/119/builds/13445 - https://lab.llvm.org/buildbot/#/builders/60/builds/12156 - https://lab.llvm.org/buildbot/#/builders/60/builds/12157 - https://lab.llvm.org/buildbot/#/builders/60/builds/12160
1 parent 0524534 commit 2e6325c

9 files changed

+61
-1020
lines changed

clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
namespace clang {
2121

22-
using DefMapTy = llvm::DenseMap<const VarDecl *, std::vector<const VarDecl *>>;
23-
2422
/// The interface that lets the caller handle unsafe buffer usage analysis
2523
/// results by overriding this class's handle... methods.
2624
class UnsafeBufferUsageHandler {
@@ -36,12 +34,9 @@ class UnsafeBufferUsageHandler {
3634
virtual void handleUnsafeOperation(const Stmt *Operation,
3735
bool IsRelatedToDecl) = 0;
3836

39-
/// Invoked when a fix is suggested against a variable. This function groups
40-
/// all variables that must be fixed together (i.e their types must be changed to the
41-
/// same target type to prevent type mismatches) into a single fixit.
42-
virtual void handleUnsafeVariableGroup(const VarDecl *Variable,
43-
const DefMapTy &VarGrpMap,
44-
FixItList &&Fixes) = 0;
37+
/// Invoked when a fix is suggested against a variable.
38+
virtual void handleFixableVariable(const VarDecl *Variable,
39+
FixItList &&List) = 0;
4540

4641
/// Returns a reference to the `Preprocessor`:
4742
virtual bool isSafeBufferOptOut(const SourceLocation &Loc) const = 0;

clang/include/clang/Analysis/Analyses/UnsafeBufferUsageGadgets.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ FIXABLE_GADGET(PointerDereference)
3636
FIXABLE_GADGET(UPCAddressofArraySubscript) // '&DRE[any]' in an Unspecified Pointer Context
3737
FIXABLE_GADGET(UPCStandalonePointer)
3838
FIXABLE_GADGET(UPCPreIncrement) // '++Ptr' in an Unspecified Pointer Context
39-
FIXABLE_GADGET(PointerAssignment)
4039

4140
#undef FIXABLE_GADGET
4241
#undef WARNING_GADGET

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11822,8 +11822,8 @@ def warn_unsafe_buffer_operation : Warning<
1182211822
InGroup<UnsafeBufferUsage>, DefaultIgnore;
1182311823
def note_unsafe_buffer_operation : Note<
1182411824
"used%select{| in pointer arithmetic| in buffer access}0 here">;
11825-
def note_unsafe_buffer_variable_fixit_group : Note<
11826-
"change type of %0 to '%select{std::span|std::array|std::span::iterator}1' to preserve bounds information%select{|, and change %2 to '%select{std::span|std::array|std::span::iterator}1' to propagate bounds information between them}3">;
11825+
def note_unsafe_buffer_variable_fixit : Note<
11826+
"change type of '%0' to '%select{std::span|std::array|std::span::iterator}1' to preserve bounds information">;
1182711827
def note_safe_buffer_usage_suggestions_disabled : Note<
1182811828
"pass -fsafe-buffer-usage-suggestions to receive code hardening suggestions">;
1182911829
def err_loongarch_builtin_requires_la32 : Error<

0 commit comments

Comments
 (0)