[llvm-branch-commits] [clang] 075d427 - Revert "[clang][UBSan] Add implicit conversion check for bitfields (#75481)"

2024-04-03 Thread via llvm-branch-commits

Author: Vitaly Buka
Date: 2024-04-03T09:36:32-07:00
New Revision: 075d4277d4bf05f1ad71a5d3c18bc56942d392f1

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

LOG: Revert "[clang][UBSan] Add implicit conversion check for bitfields 
(#75481)"

This reverts commit 450f1952aced87584a53485d1ba1c2f77c3835a1.

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/docs/UndefinedBehaviorSanitizer.rst
clang/include/clang/Basic/Sanitizers.def
clang/lib/CodeGen/CGExpr.cpp
clang/lib/CodeGen/CGExprScalar.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/test/Driver/fsanitize.c
compiler-rt/lib/ubsan/ubsan_handlers.cpp
compiler-rt/lib/ubsan/ubsan_handlers.h

Removed: 
clang/test/CodeGen/ubsan-bitfield-conversion.c
clang/test/CodeGenCXX/ubsan-bitfield-conversion.cpp



diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 096376af17acbb..3237842fa1ceb1 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -195,10 +195,6 @@ Non-comprehensive list of changes in this release
 
 New Compiler Flags
 --
-- ``-fsanitize=implicit-bitfield-conversion`` checks implicit truncation and
-  sign change.
-- ``-fsanitize=implicit-integer-conversion`` a group that replaces the previous
-  group ``-fsanitize=implicit-conversion``.
 
 - ``-Wmissing-designated-field-initializers``, grouped under 
``-Wmissing-field-initializers``.
   This diagnostic can be disabled to make ``-Wmissing-field-initializers`` 
behave
@@ -212,9 +208,6 @@ Modified Compiler Flags
 - Added a new diagnostic flag ``-Wreturn-mismatch`` which is grouped under
   ``-Wreturn-type``, and moved some of the diagnostics previously controlled by
   ``-Wreturn-type`` under this new flag. Fixes #GH72116.
-- ``-fsanitize=implicit-conversion`` is now a group for both
-  ``-fsanitize=implicit-integer-conversion`` and
-  ``-fsanitize=implicit-bitfield-conversion``.
 
 - Added ``-Wcast-function-type-mismatch`` under the ``-Wcast-function-type``
   warning group. Moved the diagnostic previously controlled by

diff  --git a/clang/docs/UndefinedBehaviorSanitizer.rst 
b/clang/docs/UndefinedBehaviorSanitizer.rst
index 531d56e313826c..8f58c92bd2a163 100644
--- a/clang/docs/UndefinedBehaviorSanitizer.rst
+++ b/clang/docs/UndefinedBehaviorSanitizer.rst
@@ -148,11 +148,6 @@ Available checks are:
  Issues caught by this sanitizer are not undefined behavior,
  but are often unintentional.
   -  ``-fsanitize=integer-divide-by-zero``: Integer division by zero.
-  -  ``-fsanitize=implicit-bitfield-conversion``: Implicit conversion from
- integer of larger bit width to smaller bitfield, if that results in data
- loss. This includes unsigned/signed truncations and sign changes, 
similarly
- to how the ``-fsanitize=implicit-integer-conversion`` group works, but
- explicitly for bitfields.
   -  ``-fsanitize=nonnull-attribute``: Passing null pointer as a function
  parameter which is declared to never be null.
   -  ``-fsanitize=null``: Use of a null pointer or creation of a null
@@ -198,8 +193,8 @@ Available checks are:
  signed division overflow (``INT_MIN/-1``). Note that checks are still
  added even when ``-fwrapv`` is enabled. This sanitizer does not check for
  lossy implicit conversions performed before the computation (see
- ``-fsanitize=implicit-integer-conversion``). Both of these two issues are 
handled
- by ``-fsanitize=implicit-integer-conversion`` group of checks.
+ ``-fsanitize=implicit-conversion``). Both of these two issues are handled
+ by ``-fsanitize=implicit-conversion`` group of checks.
   -  ``-fsanitize=unreachable``: If control flow reaches an unreachable
  program point.
   -  ``-fsanitize=unsigned-integer-overflow``: Unsigned integer overflow, where
