zufuliu / llvm-utils

LLVM/Clang toolsets for Visual Studio 2022, 2019, 2017, 2015, 2013, 2012 and 2010.
Other
209 stars 35 forks source link

Visual Studio fails to respond to disable/enable select code paths with Preprocessor __clang__ and/or __llvm__ #9

Closed GloriousPtr closed 1 year ago

GloriousPtr commented 1 year ago

Issue:

#if defined(__clang__)
//this code won't execute
#endif
zufuliu commented 1 year ago

https://godbolt.org/z/n4vf9x54r

zufuliu commented 1 year ago

You probably handled _MSC_VER first which clang-cl also defines.

GloriousPtr commented 1 year ago

You're right, it does work but Visual Studio fails to reflect it in the editor. VS clang cl manages to correctly disables the code in the editor.

LLVM_v43: image

LLVM - clang-cl (Visual Studio addon): image

zufuliu commented 1 year ago

There may needs further work as Visual Studio Code Analysis or IntelliSense doesn't understand clang extension. e.g. for https://github.com/zufuliu/notepad2/blob/main/src/EditAutoC.c There are 45 errors with LLVM_v143 (more errors with LLVM (clang-cl)). LLVM_v143 LLVM_clang-cl