================
@@ -1384,6 +1397,65 @@ TEST_F(QualifierFixerTest, TemplatesLeft) {
"TemplateType<Container const> t;", Style);
}
+TEST_F(QualifierFixerTest, NewQualifierSupport) {
+ FormatStyle Style = getLLVMStyle();
+ Style.QualifierAlignment = FormatStyle::QAS_Custom;
+
+ // Test typedef qualifier
+ Style.QualifierOrder = {"typedef", "type"};
+ verifyFormat("typedef int MyInt;", Style);
+
+ // Test consteval qualifier
+ Style.QualifierOrder = {"consteval", "type"};
+ verifyFormat("consteval int func();", "int consteval func();", Style);
+
+ // Test constinit qualifier
+ Style.QualifierOrder = {"constinit", "static", "type"};
+ verifyFormat("constinit static int var = 10;", "static constinit int var =
10;", Style);
+
+ // Test thread_local qualifier
+ Style.QualifierOrder = {"thread_local", "static", "type"};
+ verifyFormat("thread_local static int counter;", "static thread_local int
counter;", Style);
+
+ // Test extern qualifier
+ Style.QualifierOrder = {"extern", "type"};
+ verifyFormat("extern int global_var;", "int extern global_var;", Style);
+
+ // Test mutable qualifier
+ Style.QualifierOrder = {"mutable", "type"};
+ verifyFormat("mutable int cache;", "int mutable cache;", Style);
+
+ // Test signed/unsigned qualifiers
+ Style.QualifierOrder = {"signed", "type"};
+ verifyFormat("signed int num;", "int signed num;", Style);
+ Style.QualifierOrder = {"unsigned", "type"};
+ verifyFormat("unsigned int num;", "int unsigned num;", Style);
----------------
HazardyKnusperkeks wrote:
Is there really a use case for putting `signed` at a different place than
`unsigned`? I'd argue no, handle them both at the same position with only one
configuration name.
https://github.com/llvm/llvm-project/pull/160853
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits