chrib updated this revision to Diff 115176.
chrib added a comment.

Update IsUnwindTablesDefault to test fno-exceptions. (see Darwin.cpp)

Add comments.


https://reviews.llvm.org/D31140

Files:
  lib/Driver/ToolChains/BareMetal.cpp
  lib/Driver/ToolChains/BareMetal.h


Index: lib/Driver/ToolChains/BareMetal.h
===================================================================
--- lib/Driver/ToolChains/BareMetal.h
+++ lib/Driver/ToolChains/BareMetal.h
@@ -32,6 +32,7 @@
 
 public:
   bool useIntegratedAs() const override { return true; }
+  bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override;
   bool isCrossCompiling() const override { return true; }
   bool isPICDefault() const override { return false; }
   bool isPIEDefault() const override { return false; }
Index: lib/Driver/ToolChains/BareMetal.cpp
===================================================================
--- lib/Driver/ToolChains/BareMetal.cpp
+++ lib/Driver/ToolChains/BareMetal.cpp
@@ -57,6 +57,14 @@
   return true;
 }
 
+bool BareMetal::IsUnwindTablesDefault(const ArgList &Args) const {
+  // Unwind tables are not emitted in C or if -fno-exceptions is supplied.
+  // For C++ we cannot rely on UWTable because we still need the .exidx section
+  // even if the function does not throw.
+  return Args.hasFlag(options::OPT_fexceptions, options::OPT_fno_exceptions,
+                     getDriver().CCCIsCXX());
+}
+
 bool BareMetal::handlesTarget(const llvm::Triple &Triple) {
   return isARMBareMetal(Triple);
 }


Index: lib/Driver/ToolChains/BareMetal.h
===================================================================
--- lib/Driver/ToolChains/BareMetal.h
+++ lib/Driver/ToolChains/BareMetal.h
@@ -32,6 +32,7 @@
 
 public:
   bool useIntegratedAs() const override { return true; }
+  bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override;
   bool isCrossCompiling() const override { return true; }
   bool isPICDefault() const override { return false; }
   bool isPIEDefault() const override { return false; }
Index: lib/Driver/ToolChains/BareMetal.cpp
===================================================================
--- lib/Driver/ToolChains/BareMetal.cpp
+++ lib/Driver/ToolChains/BareMetal.cpp
@@ -57,6 +57,14 @@
   return true;
 }
 
+bool BareMetal::IsUnwindTablesDefault(const ArgList &Args) const {
+  // Unwind tables are not emitted in C or if -fno-exceptions is supplied.
+  // For C++ we cannot rely on UWTable because we still need the .exidx section
+  // even if the function does not throw.
+  return Args.hasFlag(options::OPT_fexceptions, options::OPT_fno_exceptions,
+		      getDriver().CCCIsCXX());
+}
+
 bool BareMetal::handlesTarget(const llvm::Triple &Triple) {
   return isARMBareMetal(Triple);
 }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to