[ObjC] Run clang-format on the ObjC Generator headers.

pull/10736/head
Thomas Van Lenten 2 years ago
parent c62cc5d8bc
commit fbac066078
  1. 3
      src/google/protobuf/compiler/objectivec/enum.h
  2. 1
      src/google/protobuf/compiler/objectivec/enum_field.h
  3. 25
      src/google/protobuf/compiler/objectivec/field.h
  4. 4
      src/google/protobuf/compiler/objectivec/file.h
  5. 1
      src/google/protobuf/compiler/objectivec/generator.h
  6. 4
      src/google/protobuf/compiler/objectivec/helpers.h
  7. 9
      src/google/protobuf/compiler/objectivec/import_writer.h
  8. 3
      src/google/protobuf/compiler/objectivec/line_consumer.h
  9. 3
      src/google/protobuf/compiler/objectivec/message.h
  10. 3
      src/google/protobuf/compiler/objectivec/message_field.h
  11. 16
      src/google/protobuf/compiler/objectivec/names.h
  12. 378
      src/google/protobuf/compiler/objectivec/nsobject_methods.h
  13. 3
      src/google/protobuf/compiler/objectivec/primitive_field.h
  14. 1
      src/google/protobuf/compiler/objectivec/text_format_decode_data.h

@ -31,9 +31,10 @@
#ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ENUM_H__
#define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ENUM_H__
#include <string>
#include <set>
#include <string>
#include <vector>
#include "google/protobuf/descriptor.h"
#include "google/protobuf/io/printer.h"

