Skip to content

Commit a2b3110

Browse files
authored
[clang] Reduce the small vector size for DeclTypeInfo. (llvm#148788)
The `Declarator` class is large (4584 bytes) and used as a stack-local variable during parsing. This patch reduces the default size of its `DeclTypeInfo` member, reducing the overall size down to 3880 bytes. This allows clang handle more deeply nested expressions without exhausting the stack. Combined with llvm#148726, the nesting threshold for such expressions increases to `~1100`. No performance impact being [observed](https://llvm-compile-time-tracker.com/compare.php?from=d4f5ed6a23464cbe831820cb695aa1d39b11e4aa&to=66ba54b8a295cc2759387ef2a4a162de2ad4946e&stat=instructions:u).
1 parent 2a9afdb commit a2b3110

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/include/clang/Sema/DeclSpec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1918,7 +1918,7 @@ class Declarator {
19181918
/// parsed. This is pushed from the identifier out, which means that element
19191919
/// #0 will be the most closely bound to the identifier, and
19201920
/// DeclTypeInfo.back() will be the least closely bound.
1921-
SmallVector<DeclaratorChunk, 8> DeclTypeInfo;
1921+
SmallVector<DeclaratorChunk, 4> DeclTypeInfo;
19221922

19231923
/// InvalidType - Set by Sema::GetTypeForDeclarator().
19241924
LLVM_PREFERRED_TYPE(bool)

0 commit comments

Comments
 (0)