farzonl wrote:

> This change isn't NFC. You're not just moving a set value out of a header, 
> you're also changing how it applies to the underlying `matrix_type` 
> attribute. That warrants tests.

We already have the test that confirm behavior differences that confirm the 
impact on the underlying `matrix_type` but there are no explicit tests on 
Language option values.  From looking how others have done this via 
git grep -n  "Invocation.getLangOpts()" -- clang/unittests/
It is all just looking at the getter() value. No one is changing a LangOpts and 
check if it impacts sema or ast generation.

There are tests like that in `ASTImporterTest.cpp`
```bash
clang/unittests/AST/ASTImporterTest.cpp:670:  testImport("typedef int 
__attribute__((matrix_type(5, 5))) declToImport;",
clang/unittests/AST/ASTImporterTest.cpp:681:        using declToImport = T 
__attribute__((matrix_type(Rows, Cols)));
```
 but all of those aren't testing impact on `matrix_type` but rather its 
visibility with use of the `-fenable-matrix` flag.

If you are looking for sema tests maybe this should be a `Options.td` and not a 
LangOpt? then it would be easier to change the value per runline and show 
changing matrix dimmension constraints.
 
Anyways to recap these are the tests that exist:
clang/test/Sema/matrix-type-builtins.c
clang/test/SemaCXX/matrix-type-builtins.cpp
  // expected-error@-1 {{row dimension is outside the allowed range [1, 
1048575}}
  // expected-error@-1 {{column dimension is outside the allowed range [1, 
1048575}}

On the `__builtin_matrix_column_major_load` clang builtin

And in 
clang/test/SemaHLSL/BuiltIns/matrix-basic_types-errors.hlsl

We are confirming that the constraint is applied on matrix<int, 5, 5> mat3;

// expected-error@-1 {{constraints not satisfied for alias template 'matrix' 
[with element = int, rows_count = 5, cols_count = 5]}}
// expected-note@* {{because '5 <= 4' (5 <= 4) evaluated to false}}

Since the behavior differences are tested.  I’ve just added an explicit 
compiler invocation test to confirm this number changes
When we change the language mode to HLSL. I think that’s all you wanted?

https://github.com/llvm/llvm-project/pull/163307
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to