@@ -207,7 +202,7 @@ Available checks are:
  type. Unlike signed integer overflow, this is not undefined behavior, but
  it is often unintentional. This sanitizer does not check for lossy 
implicit
  conversions performed before such a computation
- (see ``-fsanitize=implicit-integer-conversion``).
+ (see ``-fsanitize=implicit-conversion``).
   -  ``-fsanitize=vla-bound``: A variable-length array whose bound
  does not evaluate to a positive value.
   -  ``-fsanitize=vptr``: Use of an object whose vptr indicates that it is of
@@ -229,15 +224,11 @@ You can also use the following check groups:
   -  ``-fsanitize=implicit-integer-arithmetic-value-change``: Catches implicit
  conversions that change the arithmetic value of the integer. Enables
  ``implicit-signed-integer-truncation`` and 
``implicit-integer-sign-change``.
-  -  ``-fsanitize=implicit-integer-conversion``: Checks for suspicious
- behavior of implicit int

[llvm-branch-commits] [clang] b8c749c - Revert "Revert "[clang][UBSan] Add implicit conversion check for bitfields" (…"

2024-04-03 Thread via llvm-branch-commits

Author: Vitaly Buka
Date: 2024-04-03T10:48:24-07:00
New Revision: b8c749c7b19344fa965a4ab016adcef7d58bb71b

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

LOG: Revert "Revert "[clang][UBSan] Add implicit conversion check for 
bitfields" (…"

This reverts commit 5822ca5a013256bbca33fbbae56f49caa2e37fe3.

Added: 
clang/test/CodeGen/ubsan-bitfield-conversion.c
clang/test/CodeGenCXX/ubsan-bitfield-conversion.cpp

Modified: 
clang/docs/ReleaseNotes.rst
clang/docs/UndefinedBehaviorSanitizer.rst
clang/include/clang/Basic/Sanitizers.def
clang/lib/CodeGen/CGExpr.cpp
clang/lib/CodeGen/CGExprScalar.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/test/Driver/fsanitize.c
compiler-rt/lib/ubsan/ubsan_handlers.cpp
compiler-rt/lib/ubsan/ubsan_handlers.h

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 8fc925350849cd..e4c0e49ed6fc1c 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -198,6 +198,10 @@ Non-comprehensive list of changes in this release
 
 New Compiler Flags
 --
+- ``-fsanitize=implicit-bitfield-conversion`` checks implicit truncation and
+  sign change.
+- ``-fsanitize=implicit-integer-conversion`` a group that replaces the previous
+  group ``-fsanitize=implicit-conversion``.
 
 - ``-Wmissing-designated-field-initializers``, grouped under 
``-Wmissing-field-initializers``.
   This diagnostic can be disabled to make ``-Wmissing-field-initializers`` 
behave
@@ -211,6 +215,9 @@ Modified Compiler Flags
 - Added a new diagnostic flag ``-Wreturn-mismatch`` which is grouped under
   ``-Wreturn-type``, and moved some of the diagnostics previously controlled by
   ``-Wreturn-type`` under this new flag. Fixes #GH72116.
+- ``-fsanitize=implicit-conversion`` is now a group for both
+  ``-fsanitize=implicit-integer-conversion`` and
+  ``-fsanitize=implicit-bitfield-conversion``.
 
 - Added ``-Wcast-function-type-mismatch`` under the ``-Wcast-function-type``
   warning group. Moved the diagnostic previously controlled by

diff  --git a/clang/docs/UndefinedBehaviorSanitizer.rst 
b/clang/docs/UndefinedBehaviorSanitizer.rst
index 8f58c92bd2a163..531d56e313826c 100644
--- a/clang/docs/UndefinedBehaviorSanitizer.rst
+++ b/clang/docs/UndefinedBehaviorSanitizer.rst
@@ -148,6 +148,11 @@ Available checks are:
  Issues caught by this sanitizer are not undefined behavior,
  but are often unintentional.
   -  ``-fsanitize=integer-divide-by-zero``: Integer division by zero.
