llvm-capstone/clang
Richard Dzenis e6d305e64f 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
2023-09-04 16:54:42 +02:00
..
bindings
cmake [Clang][CMake] Remove GCC option override in BOLT.cmake 2023-08-29 19:41:03 -07:00
docs Add support of Windows Trace Logging macros 2023-09-04 16:54:42 +02:00
examples Fix examples after C2x renaming 2023-08-11 08:01:17 -04:00
include Add support of Windows Trace Logging macros 2023-09-04 16:54:42 +02:00
lib Add support of Windows Trace Logging macros 2023-09-04 16:54:42 +02:00
runtime
test Add support of Windows Trace Logging macros 2023-09-04 16:54:42 +02:00
tools [Object] Change OffloadBinary::write to return SmallString<0> 2023-09-01 09:19:25 -07:00
unittests [AST] Support ConceptReference in DynTypedNode, add dump(). 2023-09-04 13:56:15 +02:00
utils [AArch64][SME] Make the overloaded svreinterpret_* functions streaming-compatible. 2023-09-04 10:15:26 +00:00
www Revert "[clang] Enable sized deallocation by default in C++14 onwards" 2023-08-29 09:36:59 -04:00
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt cmake: add missing dependencies on ClangDriverOptions tablegen 2023-08-04 10:27:19 -07:00
CodeOwners.rst Add my Discord, IRC, and Discourse handles 2023-08-04 09:12:14 -04:00
INSTALL.txt
LICENSE.TXT
NOTES.txt Revert "Test commit config" 2023-08-22 16:43:34 -07:00
README.txt

//===----------------------------------------------------------------------===//
// C Language Family Front-end
//===----------------------------------------------------------------------===//

Welcome to Clang.  This is a compiler front-end for the C family of languages
(C, C++, Objective-C, and Objective-C++) which is built as part of the LLVM
compiler infrastructure project.

Unlike many other compiler frontends, Clang is useful for a number of things
beyond just compiling code: we intend for Clang to be host to a number of
different source-level tools.  One example of this is the Clang Static Analyzer.

If you're interested in more (including how to build Clang) it is best to read
the relevant web sites.  Here are some pointers:

Information on Clang:             http://clang.llvm.org/
Building and using Clang:         http://clang.llvm.org/get_started.html
Clang Static Analyzer:            http://clang-analyzer.llvm.org/
Information on the LLVM project:  http://llvm.org/

If you have questions or comments about Clang, a great place to discuss them is
on the Clang forums:
  https://discourse.llvm.org/c/clang/

If you find a bug in Clang, please file it in the LLVM bug tracker:
  http://llvm.org/bugs/