aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/arenastring.h
diff options
context:
space:
mode:
authorAdam Cozzette <acozzette@google.com>2017-12-01 10:05:10 -0800
committerAdam Cozzette <acozzette@google.com>2017-12-01 10:05:10 -0800
commit92a7e778e7394386f413cec28d67a07630f784b1 (patch)
treecb5673c7c09b0d3905b48a24765d07e423bc5b30 /src/google/protobuf/arenastring.h
parentce0a53273a400369932ba788d17500336a6ecaad (diff)
downloadprotobuf-92a7e778e7394386f413cec28d67a07630f784b1.tar.gz
protobuf-92a7e778e7394386f413cec28d67a07630f784b1.tar.bz2
protobuf-92a7e778e7394386f413cec28d67a07630f784b1.zip
Integrated internal changes from Google
Diffstat (limited to 'src/google/protobuf/arenastring.h')
-rwxr-xr-xsrc/google/protobuf/arenastring.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/google/protobuf/arenastring.h b/src/google/protobuf/arenastring.h
index c9d045a1..fb1b64a3 100755
--- a/src/google/protobuf/arenastring.h
+++ b/src/google/protobuf/arenastring.h
@@ -51,6 +51,18 @@ namespace google {
namespace protobuf {
namespace internal {
+template <typename T>
+class TaggedPtr {
+ public:
+ void Set(T* p) { ptr_ = reinterpret_cast<uintptr_t>(p); }
+ T* Get() const { return reinterpret_cast<T*>(ptr_); }
+
+ bool IsNull() { return ptr_ == 0; }
+
+ private:
+ uintptr_t ptr_;
+};
+
struct LIBPROTOBUF_EXPORT ArenaStringPtr {
inline void Set(const ::std::string* default_value,
const ::std::string& value, ::google::protobuf::Arena* arena) {
@@ -294,6 +306,15 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr {
return ptr_ == default_value;
}
+ // Internal accessors!!!!
+ void UnsafeSetTaggedPointer(TaggedPtr< ::std::string> value) {
+ ptr_ = value.Get();
+ }
+ // Generated code only! An optimization, in certain cases the generated
+ // code is certain we can obtain a string with no default checks and
+ // tag tests.
+ ::std::string* UnsafeMutablePointer() { return ptr_; }
+
private:
::std::string* ptr_;