+  -  ``-fsanitize=implicit-bitfield-conversion``: Implicit conversion from
+ integer of larger bit width to smaller bitfield, if that results in data
+ loss. This includes unsigned/signed truncations and sign changes, 
similarly
+ to how the ``-fsanitize=implicit-integer-conversion`` group works, but
+ explicitly for bitfields.
   -  ``-fsanitize=nonnull-attribute``: Passing null pointer as a function
  parameter which is declared to never be null.
   -  ``-fsanitize=null``: Use of a null pointer or creation of a null
@@ -193,8 +198,8 @@ Available checks are:
  signed division overflow (``INT_MIN/-1``). Note that checks are still
  added even when ``-fwrapv`` is enabled. This sanitizer does not check for
  lossy implicit conversions performed before the computation (see
- ``-fsanitize=implicit-conversion``). Both of these two issues are handled
- by ``-fsanitize=implicit-conversion`` group of checks.
+ ``-fsanitize=implicit-integer-conversion``). Both of these two issues are 
handled
+ by ``-fsanitize=implicit-integer-conversion`` group of checks.
   -  ``-fsanitize=unreachable``: If control flow reaches an unreachable
  program point.
   -  ``-fsanitize=unsigned-integer-overflow``: Unsigned integer overflow, where
@@ -202,7 +207,7 @@ Available checks are:
  type. Unlike signed integer overflow, this is not undefined behavior, but
  it is often unintentional. This sanitizer does not check for lossy 
implicit
  conversions performed before such a computation
- (see ``-fsanitize=implicit-conversion``).
+ (see ``-fsanitize=implicit-integer-conversion``).
   -  ``-fsanitize=vla-bound``: A variable-length array whose bound
  does not evaluate to a positive value.
   -  ``-fsanitize=vptr``: Use of an object whose vptr indicates that it is of
@@ -224,11 +229,15 @@ You can also use the following check groups:
   -  ``-fsanitize=implicit-integer-arithmetic-value-change``: Catches implicit
  conversions that change the arithmetic value of the integer. Enables
  ``implicit-signed-integer-truncation`` and 
``implicit-integer-sign-change``.
-  -  ``-fsanitize=implicit-conversion``: Checks for suspicious
- behavior of implicit conversi

[llvm-branch-commits] [clang] cb5bdaa - Revert "Revert "Revert "[clang][UBSan] Add implicit conversion check for bitf…"

2024-04-03 Thread via llvm-branch-commits

Author: Vitaly Buka
Date: 2024-04-03T14:28:28-07:00
New Revision: cb5bdaae1e426dd468aa935d61b500a602bc98e5

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

LOG: Revert "Revert "Revert "[clang][UBSan] Add implicit conversion check for 
bitf…"

This reverts commit 8a5a1b770413bb62ff27cd8c2aea3d04b3a95bbe.

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/docs/UndefinedBehaviorSanitizer.rst
clang/include/clang/Basic/Sanitizers.def
clang/lib/CodeGen/CGExpr.cpp
clang/lib/CodeGen/CGExprScalar.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/test/Driver/fsanitize.c
compiler-rt/lib/ubsan/ubsan_handlers.cpp
compiler-rt/lib/ubsan/ubsan_handlers.h

Removed: 
clang/test/CodeGen/ubsan-bitfield-conversion.c
clang/test/CodeGenCXX/ubsan-bitfield-conversion.cpp



diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index e4c0e49ed6fc1c..8fc925350849cd 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -198,10 +198,6 @@ Non-comprehensive list of changes in this release
 
 New Compiler Flags
 --
-- ``-fsanitize=implicit-bitfield-conversion`` checks implicit truncation and
-  sign change.
-- ``-fsanitize=implicit-integer-conversion`` a group that replaces the previous
-  group ``-fsanitize=implicit-conversion``.
 
 - ``-Wmissing-designated-field-initializers``, grouped under 
``-Wmissing-field-initializers``.
   This diagnostic can be disabled to make ``-Wmissing-field-initializers`` 
