Clang: Difference between revisions

From miki
Jump to navigation Jump to search
Line 3: Line 3:
=== Clang on Windows ===
=== Clang on Windows ===


==== LLVM-MinGW ====
* https://github.com/mstorsjo/llvm-mingw
: The best port of LLVM/Clang on Windows I tried. Does not require Visual Studio for linking. Support UBSAN (for 32-bit and 64-bit targets).


* Get packages from https://github.com/mstorsjo/llvm-mingw
* MSYS2

: MSYS2 now provides clang 9.0 packages. No deps on VS but they don't provide UBSAN apparently.
The best port of LLVM/Clang on Windows I tried.
* No dependency on Visual Studio.
* Support 32-bit and 64-bit targets.
* Support sanitizers (ASAN, UBSAN).

==== MSYS2 ====

MSYS2 now provides clang 9.0 packages.
* No dependency on Visual Studio.
* Support 32-bit and 64-bit targets.
* But {{red|'''does not'''}} support sanitizers (ASAN, UBSAN).

==== Official LLVM ====

Packages from the official LLVM at http://releases.llvm.org/download.html.

* {{red|'''DEPEND'''}} on Visual Studio for linking
* Support 32-bit and 64-bit targets.
* (Maybe) support sanitizers (ASAN, UBSAN).


== Tips ==
== Tips ==

Revision as of 09:29, 18 November 2019

Links

Clang on Windows

LLVM-MinGW

The best port of LLVM/Clang on Windows I tried.

  • No dependency on Visual Studio.
  • Support 32-bit and 64-bit targets.
  • Support sanitizers (ASAN, UBSAN).

MSYS2

MSYS2 now provides clang 9.0 packages.

  • No dependency on Visual Studio.
  • Support 32-bit and 64-bit targets.
  • But does not support sanitizers (ASAN, UBSAN).

Official LLVM

Packages from the official LLVM at http://releases.llvm.org/download.html.

  • DEPEND on Visual Studio for linking
  • Support 32-bit and 64-bit targets.
  • (Maybe) support sanitizers (ASAN, UBSAN).

Tips

Get Stack Pointer

Use this macro [1]:

#define current_stack_pointer ({ \
        register unsigned long esp asm("esp"); \
        asm("" : "=r"(esp)); \
        esp; \
        })

Turn errors into warning

From the manual

-Wno-error=foo Turn warning “foo” into an warning even if -Werror is specified.

Enable all warnings: -Weverything

-Weverything means enable all current and future warnings. See Better Apps with Clang's Weverything or Wall is a Lie!