diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2018-02-09 03:34:50 +0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2018-02-14 03:55:15 -0500 |
commit | 18d23aa36e7f91bbc8dc6eb5972d2663a3a3df35 (patch) | |
tree | 8f4197a87507e31f26f63ceea3f38df580a968de /src | |
parent | e9ba0cfd46d75d21e9e2359e40710c3ee46a296a (diff) | |
download | android-node-v8-18d23aa36e7f91bbc8dc6eb5972d2663a3a3df35.tar.gz android-node-v8-18d23aa36e7f91bbc8dc6eb5972d2663a3a3df35.tar.bz2 android-node-v8-18d23aa36e7f91bbc8dc6eb5972d2663a3a3df35.zip |
src: do not redefine private for GenDebugSymbols
Redefining private breaks any private inheritance in the
included files. We can simply declare GenDebugSymbols()
as friends in related classes to gain the access that we need.
PR-URL: https://github.com/nodejs/node/pull/18653
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/base_object.h | 1 | ||||
-rw-r--r-- | src/env.h | 1 | ||||
-rw-r--r-- | src/handle_wrap.h | 2 | ||||
-rw-r--r-- | src/node_postmortem_metadata.cc | 54 | ||||
-rw-r--r-- | src/req_wrap.h | 1 | ||||
-rw-r--r-- | src/util.h | 2 |
6 files changed, 7 insertions, 54 deletions
diff --git a/src/base_object.h b/src/base_object.h index 5852f76406..965683d029 100644 --- a/src/base_object.h +++ b/src/base_object.h @@ -70,6 +70,7 @@ class BaseObject { // offsets and generate debug symbols for BaseObject, which assumes that the // position of members in memory are predictable. For more information please // refer to `doc/guides/node-postmortem-support.md` + friend int GenDebugSymbols(); v8::Persistent<v8::Object> persistent_handle_; Environment* env_; }; @@ -782,6 +782,7 @@ class Environment { // symbols for Environment, which assumes that the position of members in // memory are predictable. For more information please refer to // `doc/guides/node-postmortem-support.md` + friend int GenDebugSymbols(); HandleWrapQueue handle_wrap_queue_; ReqWrapQueue req_wrap_queue_; ListHead<HandleCleanup, diff --git a/src/handle_wrap.h b/src/handle_wrap.h index 1cfe3e2ebb..19fd36891a 100644 --- a/src/handle_wrap.h +++ b/src/handle_wrap.h @@ -81,11 +81,13 @@ class HandleWrap : public AsyncWrap { friend class Environment; friend void GetActiveHandles(const v8::FunctionCallbackInfo<v8::Value>&); static void OnClose(uv_handle_t* handle); + // handle_wrap_queue_ needs to be at a fixed offset from the start of the // class because it is used by src/node_postmortem_metadata.cc to calculate // offsets and generate debug symbols for HandleWrap, which assumes that the // position of members in memory are predictable. For more information please // refer to `doc/guides/node-postmortem-support.md` + friend int GenDebugSymbols(); ListNode<HandleWrap> handle_wrap_queue_; enum { kInitialized, kClosing, kClosingWithCallback, kClosed } state_; uv_handle_t* const handle_; diff --git a/src/node_postmortem_metadata.cc b/src/node_postmortem_metadata.cc index 4a463958f5..b335e7fbf8 100644 --- a/src/node_postmortem_metadata.cc +++ b/src/node_postmortem_metadata.cc @@ -1,57 +1,3 @@ -// Need to import standard headers before redefining private, otherwise it -// won't compile. -#include <algorithm> -#include <array> -#include <atomic> -#include <bitset> -#include <cctype> -#include <climits> -#include <cmath> -#include <cstdarg> -#include <cstddef> -#include <cstdint> -#include <cstdio> -#include <cstdlib> -#include <cstring> -#include <ctime> -#include <deque> -#include <exception> -#include <forward_list> -#include <fstream> -#include <functional> -#include <iomanip> -#include <iosfwd> -#include <iostream> -#include <istream> -#include <iterator> -#include <limits> -#include <list> -#include <map> -#include <memory> -#include <new> -#include <ostream> -#include <queue> -#include <set> -#include <sstream> -#include <stack> -#include <streambuf> -#include <string> -#include <tuple> -#include <type_traits> -#include <typeinfo> -#include <unordered_map> -#include <unordered_set> -#include <utility> -#include <vector> - -namespace node { -// Forward declaration needed before redefining private. -int GenDebugSymbols(); -} // namespace node - - -#define private friend int GenDebugSymbols(); private - #include "env.h" #include "base_object-inl.h" #include "handle_wrap.h" diff --git a/src/req_wrap.h b/src/req_wrap.h index 05bc558570..ddd0840aad 100644 --- a/src/req_wrap.h +++ b/src/req_wrap.h @@ -22,6 +22,7 @@ class ReqWrap : public AsyncWrap { private: friend class Environment; + friend int GenDebugSymbols(); ListNode<ReqWrap> req_wrap_queue_; protected: diff --git a/src/util.h b/src/util.h index 47bdf27c30..21c566a4ca 100644 --- a/src/util.h +++ b/src/util.h @@ -159,6 +159,7 @@ class ListNode { private: template <typename U, ListNode<U> (U::*M)> friend class ListHead; + friend int GenDebugSymbols(); ListNode* prev_; ListNode* next_; DISALLOW_COPY_AND_ASSIGN(ListNode); @@ -189,6 +190,7 @@ class ListHead { inline Iterator end() const; private: + friend int GenDebugSymbols(); ListNode<T> head_; DISALLOW_COPY_AND_ASSIGN(ListHead); }; |