behave
@@ -215,9 +211,6 @@ Modified Compiler Flags
 - Added a new diagnostic flag ``-Wreturn-mismatch`` which is grouped under
   ``-Wreturn-type``, and moved some of the diagnostics previously controlled by
   ``-Wreturn-type`` under this new flag. Fixes #GH72116.
-- ``-fsanitize=implicit-conversion`` is now a group for both
-  ``-fsanitize=implicit-integer-conversion`` and
-  ``-fsanitize=implicit-bitfield-conversion``.
 
 - Added ``-Wcast-function-type-mismatch`` under the ``-Wcast-function-type``
   warning group. Moved the diagnostic previously controlled by

diff  --git a/clang/docs/UndefinedBehaviorSanitizer.rst 
b/clang/docs/UndefinedBehaviorSanitizer.rst
index 531d56e313826c..8f58c92bd2a163 100644
--- a/clang/docs/UndefinedBehaviorSanitizer.rst
+++ b/clang/docs/UndefinedBehaviorSanitizer.rst
@@ -148,11 +148,6 @@ Available checks are:
  Issues caught by this sanitizer are not undefined behavior,
  but are often unintentional.
   -  ``-fsanitize=integer-divide-by-zero``: Integer division by zero.
-  -  ``-fsanitize=implicit-bitfield-conversion``: Implicit conversion from
- integer of larger bit width to smaller bitfield, if that results in data
- loss. This includes unsigned/signed truncations and sign changes, 
similarly
- to how the ``-fsanitize=implicit-integer-conversion`` group works, but
- explicitly for bitfields.
   -  ``-fsanitize=nonnull-attribute``: Passing null pointer as a function
  parameter which is declared to never be null.
   -  ``-fsanitize=null``: Use of a null pointer or creation of a null
@@ -198,8 +193,8 @@ Available checks are:
  signed division overflow (``INT_MIN/-1``). Note that checks are still
  added even when ``-fwrapv`` is enabled. This sanitizer does not check for
  lossy implicit conversions performed before the computation (see
- ``-fsanitize=implicit-integer-conversion``). Both of these two issues are 
handled
- by ``-fsanitize=implicit-integer-conversion`` group of checks.
+ ``-fsanitize=implicit-conversion``). Both of these two issues are handled
+ by ``-fsanitize=implicit-conversion`` group of checks.
   -  ``-fsanitize=unreachable``: If control flow reaches an unreachable
  program point.
   -  ``-fsanitize=unsigned-integer-overflow``: Unsigned integer overflow, where
@@ -207,7 +202,7 @@ Available checks are:
  type. Unlike signed integer overflow, this is not undefined behavior, but
  it is often unintentional. This sanitizer does not check for lossy 
implicit
  conversions performed before such a computation
- (see ``-fsanitize=implicit-integer-conversion``).
+ (see ``-fsanitize=implicit-conversion``).
   -  ``-fsanitize=vla-bound``: A variable-length array whose bound
  does not evaluate to a positive value.
   -  ``-fsanitize=vptr``: Use of an object whose vptr indicates that it is of
@@ -229,15 +224,11 @@ You can also use the following check groups:
   -  ``-fsanitize=implicit-integer-arithmetic-value-change``: Catches implicit
  conversions that change the arithmetic value of the integer. Enables
  ``implicit-signed-integer-truncation`` and 
``implicit-integer-sign-change``.
-  -  ``-fsanitize=implicit-integer-conversion``: Checks for suspicious
- behavior of implicit 

[llvm-branch-commits] [lldb] f65d00c - Revert "DebugInfoD issues, take 2 (#86812)"

2024-04-03 Thread via llvm-branch-commits

Author: Chelsea Cassanova
Date: 2024-04-03T16:29:37-07:00
New Revision: f65d00c9d1f30b309404e892bca198ce94a5e448

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

LOG: Revert "DebugInfoD issues, take 2 (#86812)"

This reverts commit a8425d2fa2e0d29b83d16eac008441ecb9516320.

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/make/Makefile.rules
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolLocator/CMakeLists.txt
lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp

