intel / cm-compiler

MIT License
146 stars 54 forks source link

CM Vector list initialization #53

Closed Attractadore closed 3 years ago

Attractadore commented 3 years ago

This adds array-like list initialization to CM vectors.

aus-intel commented 3 years ago

Thanks for creating PR for this.

Now we have revived our lit testing for cm compiler and this means that contributions should be accompanied with lit tests that cover new functionality/fixed problems. To proceed with this PR you will need to add several lit tests.

To configure cmfe with enabled testing you will need to adjust LLVM and clang cmake lines with the following:

  1. LLVM: add -DLLVM_INSTALL_UTILS=ON. This will include FileCheck and other utilities required for lit testing in llvm installation.
  2. Clang: add -DCLANG_INCLUDE_TESTS=ON to enable test targets and -DLLVM_EXTERNAL_LIT= to specify where lit tool is located. Lit tool can be found in llvm/utils/lit/lit.py or downloaded as a python package via pip install. In latter case you can omit cmake argument if tool is in your PATH.

After doing this there will be a target "check-cmc" in clang build directory. You can use it to run cm lit tests. Tests sources are located inside test/CMFE directory in this repo. For this particular PR there will be needed 3 types of tests:

  1. AST check test. Example can be found in "cmlangspec/2_2_2_a_ast.cpp". This kind of test ensure that expected AST is built.
  2. Codegen check test. Example, similarly, is in "cmlangspec/2_2_2_a_codegen.cpp". This is LLVM IR check.
  3. Error reporting test. Examples can be found in "member_functions" subdirectory. These will check that correct diagnostic is emitted if source is incorrect. Please mark these tests as XFAIL -- since this is still work in progress to discard this marks and enable proper testing, currently this is the only way to write such tests.

Please add at least one test for each category to your PR and we can continue this review.

Attractadore commented 3 years ago

I added some tests. I'm not sure where they should be placed, so I put them all in a single folder for now.

aus-intel commented 3 years ago

Closing this PR as these changes have been merged with #63.