Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues using Clang with Visual Studio 2022 #736

Closed
NixAJ opened this issue Nov 4, 2022 · 0 comments · Fixed by #853
Closed

Issues using Clang with Visual Studio 2022 #736

NixAJ opened this issue Nov 4, 2022 · 0 comments · Fixed by #853
Assignees
Labels
bug Something isn't working

Comments

@NixAJ
Copy link

NixAJ commented Nov 4, 2022

Operation System : Windows 10
Commit Hash : c33700e
Clang Version : 13.0.1 (v143 Build Tools)

When compiling Luau inside of Visual Studio 2022 using Clang, the MSVC identifier used in the CMakeLists.txt file to differentiate when you are using MSVC instead of GNU/Clang fails while Clang is in use.

This means that flags that means nothing to Clang is added, and flags that are needed such as "-Wno-unused-function" for "ISOCLINE_OPTIONS" are missing making it compile incorrectly, and this becomes really problematic when including Luau as a submodule. If your parent project contains the correct flag for treating warnings as errors, it is impossible to compile Luau using Clang inside of VS 2022, because Luau fails to recognize Clang is in use.

The reproduction steps

  1. Pull Luau into a folder
  2. Open the folder using VS 2022 (Embedded CMake)
  3. Change the build configuration to use Clang.
  4. Build -> See output log (Incorrect flags are added such as /MP)

Suggested Solution

MSVC is not a good enough identifier inside of the CMakeList to conclude that MSVC is the compiler in use, therefore there must be additional checks or reversal of the order in which checks are made to ensure that Clang is properly identified when using VS 2022.

@NixAJ NixAJ added the bug Something isn't working label Nov 4, 2022
@zeux zeux assigned zeux and vegorov-rbx and unassigned zeux Feb 15, 2023
vegorov-rbx added a commit that referenced this issue Mar 3, 2023
* Fixed incorrect lexeme generated for string parts in the middle of an
interpolated string (Fixes #744)
* DeprecatedApi lint can report some issues without type inference
information
* Fixed performance of autocomplete requests when suggestions have large
intersection types (Solves
#847)
* Marked `table.getn`/`foreach`/`foreachi` as deprecated ([RFC:
Deprecate
table.getn/foreach/foreachi](https://github.com/Roblox/luau/blob/master/rfcs/deprecate-table-getn-foreach.md))
* With -O2 optimization level, we now optimize builtin calls based on
known argument/return count.
Note that this change can be observable if `getfenv/setfenv` is used to
substitute a builtin, especially if arity is different.
Fastcall heavy tests show a 1-2% improvement.
* Luau can now be built with clang-cl (Fixes
#736)

We also made many improvements to our experimental components.

For our new type solver:
* Overhauled data flow analysis system, fixed issues with 'repeat'
loops, global variables and type annotations
* Type refinements now work on generic table indexing with a string
literal
* Type refinements will properly track potentially 'nil' values (like
t[x] for a missing key) and their further refinements
* Internal top table type is now isomorphic to `{}` which fixes issues
when `typeof(v) == 'table'` type refinement is handled
* References to non-existent types in type annotations no longer resolve
to 'error' type like in old solver
* Improved handling of class unions in property access expressions
* Fixed default type packs
* Unsealed tables can now have metatables
* Restored expected types for function arguments

And for native code generation:
* Added min and max IR instructions mapping to vminsd/vmaxsd on x64
* We now speculatively extract direct execution fast-paths based on
expected types of expressions which provides better optimization
opportunities inside a single basic block
* Translated existing math fastcalls to IR form to improve tag guard
removal and constant propagation
RomanKhafizianov pushed a commit to RomanKhafizianov/luau that referenced this issue Nov 27, 2023
* Fixed incorrect lexeme generated for string parts in the middle of an
interpolated string (Fixes luau-lang/luau#744)
* DeprecatedApi lint can report some issues without type inference
information
* Fixed performance of autocomplete requests when suggestions have large
intersection types (Solves
luau-lang/luau#847)
* Marked `table.getn`/`foreach`/`foreachi` as deprecated ([RFC:
Deprecate
table.getn/foreach/foreachi](https://github.com/Roblox/luau/blob/master/rfcs/deprecate-table-getn-foreach.md))
* With -O2 optimization level, we now optimize builtin calls based on
known argument/return count.
Note that this change can be observable if `getfenv/setfenv` is used to
substitute a builtin, especially if arity is different.
Fastcall heavy tests show a 1-2% improvement.
* Luau can now be built with clang-cl (Fixes
luau-lang/luau#736)

We also made many improvements to our experimental components.

For our new type solver:
* Overhauled data flow analysis system, fixed issues with 'repeat'
loops, global variables and type annotations
* Type refinements now work on generic table indexing with a string
literal
* Type refinements will properly track potentially 'nil' values (like
t[x] for a missing key) and their further refinements
* Internal top table type is now isomorphic to `{}` which fixes issues
when `typeof(v) == 'table'` type refinement is handled
* References to non-existent types in type annotations no longer resolve
to 'error' type like in old solver
* Improved handling of class unions in property access expressions
* Fixed default type packs
* Unsealed tables can now have metatables
* Restored expected types for function arguments

And for native code generation:
* Added min and max IR instructions mapping to vminsd/vmaxsd on x64
* We now speculatively extract direct execution fast-paths based on
expected types of expressions which provides better optimization
opportunities inside a single basic block
* Translated existing math fastcalls to IR form to improve tag guard
removal and constant propagation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

3 participants