[all-commits] [llvm/llvm-project] 936d67: [clang][msvc] Define _HAS_STATIC_RTTI to 0, when c...

zero9178 via All-commits all-commits at lists.llvm.org
Thu Jun 10 08:03:31 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 936d6756ccfbe207a181b692b828f9fd8f1489f2
      https://github.com/llvm/llvm-project/commit/936d6756ccfbe207a181b692b828f9fd8f1489f2
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2021-06-10 (Thu, 10 Jun 2021)

  Changed paths:
    M clang/lib/Driver/ToolChains/MSVC.cpp
    M clang/lib/Driver/ToolChains/MSVC.h
    A clang/test/Driver/msvc-static-rtti.cpp

  Log Message:
  -----------
  [clang][msvc] Define _HAS_STATIC_RTTI to 0, when compiling with -fno-rtti

When using the -fno-rtti option of the GCC style clang++, using typeid results in an error. The MSVC STL however kindly provides a define flag called _HAS_STATIC_RTTI, which either enables or disables uses of typeid throughout the STL. By default, if undefined, it is set to 1, enabling the use of typeid.

With this patch, _HAS_STATIC_RTTI is set to 0 when -fno-rtti is specified. This way various headers of the MSVC STL like functional can be consumed without compilation failures.

Differential Revision: https://reviews.llvm.org/D103771




More information about the All-commits mailing list