-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support of Windows Trace Logging macros
Consider the following code: #include <windows.h> #include <TraceLoggingActivity.h> #include <TraceLoggingProvider.h> #include <winmeta.h> TRACELOGGING_DEFINE_PROVIDER( g_hMyComponentProvider, "SimpleTraceLoggingProvider", // {0205c616-cf97-5c11-9756-56a2cee02ca7} (0x0205c616,0xcf97,0x5c11,0x97,0x56,0x56,0xa2,0xce,0xe0,0x2c,0xa7)); void test() { TraceLoggingFunction(g_hMyComponentProvider); } int main() { TraceLoggingRegister(g_hMyComponentProvider); test(); TraceLoggingUnregister(g_hMyComponentProvider); } It compiles with MSVC, but clang-cl reports an error: C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared/TraceLoggingActivity.h(377,30): note: expanded from macro '_tlgThisFunctionName' #define _tlgThisFunctionName __FUNCTION__ ^ .\tl.cpp(14,5): error: cannot initialize an array element of type 'char' with an lvalue of type 'const char[5]' TraceLoggingFunction(g_hMyComponentProvider); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The second commit is not needed to support above code, however, during isolated tests in ms_predefined_expr.cpp I found that MSVC accepts code with constexpr, whereas clang-cl does not. I see that in most places PredefinedExpr is supported in constant evaluation, so I didn't wrap my code with ``if(MicrosoftExt)``. Reviewed By: cor3ntin Differential Revision: https://reviews.llvm.org/D158591
- Loading branch information
Showing
6 changed files
with
53 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters