zhouyizhou created this revision.
zhouyizhou added a reviewer: libcxx-commits.
zhouyizhou requested review of this revision.
Herald added projects: clang, libc++abi.
Herald added a subscriber: cfe-commits.
Herald added a reviewer: libc++abi.

Some functions in cxa_exception_storage.cpp have incorrect indentation of 
braces,
use clang-format to fix them

Signed-off-by: Zhouyi Zhou <zhouzho...@gmail.com>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109408

Files:
  clang/test/SemaCXX/cxx1z-lambda-star-this.cpp
  clang/test/SemaCXX/cxx20-lambda-decltype-this.cpp
  libcxxabi/src/cxa_exception_storage.cpp

Index: libcxxabi/src/cxa_exception_storage.cpp
===================================================================
--- libcxxabi/src/cxa_exception_storage.cpp
+++ libcxxabi/src/cxa_exception_storage.cpp
@@ -18,28 +18,28 @@
 
 namespace __cxxabiv1 {
 extern "C" {
-    static __cxa_eh_globals eh_globals;
-    __cxa_eh_globals *__cxa_get_globals() { return &eh_globals; }
-    __cxa_eh_globals *__cxa_get_globals_fast() { return &eh_globals; }
-    }
+static __cxa_eh_globals eh_globals;
+__cxa_eh_globals *__cxa_get_globals() { return &eh_globals; }
+__cxa_eh_globals *__cxa_get_globals_fast() { return &eh_globals; }
 }
+} // namespace __cxxabiv1
 
 #elif defined(HAS_THREAD_LOCAL)
 
 namespace __cxxabiv1 {
 
 namespace {
-    __cxa_eh_globals * __globals () {
-        static thread_local __cxa_eh_globals eh_globals;
-        return &eh_globals;
-        }
-    }
+__cxa_eh_globals *__globals() {
+  static thread_local __cxa_eh_globals eh_globals;
+  return &eh_globals;
+}
+} // namespace
 
 extern "C" {
-    __cxa_eh_globals * __cxa_get_globals      () { return __globals (); }
-    __cxa_eh_globals * __cxa_get_globals_fast () { return __globals (); }
-    }
+__cxa_eh_globals *__cxa_get_globals() { return __globals(); }
+__cxa_eh_globals *__cxa_get_globals_fast() { return __globals(); }
 }
+} // namespace __cxxabiv1
 
 #else
 
@@ -56,50 +56,49 @@
 
 namespace __cxxabiv1 {
 namespace {
-    std::__libcpp_tls_key key_;
-    std::__libcpp_exec_once_flag flag_ = _LIBCPP_EXEC_ONCE_INITIALIZER;
-
-    void _LIBCPP_TLS_DESTRUCTOR_CC destruct_ (void *p) {
-        __free_with_fallback ( p );
-        if ( 0 != std::__libcpp_tls_set ( key_, NULL ) )
-            abort_message("cannot zero out thread value for __cxa_get_globals()");
-        }
-
-    void construct_ () {
-        if ( 0 != std::__libcpp_tls_create ( &key_, destruct_ ) )
-            abort_message("cannot create thread specific key for __cxa_get_globals()");
-        }
+std::__libcpp_tls_key key_;
+std::__libcpp_exec_once_flag flag_ = _LIBCPP_EXEC_ONCE_INITIALIZER;
+
+void _LIBCPP_TLS_DESTRUCTOR_CC destruct_(void *p) {
+  __free_with_fallback(p);
+  if (0 != std::__libcpp_tls_set(key_, NULL))
+    abort_message("cannot zero out thread value for __cxa_get_globals()");
 }
 
+void construct_() {
+  if (0 != std::__libcpp_tls_create(&key_, destruct_))
+    abort_message("cannot create thread specific key for __cxa_get_globals()");
+}
+} // namespace
+
 extern "C" {
-    __cxa_eh_globals * __cxa_get_globals () {
-    //  Try to get the globals for this thread
-        __cxa_eh_globals* retVal = __cxa_get_globals_fast ();
-
-    //  If this is the first time we've been asked for these globals, create them
-        if ( NULL == retVal ) {
-            retVal = static_cast<__cxa_eh_globals*>
-                        (__calloc_with_fallback (1, sizeof (__cxa_eh_globals)));
-            if ( NULL == retVal )
-                abort_message("cannot allocate __cxa_eh_globals");
-            if ( 0 != std::__libcpp_tls_set ( key_, retVal ) )
-               abort_message("std::__libcpp_tls_set failure in __cxa_get_globals()");
-           }
-        return retVal;
-        }
-
-    // Note that this implementation will reliably return NULL if not
-    // preceded by a call to __cxa_get_globals().  This is an extension
-    // to the Itanium ABI and is taken advantage of in several places in
-    // libc++abi.
-    __cxa_eh_globals * __cxa_get_globals_fast () {
-    //  First time through, create the key.
-        if (0 != std::__libcpp_execute_once(&flag_, construct_))
-            abort_message("execute once failure in __cxa_get_globals_fast()");
-//        static int init = construct_();
-        return static_cast<__cxa_eh_globals*>(std::__libcpp_tls_get(key_));
-        }
+__cxa_eh_globals *__cxa_get_globals() {
+  //  Try to get the globals for this thread
+  __cxa_eh_globals *retVal = __cxa_get_globals_fast();
+
+  //  If this is the first time we've been asked for these globals, create them
+  if (NULL == retVal) {
+    retVal = static_cast<__cxa_eh_globals *>(
+        __calloc_with_fallback(1, sizeof(__cxa_eh_globals)));
+    if (NULL == retVal)
+      abort_message("cannot allocate __cxa_eh_globals");
+    if (0 != std::__libcpp_tls_set(key_, retVal))
+      abort_message("std::__libcpp_tls_set failure in __cxa_get_globals()");
+  }
+  return retVal;
+}
 
+// Note that this implementation will reliably return NULL if not
+// preceded by a call to __cxa_get_globals().  This is an extension
+// to the Itanium ABI and is taken advantage of in several places in
+// libc++abi.
+__cxa_eh_globals *__cxa_get_globals_fast() {
+  //  First time through, create the key.
+  if (0 != std::__libcpp_execute_once(&flag_, construct_))
+    abort_message("execute once failure in __cxa_get_globals_fast()");
+  //        static int init = construct_();
+  return static_cast<__cxa_eh_globals *>(std::__libcpp_tls_get(key_));
 }
 }
+} // namespace __cxxabiv1
 #endif
Index: clang/test/SemaCXX/cxx20-lambda-decltype-this.cpp
===================================================================
--- clang/test/SemaCXX/cxx20-lambda-decltype-this.cpp
+++ clang/test/SemaCXX/cxx20-lambda-decltype-this.cpp
@@ -5,27 +5,27 @@
 
 namespace PR45881 {
 struct A {
-    void f();
+  void f();
 };
-int id(A*);
+int id(A *);
 void A::f() {
-    auto z = [*this](auto z2, decltype(z2(this)) z3){};
-    z(id,3);
+  auto z = [*this](auto z2, decltype(z2(this)) z3) {};
+  z(id, 3);
 }
 
 struct B {
-    void f();
+  void f();
 };
 void B::f() {
-    auto z = []<typename TT, typename TTT=decltype(TT()(this))>(){return 0;};
-    z.template operator()<int(*)(B*)>();
+  auto z = []<typename TT, typename TTT = decltype(TT()(this))>() { return 0; };
+  z.template operator()<int (*)(B *)>();
 }
 
 struct C {
-    void f();
+  void f();
 };
 void C::f() {
-    auto z = []<typename TT, decltype(TT()(this)) n>(){return 0;};
-    z.template operator()<int(*)(C*), 8>();
+  auto z = []<typename TT, decltype(TT()(this)) n>() { return 0; };
+  z.template operator()<int (*)(C *), 8>();
 }
 } // namespace PR45881
Index: clang/test/SemaCXX/cxx1z-lambda-star-this.cpp
===================================================================
--- clang/test/SemaCXX/cxx1z-lambda-star-this.cpp
+++ clang/test/SemaCXX/cxx1z-lambda-star-this.cpp
@@ -300,11 +300,11 @@
 
 namespace PR45881 {
 struct A {
-    void f();
+  void f();
 };
-int id(A*);
+int id(A *);
 void A::f() {
-    auto z = [*this](auto z2, decltype(z2(this)) z3){};
-    z(id,3);
+  auto z = [*this](auto z2, decltype(z2(this)) z3) {};
+  z(id, 3);
 }
 } // namespace PR45881
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to