[libunwind] 673484b - [libunwind] Minor SJLJ config cleanup. NFCI.

Ryan Prichard via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 3 16:00:11 PDT 2020


Author: Ryan Prichard
Date: 2020-09-03T15:59:45-07:00
New Revision: 673484b34189b1bccf73a2ec96968092bc8a26a7

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

LOG: [libunwind] Minor SJLJ config cleanup. NFCI.

Simplify:

    defined(__ARM_DWARF_EH__) || !defined(__arm__)

to:

    !defined(_LIBUNWIND_ARM_EHABI)

A later patch benefits from the simplicity. This change will result in
the two DWARF macros being defined when __USING_SJLJ_EXCEPTIONS__ is
defined, but:

 * That's already the case with the __APPLE__ and _WIN32 clauses.
 * That's also already the case with other architectures.
 * With __USING_SJLJ_EXCEPTIONS__, most of the unwinder is #ifdef'ed
   away.

Generally, when __USING_SJLJ_EXCEPTIONS__ is defined, most of the
libunwind code is removed by the preprocessor. e.g. None of the hpp
files are included, and almost all of the .c and .cpp files are defined
away, except in Unwind-sjlj.c. Unwind_AppleExtras.cpp is an exception
because it includes two hpp files, which it doesn't use. Remove the
unneeded includes for consistency with the general rule.

Reviewed By: steven_wu

Differential Revision: https://reviews.llvm.org/D86767

Added: 
    

Modified: 
    libunwind/src/Unwind_AppleExtras.cpp
    libunwind/src/config.h

Removed: 
    


################################################################################
diff  --git a/libunwind/src/Unwind_AppleExtras.cpp b/libunwind/src/Unwind_AppleExtras.cpp
index 1d9948aced35..e3d41ca2b4e9 100644
--- a/libunwind/src/Unwind_AppleExtras.cpp
+++ b/libunwind/src/Unwind_AppleExtras.cpp
@@ -8,8 +8,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "config.h"
-#include "AddressSpace.hpp"
-#include "DwarfParser.hpp"
 
 
 // static linker symbols to prevent wrong two level namespace for _Unwind symbols

diff  --git a/libunwind/src/config.h b/libunwind/src/config.h
index 2014b8cb77ab..fd177dd7338c 100644
--- a/libunwind/src/config.h
+++ b/libunwind/src/config.h
@@ -18,6 +18,8 @@
 #include <stdint.h>
 #include <stdlib.h>
 
+#include <__libunwind_config.h>
+
 // Platform specific configuration defines.
 #ifdef __APPLE__
   #if defined(FOR_DYLD)
@@ -33,7 +35,7 @@
     #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1
   #endif
 #else
-  #if defined(__ARM_DWARF_EH__) || !defined(__arm__)
+  #if !defined(_LIBUNWIND_ARM_EHABI)
     #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1
     #define _LIBUNWIND_SUPPORT_DWARF_INDEX 1
   #endif
@@ -81,6 +83,8 @@
 #error Unsupported target
 #endif
 
+// Apple/armv7k defaults to DWARF/Compact unwinding, but its libunwind also
+// needs to include the SJLJ APIs.
 #if (defined(__APPLE__) && defined(__arm__)) || defined(__USING_SJLJ_EXCEPTIONS__)
 #define _LIBUNWIND_BUILD_SJLJ_APIS
 #endif


        


More information about the cfe-commits mailing list