Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: third_party/protobuf/src/google/protobuf/has_bits.h

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Update to new HEAD (b7632464b4) + restore GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/protobuf/src/google/protobuf/has_bits.h
diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_options.h b/third_party/protobuf/src/google/protobuf/has_bits.h
similarity index 66%
copy from third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_options.h
copy to third_party/protobuf/src/google/protobuf/has_bits.h
index ab1d2ed38a8cae99ac01a7ddd8ae1285da27f36e..133bc02a2dd5919757fb310e65bff5bbb02a3f74 100644
--- a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_options.h
+++ b/third_party/protobuf/src/google/protobuf/has_bits.h
@@ -28,40 +28,45 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Author: rennie@google.com (Jeffrey Rennie)
-
-#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_OPTIONS_H__
-#define GOOGLE_PROTOBUF_COMPILER_CPP_OPTIONS_H__
-
-#include <string>
+#ifndef GOOGLE_PROTOBUF_HAS_BITS_H__
+#define GOOGLE_PROTOBUF_HAS_BITS_H__
#include <google/protobuf/stubs/common.h>
+
namespace google {
namespace protobuf {
-namespace compiler {
-namespace cpp {
+namespace internal {
+
+template<size_t doublewords>
+class HasBits {
+ public:
+ HasBits() GOOGLE_ATTRIBUTE_ALWAYS_INLINE { Clear(); }
-// Generator options (see generator.cc for a description of each):
-struct Options {
- Options()
- : safe_boundary_check(false),
- proto_h(false),
- annotate_headers(false),
- enforce_lite(false) {}
+ void Clear() GOOGLE_ATTRIBUTE_ALWAYS_INLINE {
+ memset(has_bits_, 0, sizeof(has_bits_));
+ }
- string dllexport_decl;
- bool safe_boundary_check;
- bool proto_h;
- bool annotate_headers;
- bool enforce_lite;
- string annotation_pragma_name;
- string annotation_guard_name;
+ ::google::protobuf::uint32& operator[](int index) GOOGLE_ATTRIBUTE_ALWAYS_INLINE {
+ return has_bits_[index];
+ }
+
+ const ::google::protobuf::uint32& operator[](int index) const GOOGLE_ATTRIBUTE_ALWAYS_INLINE {
+ return has_bits_[index];
+ }
+
+ bool operator==(const HasBits<doublewords>& rhs) const {
+ return memcmp(has_bits_, rhs.has_bits_, sizeof(has_bits_)) == 0;
+ }
+
+ bool operator!=(const HasBits<doublewords>& rhs) const {
+ return !(*this == rhs);
+ }
+ private:
+ ::google::protobuf::uint32 has_bits_[doublewords];
};
-} // namespace cpp
-} // namespace compiler
+} // namespace internal
} // namespace protobuf
-
} // namespace google
-#endif // GOOGLE_PROTOBUF_COMPILER_CPP_OPTIONS_H__
+#endif // GOOGLE_PROTOBUF_HAS_BITS_H__

Powered by Google App Engine
This is Rietveld 408576698