Skip to content

Commit c9ef1da

Browse files
committed
Updated wording in documentation
1 parent 125bdd1 commit c9ef1da

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ Attribute Changes in Clang
351351
inline calls within the attributed function up to a specified depth. This attribute takes
352352
a single unsigned integer argument representing the requested depth of inlining. Unlike
353353
a strict limit, the requested depth is a hint that works cooperatively with other inlining
354-
mechanisms:
354+
mechanisms, including:
355355

356356
- Functions marked with ``always_inline`` will be inlined even if they exceed the requested depth
357357
- The compiler's cost model may choose to inline beyond the requested depth for beneficial cases

clang/include/clang/Basic/AttrDocs.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4054,7 +4054,7 @@ The actual inlining behavior is subject to several considerations:
40544054
- **Cost model decisions**: The compiler's inlining cost model may choose to
40554055
inline functions beyond the requested depth if doing so is deemed beneficial
40564056
(e.g., trivial wrapper functions or obvious optimization opportunities). This
4057-
prevents the attribute from becoming a footgun that blocks beneficial optimizations.
4057+
prevents the attribute from blocking beneficial optimizations.
40584058

40594059
- **Insufficient call depth**: If the call tree is shallower than the requested
40604060
depth, the attribute simply inlines as far as the call tree allows.

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2755,9 +2755,10 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
27552755
if (const FlattenDepthAttr *FDA = D->getAttr<FlattenDepthAttr>()) {
27562756
Expr *DepthExpr = FDA->getDepthHint();
27572757
Expr::EvalResult Result;
2758-
if (DepthExpr->EvaluateAsInt(Result, getContext())) {
2759-
B.addFlattenDepthAttr(Result.Val.getInt().getZExtValue());
2760-
}
2758+
[[maybe_unused]] bool Success =
2759+
DepthExpr->EvaluateAsInt(Result, getContext());
2760+
assert(Success && "flatten_depth expression should be an integer constant");
2761+
B.addFlattenDepthAttr(Result.Val.getInt().getZExtValue());
27612762
}
27622763

27632764
// Track whether we need to add the optnone LLVM attribute,

0 commit comments

Comments
 (0)