From 4689eecacdb2ac1d2b9ebbacc2c127c39a920a77 Mon Sep 17 00:00:00 2001 From: James Cherry Date: Wed, 11 Feb 2026 08:12:12 -0700 Subject: [PATCH] clang-format Signed-off-by: James Cherry --- .clang-format | 2 +- .cursor/rules/cpp-indentation.mdc | 43 +++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .cursor/rules/cpp-indentation.mdc diff --git a/.clang-format b/.clang-format index d50ce987..26ac15c1 100644 --- a/.clang-format +++ b/.clang-format @@ -10,7 +10,7 @@ AllowAllParametersOfDeclarationOnNextLine: false AllowShortIfStatementsOnASingleLine: Never AllowShortLoopsOnASingleLine: false AlwaysBreakAfterReturnType: TopLevel -BinPackArguments: false +BinPackArguments: true # fails BinPackParameters: AlwaysOnePerLine BraceWrapping: diff --git a/.cursor/rules/cpp-indentation.mdc b/.cursor/rules/cpp-indentation.mdc new file mode 100644 index 00000000..54bdb375 --- /dev/null +++ b/.cursor/rules/cpp-indentation.mdc @@ -0,0 +1,43 @@ +--- +description: C++ function call indentation for OpenSTA +globs: ["**/*.cc", "**/*.hh", "**/*.h"] +alwaysApply: false +--- + +# C++ Function Call Indentation + +## Short Calls — Single Line + +When arguments fit within the column limit (90 chars), keep them on one line: + +```cpp +// ✅ GOOD +adjusted_data_arrival = delaySum(required, data_shift_to_enable_clk, this); + +// ❌ BAD +adjusted_data_arrival = delaySum(required, + data_shift_to_enable_clk, + this); +``` + +## Nested Function Calls — Align Under Inner Call + +When breaking nested calls across lines: +- Indent continuation lines of the inner call under its first argument (align with content after `innerFunc(`). +- Place remaining outer arguments on the same line as the inner call's closing `)`, indented under the outer function. + +```cpp +// ✅ GOOD +required = delayDiff(delaySum(max_delay, + search_->clkPathArrival(disable_path), + this), + margin, this); + +// ❌ BAD +required = delayDiff( + delaySum(max_delay, + search_->clkPathArrival(disable_path), + this), + margin, + this); +```