-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Description
After https://reviews.llvm.org/D151954 we're seeing some significant regressions in the output of Clang-Format.
formating_output.zip
The code in this example is generated and formatted w/ Clang-Format and diffed against a golden file (golden.h
). To be clear the golden and generated file are both formatted w/ Clang-Format prior to diffing to avoid needlessly detecting irrelevant changes. Our .clang-format
file can be found here: https://cs.opensource.google/fuchsia/fuchsia/+/main:.clang-format
As can be seen in bad.h
, includes are indented when they shouldn't be and there is whitespace added after lines in many cases. There are also a number of empty lines left in the file.
To illustrate I'm incuding a snippet of the first 30 lines from golden.h
and bad.h
:
golden.h
// WARNING: This file is machine generated by fidlgen.
// fidl_experiment = no_optional_structs
// fidl_experiment = output_index_json
// fidl_experiment = simple_empty_response_syntax
// fidl_experiment = unknown_interactions
#pragma once
#include <lib/fidl/cpp/wire/array.h>
#include <lib/fidl/cpp/wire/envelope.h>
#include <lib/fidl/cpp/wire/internal/transport_err.h>
#include <lib/fidl/cpp/wire/message.h>
#include <lib/fidl/cpp/wire/message_storage.h>
#include <lib/fidl/cpp/wire/object_view.h>
#include <lib/fidl/cpp/wire/string_view.h>
#include <lib/fidl/cpp/wire/traits.h>
#include <lib/fidl/cpp/wire/wire_types.h>
#include <lib/stdcompat/optional.h>
#include <cinttypes>
#ifdef __Fuchsia__
#include <lib/zx/channel.h>
#endif // __Fuchsia__
#include <fidl/test.anonymous/cpp/common_types.h>
#include <fidl/test.anonymous/cpp/markers.h>
#pragma clang diagnostic push
bad.h
// WARNING: This file is machine generated by fidlgen.
// fidl_experiment = no_optional_structs
// fidl_experiment = output_index_json
// fidl_experiment = simple_empty_response_syntax
// fidl_experiment = unknown_interactions
#pragma once
#include <lib/fidl/cpp/wire/array.h>
#include <lib/fidl/cpp/wire/envelope.h>
#include <lib/fidl/cpp/wire/internal/transport_err.h>
#include <lib/fidl/cpp/wire/message.h>
#include <lib/fidl/cpp/wire/message_storage.h>
#include <lib/fidl/cpp/wire/object_view.h>
#include <lib/fidl/cpp/wire/string_view.h>
#include <lib/fidl/cpp/wire/traits.h>
#include <lib/fidl/cpp/wire/wire_types.h>
#include <lib/stdcompat/optional.h>
#include <cinttypes>
#ifdef __Fuchsia__
#include <lib/zx/channel.h>
#endif // __Fuchsia__
#include <fidl/test.anonymous/cpp/common_types.h>
#include <fidl/test.anonymous/cpp/markers.h>