@ -33,6 +33,7 @@
#include <map>
#include <string>
#include "google/protobuf/compiler/objectivec/field.h"
namespace google {

@ -33,6 +33,7 @@
#include <map>
#include <string>
#include "google/protobuf/descriptor.h"
#include "google/protobuf/io/printer.h"
@ -63,15 +64,14 @@ class FieldGenerator {
virtual void GenerateCFunctionImplementations(io::Printer* printer) const;
// Exposed for subclasses, should always call it on the parent class also.
virtual void DetermineForwardDeclarations(
std::set<std::string>* fwd_decls,
bool include_external_types) const;
virtual void DetermineForwardDeclarations(std::set<std::string>* fwd_decls,
bool include_external_types) const;
virtual void DetermineObjectiveCClassDefinitions(
std::set<std::string>* fwd_decls) const;
// Used during generation, not intended to be extended by subclasses.
void GenerateFieldDescription(
io::Printer* printer, bool include_default) const;
void GenerateFieldDescription(io::Printer* printer,
bool include_default) const;
void GenerateFieldNumberConstant(io::Printer* printer) const;
// Exposed to get and set the has bits information.
@ -111,10 +111,12 @@ class SingleFieldGenerator : public FieldGenerator {
SingleFieldGenerator(const SingleFieldGenerator&) = delete;
SingleFieldGenerator& operator=(const SingleFieldGenerator&) = delete;
virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const override;
virtual void GenerateFieldStorageDeclaration(
io::Printer* printer) const override;
virtual void GeneratePropertyDeclaration(io::Printer* printer) const override;
virtual void GeneratePropertyImplementation(io::Printer* printer) const override;
virtual void GeneratePropertyImplementation(
io::Printer* printer) const override;
virtual bool RuntimeUsesHasBit(void) const override;
@ -130,7 +132,8 @@ class ObjCObjFieldGenerator : public SingleFieldGenerator {
ObjCObjFieldGenerator(const ObjCObjFieldGenerator&) = delete;
ObjCObjFieldGenerator& operator=(const ObjCObjFieldGenerator&) = delete;
virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const override;
virtual void GenerateFieldStorageDeclaration(
io::Printer* printer) const override;
virtual void GeneratePropertyDeclaration(io::Printer* printer) const override;
protected:
@ -144,10 +147,12 @@ class RepeatedFieldGenerator : public ObjCObjFieldGenerator {
RepeatedFieldGenerator(const RepeatedFieldGenerator&) = delete;
RepeatedFieldGenerator& operator=(const RepeatedFieldGenerator&) = delete;
virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const override;
virtual void GenerateFieldStorageDeclaration(
io::Printer* printer) const override;
virtual void GeneratePropertyDeclaration(io::Printer* printer) const override;
virtual void GeneratePropertyImplementation(io::Printer* printer) const override;
virtual void GeneratePropertyImplementation(
io::Printer* printer) const override;
virtual bool RuntimeUsesHasBit(void) const override;

@ -35,6 +35,7 @@
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include "google/protobuf/compiler/objectivec/options.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/io/printer.h"
@ -66,7 +67,8 @@ class FileGenerator {
// have extensions.
std::unordered_set<const FileDescriptor*> covered_deps;
};
const MinDepsEntry& CollectMinimalFileDepsContainingExtensionsInternal(const FileDescriptor* file);
const MinDepsEntry& CollectMinimalFileDepsContainingExtensionsInternal(
const FileDescriptor* file);
std::unordered_map<const FileDescriptor*, MinDepsEntry> deps_info_cache_;
};

@ -34,6 +34,7 @@
#define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_GENERATOR_H__
#include <string>
#include "google/protobuf/compiler/code_generator.h"
#include "google/protobuf/descriptor.h"

@ -104,7 +104,8 @@ inline bool IsReferenceType(const FieldDescriptor* field) {
std::string GPBGenericValueFieldName(const FieldDescriptor* field);
std::string DefaultValue(const FieldDescriptor* field);
std::string BuildFlagsString(const FlagType type, const std::vector<std::string>& strings);
std::string BuildFlagsString(const FlagType type,
const std::vector<std::string>& strings);
// Returns a symbol that can be used in C code to refer to an Objective C
// class without initializing the class.
@ -156,7 +157,6 @@ std::string GetOptionalDeprecatedAttribute(const TDescriptor* descriptor,
}
}
} // namespace objectivec
} // namespace compiler
} // namespace protobuf

@ -55,10 +55,10 @@ class ImportWriter {
void AddFile(const FileDescriptor* file, const std::string& header_extension);
void Print(io::Printer* printer) const;
static void PrintRuntimeImports(io::Printer* printer,
const std::vector<std::string>& header_to_import,
const std::string& runtime_import_prefix,
bool default_cpp_symbol = false);
static void PrintRuntimeImports(
io::Printer* printer, const std::vector<std::string>& header_to_import,
const std::string& runtime_import_prefix,
bool default_cpp_symbol = false);
private:
void ParseFrameworkMappings();
@ -75,7 +75,6 @@ class ImportWriter {
std::vector<std::string> other_imports_;
};
} // namespace objectivec
} // namespace compiler
} // namespace protobuf