Removed: 
lldb/test/API/debuginfod/Normal/Makefile
lldb/test/API/debuginfod/Normal/TestDebuginfod.py
lldb/test/API/debuginfod/Normal/main.c
lldb/test/API/debuginfod/SplitDWARF/Makefile
lldb/test/API/debuginfod/SplitDWARF/TestDebuginfodDWP.py
lldb/test/API/debuginfod/SplitDWARF/main.c



diff  --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules 
b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index ee8793fa1b3029..bfd249ccd43f2e 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -51,7 +51,7 @@ LLDB_BASE_DIR := $(THIS_FILE_DIR)/../../../../../
 #
 # GNUWin32 uname gives "windows32" or "server version windows32" while
 # some versions of MSYS uname return "MSYS_NT*", but most environments
-# standardize on "Windows_NT", so we'll make it consistent here.
+# standardize on "Windows_NT", so we'll make it consistent here. 
 # When running tests from Visual Studio, the environment variable isn't
 # inherited all the way down to the process spawned for make.
 #--
@@ -210,12 +210,6 @@ else
ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
DSYM = $(EXE).debug
endif
-
-   ifeq "$(MAKE_DWP)" "YES"
-   MAKE_DWO := YES
-   DWP_NAME = $(EXE).dwp
-   DYLIB_DWP_NAME = $(DYLIB_NAME).dwp
-   endif
 endif
 
 LIMIT_DEBUG_INFO_FLAGS =
@@ -363,7 +357,6 @@ ifneq "$(OS)" "Darwin"
 
OBJCOPY ?= $(call replace_cc_with,objcopy)
ARCHIVER ?= $(call replace_cc_with,ar)
-   DWP ?= $(call replace_cc_with,dwp)
override AR = $(ARCHIVER)
 endif
 
@@ -534,10 +527,6 @@ ifneq "$(CXX)" ""
endif
 endif
 
-ifeq "$(GEN_GNU_BUILD_ID)" "YES"
-   LDFLAGS += -Wl,--build-id
-endif
-
 #--
 # DYLIB_ONLY variable can be used to skip the building of a.out.
 # See the sections below regarding dSYM file as well as the building of
@@ -576,17 +565,10 @@ else
 endif
 else
 ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
-ifeq "$(SAVE_FULL_DEBUG_BINARY)" "YES"
-   cp "$(EXE)" "$(EXE).unstripped"
-endif
$(OBJCOPY) --only-keep-debug "$(EXE)" "$(DSYM)"
$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)"
 endif
-ifeq "$(MAKE_DWP)" "YES"
-   $(DWP) -o "$(DWP_NAME)" $(DWOS)
 endif
-endif
-
 
 #--
 # Make the dylib
@@ -628,15 +610,9 @@ endif
 else
$(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -shared -o "$(DYLIB_FILENAME)"
 ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
-   ifeq "$(SAVE_FULL_DEBUG_BINARY)" "YES"
-   cp "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).unstripped"
-   endif
$(OBJCOPY) --only-keep-debug "$(DYLIB_FILENAME)" 
"$(DYLIB_FILENAME).debug"
$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DYLIB_FILENAME).debug" 
"$(DYLIB_FILENAME)" "$(DYLIB_FILENAME)"
 endif
-ifeq "$(MAKE_DWP)" "YES"
-   $(DWP) -o $(DYLIB_DWP_FILE) $(DYLIB_DWOS)
-endif
 endif
 
 #--

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index dafdf241f9db0c..49f13d2c89e380 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -4378,38 +4378,26 @@ const std::shared_ptr 
&SymbolFileDWARF::GetDwpSymbolFile() {
 FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths();
 ModuleSpec module_spec;
 module_spec.GetFileSpec() = m_objfile_sp->GetFileSpec();
-FileSpec dwp_filespec;
 for (const auto &symfile : symfiles.files()) {
   module_spec.GetSymbolFileSpec() =
   FileSpec(symfile.GetPath() + ".dwp", symfile.GetPathStyle());
   LLDB_LOG(log, "Searching for DWP using: \"{0}\"",
module_spec.GetSymbolFileSpec());
-  dwp_filespec =
+  FileSpec dwp_filespec =
   PluginManager::LocateExecutableSymbolFile(module_spec, search_paths);
   if (FileSystem::Instance().Exists(dwp_filespec))