Skip to content

: Fix lint in clang-format #3041

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion backends/apple/coreml/.clang-format
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
BasedOnStyle: WebKit
BreakBeforeBraces: Attach
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cymbalrush BreakBeforeBraces was defined twice in this class. With the new clang-format 18, it doesn't allow to have duplicate keys.

Deleting one of them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's an example error when running lintrunner

Advice (CLANGFORMAT) command-failed
  COMMAND (exit code 1)
  /home/mnachin/local/miniconda3/envs/executorch_docs/bin/clang-format
  -style=file /data/users/mnachin/fbsource/fbcode/executorch/backends/apple/
  coreml/runtime/util/objc_safe_cast.h
  STDERR
  /data/users/mnachin/fbsource/fbcode/executorch/backends/
  apple/coreml/.clang-format:23:1: error: duplicated mapping key
  'BreakBeforeBraces'
  BreakBeforeBraces: Custom
  ^~~~~~~~~~~~~~~~~
  Error reading /data/users/mnachin/fbsource/fbcode/executorch/backends/
  apple/coreml/.clang-format: Invalid argument
  STDOUT
  (empty)
  

AllowShortIfStatementsOnASingleLine: false
BreakBeforeBinaryOperators: None
BreakConstructorInitializers: BeforeColon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

NS_ASSUME_NONNULL_BEGIN
/// The default model executor, the executor ignores logging options.
__attribute__((objc_subclassing_restricted)) @interface ETCoreMLDefaultModelExecutor : NSObject<ETCoreMLModelExecutor>
__attribute__((objc_subclassing_restricted))
@interface ETCoreMLDefaultModelExecutor : NSObject<ETCoreMLModelExecutor>

+ (instancetype)new NS_UNAVAILABLE;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

NS_ASSUME_NONNULL_BEGIN
/// A class responsible for compiling a CoreML model.
__attribute__((objc_subclassing_restricted)) @interface ETCoreMLModelCompiler : NSObject
__attribute__((objc_subclassing_restricted))
@interface ETCoreMLModelCompiler : NSObject

+ (instancetype)new NS_UNAVAILABLE;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ struct ModelMetadata;

NS_ASSUME_NONNULL_BEGIN
/// A class responsible for loading a CoreML model.
__attribute__((objc_subclassing_restricted)) @interface ETCoreMLModelLoader : NSObject
__attribute__((objc_subclassing_restricted))
@interface ETCoreMLModelLoader : NSObject

+ (instancetype)new NS_UNAVAILABLE;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class ModelEventLogger;
typedef void ModelHandle;

/// A class responsible for managing the models loaded by the delegate.
__attribute__((objc_subclassing_restricted)) @interface ETCoreMLModelManager : NSObject
__attribute__((objc_subclassing_restricted))
@interface ETCoreMLModelManager : NSObject

+ (instancetype)new NS_UNAVAILABLE;

Expand Down
3 changes: 1 addition & 2 deletions backends/apple/coreml/runtime/kvstore/key_value_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ get_create_store_statement(std::string_view store_name, StorageType key_storage_

std::string get_create_index_statement(std::string_view store_name, std::string_view column_name) {
std::stringstream ss;
ss << "CREATE INDEX IF NOT EXISTS " << column_name << "_INDEX"
<< " ON " << store_name << "(" << column_name << ")";
ss << "CREATE INDEX IF NOT EXISTS " << column_name << "_INDEX" << " ON " << store_name << "(" << column_name << ")";

return ss.str();
}
Expand Down
3 changes: 2 additions & 1 deletion backends/apple/coreml/runtime/sdk/ETCoreMLModelDebugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ typedef NSDictionary<ETCoreMLModelStructurePath*, MLMultiArray*> ETCoreMLModelOu

NS_ASSUME_NONNULL_BEGIN
/// A class responsible for debugging a model.
__attribute__((objc_subclassing_restricted)) @interface ETCoreMLModelDebugger : NSObject
__attribute__((objc_subclassing_restricted))
@interface ETCoreMLModelDebugger : NSObject

- (instancetype)init NS_UNAVAILABLE;

Expand Down
3 changes: 2 additions & 1 deletion backends/apple/coreml/runtime/sdk/ETCoreMLModelProfiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ typedef NSDictionary<ETCoreMLModelStructurePath*, ETCoreMLOperationProfilingInfo

NS_ASSUME_NONNULL_BEGIN
/// A class responsible for profiling a model.
__attribute__((objc_subclassing_restricted)) @interface ETCoreMLModelProfiler : NSObject
__attribute__((objc_subclassing_restricted))
@interface ETCoreMLModelProfiler : NSObject

- (instancetype)init NS_UNAVAILABLE;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ NS_ASSUME_NONNULL_BEGIN
///
/// The class is a thin wrapper over `executorchcoreml::modelstructure::path`.
///
__attribute__((objc_subclassing_restricted)) @interface ETCoreMLModelStructurePath : NSObject<NSCopying>
__attribute__((objc_subclassing_restricted))
@interface ETCoreMLModelStructurePath : NSObject<NSCopying>

- (instancetype)init NS_UNAVAILABLE;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
NS_ASSUME_NONNULL_BEGIN

/// A class representing the profiling info of an operation.
__attribute__((objc_subclassing_restricted)) @interface ETCoreMLOperationProfilingInfo : NSObject<NSCopying>
__attribute__((objc_subclassing_restricted))
@interface ETCoreMLOperationProfilingInfo : NSObject<NSCopying>

- (instancetype)init NS_UNAVAILABLE;

Expand Down
3 changes: 2 additions & 1 deletion backends/apple/coreml/runtime/sdk/ETCoreMLPair.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

NS_ASSUME_NONNULL_BEGIN
/// A class representing a pair with first and second objects.
__attribute__((objc_subclassing_restricted)) @interface ETCoreMLPair<First, Second> : NSObject<NSCopying>
__attribute__((objc_subclassing_restricted))
@interface ETCoreMLPair<First, Second> : NSObject<NSCopying>

- (instancetype)init NS_UNAVAILABLE;

Expand Down