@ -52,7 +52,8 @@ class PROTOC_EXPORT LineConsumer {
public:
LineConsumer();
virtual ~LineConsumer();
virtual bool ConsumeLine(const absl::string_view& line, std::string* out_error) = 0;
virtual bool ConsumeLine(const absl::string_view& line,
std::string* out_error) = 0;
};
bool PROTOC_EXPORT ParseSimpleFile(const std::string& path,

@ -31,9 +31,10 @@
#ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_MESSAGE_H__
#define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_MESSAGE_H__
#include <string>
#include <set>
#include <string>
#include <vector>
#include "google/protobuf/compiler/objectivec/field.h"
#include "google/protobuf/compiler/objectivec/oneof.h"
#include "google/protobuf/descriptor.h"

@ -68,7 +68,8 @@ class RepeatedMessageFieldGenerator : public RepeatedFieldGenerator {
virtual ~RepeatedMessageFieldGenerator();
RepeatedMessageFieldGenerator(const RepeatedMessageFieldGenerator&) = delete;
RepeatedMessageFieldGenerator operator=(const RepeatedMessageFieldGenerator&) = delete;
RepeatedMessageFieldGenerator operator=(
const RepeatedMessageFieldGenerator&) = delete;
public:
virtual void DetermineForwardDeclarations(

@ -49,8 +49,7 @@ namespace objectivec {
// Get/Set the path to a file to load for objc class prefix lookups.
std::string PROTOC_EXPORT GetPackageToPrefixMappingsPath();
void PROTOC_EXPORT SetPackageToPrefixMappingsPath(
const std::string& file_path);
void PROTOC_EXPORT SetPackageToPrefixMappingsPath(const std::string& file_path);
// Get/Set if the proto package should be used to make the default prefix for
// symbols. This will then impact most of the type naming apis below. It is done
// as a global to not break any other generator reusing the methods since they
@ -61,8 +60,8 @@ void PROTOC_EXPORT SetUseProtoPackageAsDefaultPrefix(bool on_or_off);
// `UseProtoPackageAsDefaultPrefix()` is `true`. An empty string means there
// should be no exceptions.
std::string PROTOC_EXPORT GetProtoPackagePrefixExceptionList();
void PROTOC_EXPORT SetProtoPackagePrefixExceptionList(
const std::string& file_path);
void PROTOC_EXPORT
SetProtoPackagePrefixExceptionList(const std::string& file_path);
// Get/Set a prefix to add before the prefix generated from the package name.
// This is only used when UseProtoPackageAsDefaultPrefix() is True.
std::string PROTOC_EXPORT GetForcedPackagePrefix();
@ -108,14 +107,16 @@ std::string PROTOC_EXPORT EnumName(const EnumDescriptor* descriptor);
std::string PROTOC_EXPORT EnumValueName(const EnumValueDescriptor* descriptor);
// Returns the name of the enum value corresponding to the descriptor.
std::string PROTOC_EXPORT EnumValueShortName(const EnumValueDescriptor* descriptor);
std::string PROTOC_EXPORT
EnumValueShortName(const EnumValueDescriptor* descriptor);
// Reverse what an enum does.
std::string PROTOC_EXPORT UnCamelCaseEnumShortName(const std::string& name);
// Returns the name to use for the extension (used as the method off the file's
// Root class).
std::string PROTOC_EXPORT ExtensionMethodName(const FieldDescriptor* descriptor);
std::string PROTOC_EXPORT
ExtensionMethodName(const FieldDescriptor* descriptor);
// Returns the transformed field name.
std::string PROTOC_EXPORT FieldName(const FieldDescriptor* field);
@ -124,7 +125,8 @@ std::string PROTOC_EXPORT FieldNameCapitalized(const FieldDescriptor* field);
// Returns the transformed oneof name.
std::string PROTOC_EXPORT OneofEnumName(const OneofDescriptor* descriptor);
std::string PROTOC_EXPORT OneofName(const OneofDescriptor* descriptor);
std::string PROTOC_EXPORT OneofNameCapitalized(const OneofDescriptor* descriptor);
std::string PROTOC_EXPORT
OneofNameCapitalized(const OneofDescriptor* descriptor);
// Reverse of the above.
std::string PROTOC_EXPORT UnCamelCaseFieldName(const std::string& name,

@ -5,193 +5,193 @@
// iOS: iPhoneSimulator12.1.sdk
const char* const kNSObjectMethodsList[] = {
"CAMLType",
"CA_copyRenderValue",
"CA_prepareRenderValue",
"NS_copyCGImage",
"NS_tiledLayerVisibleRect",
"___tryRetain_OA",
"__autorelease_OA",
"__dealloc_zombie",
"__release_OA",
"__retain_OA",
"_accessibilityFinalize",
"_accessibilityIsTableViewDescendant",
"_accessibilityUIElementSpecifier",
"_accessibilityUseConvenienceAPI",
"_allowsDirectEncoding",
"_asScriptTerminologyNameArray",
"_asScriptTerminologyNameString",
"_bindingAdaptor",
"_cfTypeID",
"_copyDescription",
"_destroyObserverList",
"_didEndKeyValueObserving",
"_implicitObservationInfo",
"_internalAccessibilityAttributedHint",
"_internalAccessibilityAttributedLabel",
"_internalAccessibilityAttributedValue",
"_isAXConnector",
"_isAccessibilityContainerSectionCandidate",
"_isAccessibilityContentNavigatorSectionCandidate",
"_isAccessibilityContentSectionCandidate",
"_isAccessibilityTopLevelNavigatorSectionCandidate",
"_isDeallocating",
"_isKVOA",
"_isToManyChangeInformation",
"_ivarDescription",
"_localClassNameForClass",
"_methodDescription",
"_observerStorage",
"_overrideUseFastBlockObservers",
"_propertyDescription",
"_releaseBindingAdaptor",
"_scriptingCount",
"_scriptingCountNonrecursively",
"_scriptingDebugDescription",
"_scriptingExists",
"_scriptingShouldCheckObjectIndexes",
"_shortMethodDescription",
"_shouldSearchChildrenForSection",
"_traitStorageList",
"_tryRetain",
"_ui_descriptionBuilder",
"_uikit_variesByTraitCollections",
"_web_description",
"_webkit_invokeOnMainThread",
"_willBeginKeyValueObserving",
"accessibilityActivate",
"accessibilityActivationPoint",
"accessibilityAllowsOverriddenAttributesWhenIgnored",
"accessibilityAssistiveTechnologyFocusedIdentifiers",
"accessibilityAttributedHint",
"accessibilityAttributedLabel",
"accessibilityAttributedValue",
"accessibilityContainer",
"accessibilityContainerType",
"accessibilityCustomActions",
"accessibilityCustomRotors",
"accessibilityDecrement",
"accessibilityDragSourceDescriptors",
"accessibilityDropPointDescriptors",
"accessibilityElementCount",
"accessibilityElementDidBecomeFocused",
"accessibilityElementDidLoseFocus",
"accessibilityElementIsFocused",
"accessibilityElements",
"accessibilityElementsHidden",
"accessibilityFrame",
"accessibilityHeaderElements",
"accessibilityHint",
"accessibilityIdentification",
"accessibilityIdentifier",
"accessibilityIncrement",
"accessibilityLabel",
"accessibilityLanguage",
"accessibilityLocalizedStringKey",
"accessibilityNavigationStyle",
"accessibilityOverriddenAttributes",
"accessibilityParameterizedAttributeNames",
"accessibilityPath",
"accessibilityPerformEscape",
"accessibilityPerformMagicTap",
"accessibilityPresenterProcessIdentifier",
"accessibilityShouldUseUniqueId",
"accessibilitySupportsNotifications",
"accessibilitySupportsOverriddenAttributes",
"accessibilityTemporaryChildren",
"accessibilityTraits",
"accessibilityValue",
"accessibilityViewIsModal",
"accessibilityVisibleArea",
"allPropertyKeys",
"allowsWeakReference",
"attributeKeys",
"autoContentAccessingProxy",
"autorelease",
"awakeFromNib",
"boolValueSafe",
"bs_encoded",
"bs_isPlistableType",
"bs_secureEncoded",
"cl_json_serializeKey",
"class",
"classCode",
"classDescription",
"classForArchiver",
"classForCoder",
"classForKeyedArchiver",
"classForPortCoder",
"className",
"clearProperties",
"copy",
"dealloc",
"debugDescription",
"defaultAccessibilityTraits",
"description",
"doubleValueSafe",
"entityName",
"exposedBindings",
"finalize",
"finishObserving",
"flushKeyBindings",
"hash",
"init",
"int64ValueSafe",
"isAccessibilityElement",
"isAccessibilityElementByDefault",
"isElementAccessibilityExposedToInterfaceBuilder",
"isFault",
"isNSArray__",
"isNSCFConstantString__",
"isNSData__",
"isNSDate__",
"isNSDictionary__",
"isNSNumber__",
"isNSObject__",
"isNSOrderedSet__",
"isNSSet__",
"isNSString__",
"isNSTimeZone__",
"isNSValue__",
"isProxy",
"mutableCopy",
"nilValueForKey",
"objectSpecifier",
"observationInfo",
"pep_onDetachedThread",
"pep_onMainThread",
"pep_onMainThreadIfNecessary",
"prepareForInterfaceBuilder",
"release",
"releaseOnMainThread",
"retain",
"retainCount",
"retainWeakReference",
"scriptingProperties",
"self",
"shouldGroupAccessibilityChildren",
"storedAccessibilityActivationPoint",
"storedAccessibilityContainerType",
"storedAccessibilityElementsHidden",
"storedAccessibilityFrame",
"storedAccessibilityNavigationStyle",
"storedAccessibilityTraits",
"storedAccessibilityViewIsModal",
"storedIsAccessibilityElement",
"storedShouldGroupAccessibilityChildren",
"stringValueSafe",
"superclass",
"toManyRelationshipKeys",
"toOneRelationshipKeys",
"traitStorageList",
"un_safeBoolValue",
"userInterfaceItemIdentifier",
"utf8ValueSafe",
"valuesForKeysWithDictionary",
"zone",
// Protocol: CAAnimatableValue
// Protocol: CARenderValue
// Protocol: NSObject
// Protocol: ROCKRemoteInvocationInterface
"CAMLType",
"CA_copyRenderValue",
"CA_prepareRenderValue",
"NS_copyCGImage",
"NS_tiledLayerVisibleRect",
"___tryRetain_OA",
"__autorelease_OA",
"__dealloc_zombie",
"__release_OA",
"__retain_OA",
"_accessibilityFinalize",
"_accessibilityIsTableViewDescendant",
"_accessibilityUIElementSpecifier",
"_accessibilityUseConvenienceAPI",
"_allowsDirectEncoding",
"_asScriptTerminologyNameArray",
"_asScriptTerminologyNameString",
"_bindingAdaptor",
"_cfTypeID",
"_copyDescription",
"_destroyObserverList",
"_didEndKeyValueObserving",
"_implicitObservationInfo",
"_internalAccessibilityAttributedHint",
"_internalAccessibilityAttributedLabel",
"_internalAccessibilityAttributedValue",
"_isAXConnector",
"_isAccessibilityContainerSectionCandidate",
"_isAccessibilityContentNavigatorSectionCandidate",
"_isAccessibilityContentSectionCandidate",
"_isAccessibilityTopLevelNavigatorSectionCandidate",
"_isDeallocating",
"_isKVOA",
"_isToManyChangeInformation",
"_ivarDescription",
"_localClassNameForClass",
"_methodDescription",
"_observerStorage",
"_overrideUseFastBlockObservers",
"_propertyDescription",
"_releaseBindingAdaptor",
"_scriptingCount",
"_scriptingCountNonrecursively",
"_scriptingDebugDescription",
"_scriptingExists",
"_scriptingShouldCheckObjectIndexes",
"_shortMethodDescription",
"_shouldSearchChildrenForSection",
"_traitStorageList",
"_tryRetain",
"_ui_descriptionBuilder",
"_uikit_variesByTraitCollections",
"_web_description",
"_webkit_invokeOnMainThread",
"_willBeginKeyValueObserving",
"accessibilityActivate",
"accessibilityActivationPoint",
"accessibilityAllowsOverriddenAttributesWhenIgnored",
"accessibilityAssistiveTechnologyFocusedIdentifiers",
"accessibilityAttributedHint",
"accessibilityAttributedLabel",
"accessibilityAttributedValue",
"accessibilityContainer",
"accessibilityContainerType",
"accessibilityCustomActions",
"accessibilityCustomRotors",
"accessibilityDecrement",
"accessibilityDragSourceDescriptors",
"accessibilityDropPointDescriptors",
"accessibilityElementCount",
"accessibilityElementDidBecomeFocused",
"accessibilityElementDidLoseFocus",
"accessibilityElementIsFocused",
"accessibilityElements",
"accessibilityElementsHidden",
"accessibilityFrame",
"accessibilityHeaderElements",
"accessibilityHint",
"accessibilityIdentification",
"accessibilityIdentifier",
"accessibilityIncrement",
"accessibilityLabel",
"accessibilityLanguage",
"accessibilityLocalizedStringKey",
"accessibilityNavigationStyle",
"accessibilityOverriddenAttributes",
"accessibilityParameterizedAttributeNames",
"accessibilityPath",
"accessibilityPerformEscape",
"accessibilityPerformMagicTap",
"accessibilityPresenterProcessIdentifier",
"accessibilityShouldUseUniqueId",
"accessibilitySupportsNotifications",
"accessibilitySupportsOverriddenAttributes",
"accessibilityTemporaryChildren",
"accessibilityTraits",
"accessibilityValue",
"accessibilityViewIsModal",
"accessibilityVisibleArea",
"allPropertyKeys",
"allowsWeakReference",
"attributeKeys",
"autoContentAccessingProxy",
"autorelease",
"awakeFromNib",
"boolValueSafe",
"bs_encoded",
"bs_isPlistableType",
"bs_secureEncoded",
"cl_json_serializeKey",
"class",
"classCode",
"classDescription",
"classForArchiver",
"classForCoder",
"classForKeyedArchiver",
"classForPortCoder",
"className",
"clearProperties",
"copy",
"dealloc",
"debugDescription",
"defaultAccessibilityTraits",
"description",
"doubleValueSafe",
"entityName",
"exposedBindings",
"finalize",
"finishObserving",
"flushKeyBindings",
"hash",
"init",
"int64ValueSafe",
"isAccessibilityElement",
"isAccessibilityElementByDefault",
"isElementAccessibilityExposedToInterfaceBuilder",
"isFault",
"isNSArray__",
"isNSCFConstantString__",
"isNSData__",
"isNSDate__",
"isNSDictionary__",
"isNSNumber__",
"isNSObject__",
"isNSOrderedSet__",
"isNSSet__",
"isNSString__",
"isNSTimeZone__",
"isNSValue__",
"isProxy",
"mutableCopy",
"nilValueForKey",
"objectSpecifier",
"observationInfo",
"pep_onDetachedThread",
"pep_onMainThread",
"pep_onMainThreadIfNecessary",
"prepareForInterfaceBuilder",
"release",
"releaseOnMainThread",
"retain",
"retainCount",
"retainWeakReference",
"scriptingProperties",
"self",
"shouldGroupAccessibilityChildren",
"storedAccessibilityActivationPoint",
"storedAccessibilityContainerType",
"storedAccessibilityElementsHidden",
"storedAccessibilityFrame",
"storedAccessibilityNavigationStyle",
"storedAccessibilityTraits",
"storedAccessibilityViewIsModal",
"storedIsAccessibilityElement",
"storedShouldGroupAccessibilityChildren",
"stringValueSafe",
"superclass",
"toManyRelationshipKeys",
"toOneRelationshipKeys",
"traitStorageList",
"un_safeBoolValue",
"userInterfaceItemIdentifier",
"utf8ValueSafe",
"valuesForKeysWithDictionary",
"zone",
// Protocol: CAAnimatableValue
// Protocol: CARenderValue
// Protocol: NSObject
// Protocol: ROCKRemoteInvocationInterface
};

@ -48,7 +48,8 @@ class PrimitiveFieldGenerator : public SingleFieldGenerator {
PrimitiveFieldGenerator(const PrimitiveFieldGenerator&) = delete;
PrimitiveFieldGenerator& operator=(const PrimitiveFieldGenerator&) = delete;
virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const override;
virtual void GenerateFieldStorageDeclaration(
io::Printer* printer) const override;
virtual int ExtraRuntimeHasBitsNeeded(void) const override;
virtual void SetExtraRuntimeHasBitsBase(int index_base) override;

@ -68,7 +68,6 @@ class PROTOC_EXPORT TextFormatDecodeData {
std::vector<DataEntry> entries_;
};
} // namespace objectivec
} // namespace compiler
} // namespace protobuf

Loading…
Cancel
Save