aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/compiler
diff options
context:
space:
mode:
authorGravatar xiaofeng@google.com <xiaofeng@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2014-02-13 22:09:48 +0000
committerGravatar xiaofeng@google.com <xiaofeng@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2014-02-13 22:09:48 +0000
commit37c7426b4782ea01f40875b30782ab5ef0ac99b6 (patch)
tree47128be3794fb42501951e637bb9185dba96497f /src/google/protobuf/compiler
parentf0b6a5cfeb5f6347c34975446bda08e0c20c9902 (diff)
Replace kEmptyString wth OnceInit initialized string*
Diffstat (limited to 'src/google/protobuf/compiler')
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_string_field.cc2
-rw-r--r--src/google/protobuf/compiler/plugin.pb.cc30
-rw-r--r--src/google/protobuf/compiler/plugin.pb.h90
3 files changed, 61 insertions, 61 deletions
diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.cc b/src/google/protobuf/compiler/cpp/cpp_string_field.cc
index 9c0911ac..0b58b981 100644
--- a/src/google/protobuf/compiler/cpp/cpp_string_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_string_field.cc
@@ -53,7 +53,7 @@ void SetStringVariables(const FieldDescriptor* descriptor,
(*variables)["default_length"] =
SimpleItoa(descriptor->default_value_string().length());
(*variables)["default_variable"] = descriptor->default_value_string().empty()
- ? "&::google::protobuf::internal::kEmptyString"
+ ? "&::google::protobuf::internal::GetEmptyString()"
: "_default_" + FieldName(descriptor) + "_";
(*variables)["pointer_type"] =
descriptor->type() == FieldDescriptor::TYPE_BYTES ? "void" : "char";
diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc
index ee14dcf7..6525d15c 100644
--- a/src/google/protobuf/compiler/plugin.pb.cc
+++ b/src/google/protobuf/compiler/plugin.pb.cc
@@ -184,7 +184,7 @@ CodeGeneratorRequest::CodeGeneratorRequest(const CodeGeneratorRequest& from)
void CodeGeneratorRequest::SharedCtor() {
_cached_size_ = 0;
- parameter_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+ parameter_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyString());
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
@@ -193,7 +193,7 @@ CodeGeneratorRequest::~CodeGeneratorRequest() {
}
void CodeGeneratorRequest::SharedDtor() {
- if (parameter_ != &::google::protobuf::internal::kEmptyString) {
+ if (parameter_ != &::google::protobuf::internal::GetEmptyString()) {
delete parameter_;
}
if (this != default_instance_) {
@@ -224,7 +224,7 @@ CodeGeneratorRequest* CodeGeneratorRequest::New() const {
void CodeGeneratorRequest::Clear() {
if (_has_bits_[1 / 32] & (0xffu << (1 % 32))) {
if (has_parameter()) {
- if (parameter_ != &::google::protobuf::internal::kEmptyString) {
+ if (parameter_ != &::google::protobuf::internal::GetEmptyString()) {
parameter_->clear();
}
}
@@ -501,9 +501,9 @@ CodeGeneratorResponse_File::CodeGeneratorResponse_File(const CodeGeneratorRespon
void CodeGeneratorResponse_File::SharedCtor() {
_cached_size_ = 0;
- name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
- insertion_point_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
- content_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+ name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyString());
+ insertion_point_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyString());
+ content_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyString());
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
@@ -512,13 +512,13 @@ CodeGeneratorResponse_File::~CodeGeneratorResponse_File() {
}
void CodeGeneratorResponse_File::SharedDtor() {
- if (name_ != &::google::protobuf::internal::kEmptyString) {
+ if (name_ != &::google::protobuf::internal::GetEmptyString()) {
delete name_;
}
- if (insertion_point_ != &::google::protobuf::internal::kEmptyString) {
+ if (insertion_point_ != &::google::protobuf::internal::GetEmptyString()) {
delete insertion_point_;
}
- if (content_ != &::google::protobuf::internal::kEmptyString) {
+ if (content_ != &::google::protobuf::internal::GetEmptyString()) {
delete content_;
}
if (this != default_instance_) {
@@ -549,17 +549,17 @@ CodeGeneratorResponse_File* CodeGeneratorResponse_File::New() const {
void CodeGeneratorResponse_File::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_name()) {
- if (name_ != &::google::protobuf::internal::kEmptyString) {
+ if (name_ != &::google::protobuf::internal::GetEmptyString()) {
name_->clear();
}
}
if (has_insertion_point()) {
- if (insertion_point_ != &::google::protobuf::internal::kEmptyString) {
+ if (insertion_point_ != &::google::protobuf::internal::GetEmptyString()) {
insertion_point_->clear();
}
}
if (has_content()) {
- if (content_ != &::google::protobuf::internal::kEmptyString) {
+ if (content_ != &::google::protobuf::internal::GetEmptyString()) {
content_->clear();
}
}
@@ -839,7 +839,7 @@ CodeGeneratorResponse::CodeGeneratorResponse(const CodeGeneratorResponse& from)
void CodeGeneratorResponse::SharedCtor() {
_cached_size_ = 0;
- error_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+ error_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyString());
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
@@ -848,7 +848,7 @@ CodeGeneratorResponse::~CodeGeneratorResponse() {
}
void CodeGeneratorResponse::SharedDtor() {
- if (error_ != &::google::protobuf::internal::kEmptyString) {
+ if (error_ != &::google::protobuf::internal::GetEmptyString()) {
delete error_;
}
if (this != default_instance_) {
@@ -879,7 +879,7 @@ CodeGeneratorResponse* CodeGeneratorResponse::New() const {
void CodeGeneratorResponse::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_error()) {
- if (error_ != &::google::protobuf::internal::kEmptyString) {
+ if (error_ != &::google::protobuf::internal::GetEmptyString()) {
error_->clear();
}
}
diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h
index d0db53d1..d26a135e 100644
--- a/src/google/protobuf/compiler/plugin.pb.h
+++ b/src/google/protobuf/compiler/plugin.pb.h
@@ -438,7 +438,7 @@ inline void CodeGeneratorRequest::clear_has_parameter() {
_has_bits_[0] &= ~0x00000002u;
}
inline void CodeGeneratorRequest::clear_parameter() {
- if (parameter_ != &::google::protobuf::internal::kEmptyString) {
+ if (parameter_ != &::google::protobuf::internal::GetEmptyString()) {
parameter_->clear();
}
clear_has_parameter();
@@ -448,44 +448,44 @@ inline const ::std::string& CodeGeneratorRequest::parameter() const {
}
inline void CodeGeneratorRequest::set_parameter(const ::std::string& value) {
set_has_parameter();
- if (parameter_ == &::google::protobuf::internal::kEmptyString) {
+ if (parameter_ == &::google::protobuf::internal::GetEmptyString()) {
parameter_ = new ::std::string;
}
parameter_->assign(value);
}
inline void CodeGeneratorRequest::set_parameter(const char* value) {
set_has_parameter();
- if (parameter_ == &::google::protobuf::internal::kEmptyString) {
+ if (parameter_ == &::google::protobuf::internal::GetEmptyString()) {
parameter_ = new ::std::string;
}
parameter_->assign(value);
}
inline void CodeGeneratorRequest::set_parameter(const char* value, size_t size) {
set_has_parameter();
- if (parameter_ == &::google::protobuf::internal::kEmptyString) {
+ if (parameter_ == &::google::protobuf::internal::GetEmptyString()) {
parameter_ = new ::std::string;
}
parameter_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* CodeGeneratorRequest::mutable_parameter() {
set_has_parameter();
- if (parameter_ == &::google::protobuf::internal::kEmptyString) {
+ if (parameter_ == &::google::protobuf::internal::GetEmptyString()) {
parameter_ = new ::std::string;
}
return parameter_;
}
inline ::std::string* CodeGeneratorRequest::release_parameter() {
clear_has_parameter();
- if (parameter_ == &::google::protobuf::internal::kEmptyString) {
+ if (parameter_ == &::google::protobuf::internal::GetEmptyString()) {
return NULL;
} else {
::std::string* temp = parameter_;
- parameter_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+ parameter_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyString());
return temp;
}
}
inline void CodeGeneratorRequest::set_allocated_parameter(::std::string* parameter) {
- if (parameter_ != &::google::protobuf::internal::kEmptyString) {
+ if (parameter_ != &::google::protobuf::internal::GetEmptyString()) {
delete parameter_;
}
if (parameter) {
@@ -493,7 +493,7 @@ inline void CodeGeneratorRequest::set_allocated_parameter(::std::string* paramet
parameter_ = parameter;
} else {
clear_has_parameter();
- parameter_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+ parameter_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyString());
}
}
@@ -537,7 +537,7 @@ inline void CodeGeneratorResponse_File::clear_has_name() {
_has_bits_[0] &= ~0x00000001u;
}
inline void CodeGeneratorResponse_File::clear_name() {
- if (name_ != &::google::protobuf::internal::kEmptyString) {
+ if (name_ != &::google::protobuf::internal::GetEmptyString()) {
name_->clear();
}
clear_has_name();
@@ -547,44 +547,44 @@ inline const ::std::string& CodeGeneratorResponse_File::name() const {
}
inline void CodeGeneratorResponse_File::set_name(const ::std::string& value) {
set_has_name();
- if (name_ == &::google::protobuf::internal::kEmptyString) {
+ if (name_ == &::google::protobuf::internal::GetEmptyString()) {
name_ = new ::std::string;
}
name_->assign(value);
}
inline void CodeGeneratorResponse_File::set_name(const char* value) {
set_has_name();
- if (name_ == &::google::protobuf::internal::kEmptyString) {
+ if (name_ == &::google::protobuf::internal::GetEmptyString()) {
name_ = new ::std::string;
}
name_->assign(value);
}
inline void CodeGeneratorResponse_File::set_name(const char* value, size_t size) {
set_has_name();
- if (name_ == &::google::protobuf::internal::kEmptyString) {
+ if (name_ == &::google::protobuf::internal::GetEmptyString()) {
name_ = new ::std::string;
}
name_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* CodeGeneratorResponse_File::mutable_name() {
set_has_name();
- if (name_ == &::google::protobuf::internal::kEmptyString) {
+ if (name_ == &::google::protobuf::internal::GetEmptyString()) {
name_ = new ::std::string;
}
return name_;
}
inline ::std::string* CodeGeneratorResponse_File::release_name() {
clear_has_name();
- if (name_ == &::google::protobuf::internal::kEmptyString) {
+ if (name_ == &::google::protobuf::internal::GetEmptyString()) {
return NULL;
} else {
::std::string* temp = name_;
- name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+ name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyString());
return temp;
}
}
inline void CodeGeneratorResponse_File::set_allocated_name(::std::string* name) {
- if (name_ != &::google::protobuf::internal::kEmptyString) {
+ if (name_ != &::google::protobuf::internal::GetEmptyString()) {
delete name_;
}
if (name) {
@@ -592,7 +592,7 @@ inline void CodeGeneratorResponse_File::set_allocated_name(::std::string* name)
name_ = name;
} else {
clear_has_name();
- name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+ name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyString());
}
}
@@ -607,7 +607,7 @@ inline void CodeGeneratorResponse_File::clear_has_insertion_point() {
_has_bits_[0] &= ~0x00000002u;
}
inline void CodeGeneratorResponse_File::clear_insertion_point() {
- if (insertion_point_ != &::google::protobuf::internal::kEmptyString) {
+ if (insertion_point_ != &::google::protobuf::internal::GetEmptyString()) {
insertion_point_->clear();
}
clear_has_insertion_point();
@@ -617,44 +617,44 @@ inline const ::std::string& CodeGeneratorResponse_File::insertion_point() const
}
inline void CodeGeneratorResponse_File::set_insertion_point(const ::std::string& value) {
set_has_insertion_point();
- if (insertion_point_ == &::google::protobuf::internal::kEmptyString) {
+ if (insertion_point_ == &::google::protobuf::internal::GetEmptyString()) {
insertion_point_ = new ::std::string;
}
insertion_point_->assign(value);
}
inline void CodeGeneratorResponse_File::set_insertion_point(const char* value) {
set_has_insertion_point();
- if (insertion_point_ == &::google::protobuf::internal::kEmptyString) {
+ if (insertion_point_ == &::google::protobuf::internal::GetEmptyString()) {
insertion_point_ = new ::std::string;
}
insertion_point_->assign(value);
}
inline void CodeGeneratorResponse_File::set_insertion_point(const char* value, size_t size) {
set_has_insertion_point();
- if (insertion_point_ == &::google::protobuf::internal::kEmptyString) {
+ if (insertion_point_ == &::google::protobuf::internal::GetEmptyString()) {
insertion_point_ = new ::std::string;
}
insertion_point_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* CodeGeneratorResponse_File::mutable_insertion_point() {
set_has_insertion_point();
- if (insertion_point_ == &::google::protobuf::internal::kEmptyString) {
+ if (insertion_point_ == &::google::protobuf::internal::GetEmptyString()) {
insertion_point_ = new ::std::string;
}
return insertion_point_;
}
inline ::std::string* CodeGeneratorResponse_File::release_insertion_point() {
clear_has_insertion_point();
- if (insertion_point_ == &::google::protobuf::internal::kEmptyString) {
+ if (insertion_point_ == &::google::protobuf::internal::GetEmptyString()) {
return NULL;
} else {
::std::string* temp = insertion_point_;
- insertion_point_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+ insertion_point_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyString());
return temp;
}
}
inline void CodeGeneratorResponse_File::set_allocated_insertion_point(::std::string* insertion_point) {
- if (insertion_point_ != &::google::protobuf::internal::kEmptyString) {
+ if (insertion_point_ != &::google::protobuf::internal::GetEmptyString()) {
delete insertion_point_;
}
if (insertion_point) {
@@ -662,7 +662,7 @@ inline void CodeGeneratorResponse_File::set_allocated_insertion_point(::std::str
insertion_point_ = insertion_point;
} else {
clear_has_insertion_point();
- insertion_point_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+ insertion_point_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyString());
}
}
@@ -677,7 +677,7 @@ inline void CodeGeneratorResponse_File::clear_has_content() {
_has_bits_[0] &= ~0x00000004u;
}
inline void CodeGeneratorResponse_File::clear_content() {
- if (content_ != &::google::protobuf::internal::kEmptyString) {
+ if (content_ != &::google::protobuf::internal::GetEmptyString()) {
content_->clear();
}
clear_has_content();
@@ -687,44 +687,44 @@ inline const ::std::string& CodeGeneratorResponse_File::content() const {
}
inline void CodeGeneratorResponse_File::set_content(const ::std::string& value) {
set_has_content();
- if (content_ == &::google::protobuf::internal::kEmptyString) {
+ if (content_ == &::google::protobuf::internal::GetEmptyString()) {
content_ = new ::std::string;
}
content_->assign(value);
}
inline void CodeGeneratorResponse_File::set_content(const char* value) {
set_has_content();
- if (content_ == &::google::protobuf::internal::kEmptyString) {
+ if (content_ == &::google::protobuf::internal::GetEmptyString()) {
content_ = new ::std::string;
}
content_->assign(value);
}
inline void CodeGeneratorResponse_File::set_content(const char* value, size_t size) {
set_has_content();
- if (content_ == &::google::protobuf::internal::kEmptyString) {
+ if (content_ == &::google::protobuf::internal::GetEmptyString()) {
content_ = new ::std::string;
}
content_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* CodeGeneratorResponse_File::mutable_content() {
set_has_content();
- if (content_ == &::google::protobuf::internal::kEmptyString) {
+ if (content_ == &::google::protobuf::internal::GetEmptyString()) {
content_ = new ::std::string;
}
return content_;
}
inline ::std::string* CodeGeneratorResponse_File::release_content() {
clear_has_content();
- if (content_ == &::google::protobuf::internal::kEmptyString) {
+ if (content_ == &::google::protobuf::internal::GetEmptyString()) {
return NULL;
} else {
::std::string* temp = content_;
- content_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+ content_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyString());
return temp;
}
}
inline void CodeGeneratorResponse_File::set_allocated_content(::std::string* content) {
- if (content_ != &::google::protobuf::internal::kEmptyString) {
+ if (content_ != &::google::protobuf::internal::GetEmptyString()) {
delete content_;
}
if (content) {
@@ -732,7 +732,7 @@ inline void CodeGeneratorResponse_File::set_allocated_content(::std::string* con
content_ = content;
} else {
clear_has_content();
- content_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+ content_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyString());
}
}
@@ -751,7 +751,7 @@ inline void CodeGeneratorResponse::clear_has_error() {
_has_bits_[0] &= ~0x00000001u;
}
inline void CodeGeneratorResponse::clear_error() {
- if (error_ != &::google::protobuf::internal::kEmptyString) {
+ if (error_ != &::google::protobuf::internal::GetEmptyString()) {
error_->clear();
}
clear_has_error();
@@ -761,44 +761,44 @@ inline const ::std::string& CodeGeneratorResponse::error() const {
}
inline void CodeGeneratorResponse::set_error(const ::std::string& value) {
set_has_error();
- if (error_ == &::google::protobuf::internal::kEmptyString) {
+ if (error_ == &::google::protobuf::internal::GetEmptyString()) {
error_ = new ::std::string;
}
error_->assign(value);
}
inline void CodeGeneratorResponse::set_error(const char* value) {
set_has_error();
- if (error_ == &::google::protobuf::internal::kEmptyString) {
+ if (error_ == &::google::protobuf::internal::GetEmptyString()) {
error_ = new ::std::string;
}
error_->assign(value);
}
inline void CodeGeneratorResponse::set_error(const char* value, size_t size) {
set_has_error();
- if (error_ == &::google::protobuf::internal::kEmptyString) {
+ if (error_ == &::google::protobuf::internal::GetEmptyString()) {
error_ = new ::std::string;
}
error_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* CodeGeneratorResponse::mutable_error() {
set_has_error();
- if (error_ == &::google::protobuf::internal::kEmptyString) {
+ if (error_ == &::google::protobuf::internal::GetEmptyString()) {
error_ = new ::std::string;
}
return error_;
}
inline ::std::string* CodeGeneratorResponse::release_error() {
clear_has_error();
- if (error_ == &::google::protobuf::internal::kEmptyString) {
+ if (error_ == &::google::protobuf::internal::GetEmptyString()) {
return NULL;
} else {
::std::string* temp = error_;
- error_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+ error_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyString());
return temp;
}
}
inline void CodeGeneratorResponse::set_allocated_error(::std::string* error) {
- if (error_ != &::google::protobuf::internal::kEmptyString) {
+ if (error_ != &::google::protobuf::internal::GetEmptyString()) {
delete error_;
}
if (error) {
@@ -806,7 +806,7 @@ inline void CodeGeneratorResponse::set_allocated_error(::std::string* error) {
error_ = error;
} else {
clear_has_error();
- error_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+ error_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyString());
}
}