From ba365cef647d5da1dc4f00184bbfcecf3bffb880 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Tue, 15 Jan 2019 02:43:33 +0000 Subject: [PATCH] gn build: Split no-RTTI flag into a config. Some of the sanitizer runtime code needs to be built with RTTI; this allows that code to opt in to RTTI. Differential Revision: https://reviews.llvm.org/D56627 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351155 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/gn/build/BUILD.gn | 14 +++++++++----- utils/gn/build/BUILDCONFIG.gn | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/utils/gn/build/BUILD.gn b/utils/gn/build/BUILD.gn index 9222d31bdf4..2a8d818cbec 100644 --- a/utils/gn/build/BUILD.gn +++ b/utils/gn/build/BUILD.gn @@ -28,7 +28,6 @@ config("compiler_defaults") { cflags_cc = [ "-std=c++11", "-fno-exceptions", - "-fno-rtti", "-fvisibility-inlines-hidden", ] } else { @@ -52,10 +51,7 @@ config("compiler_defaults") { "_UNICODE", "UNICODE", ] - cflags += [ - "/EHs-c-", - "/GR-", - ] + cflags += [ "/EHs-c-" ] # The MSVC default value (1 MB) is not enough for parsing recursive C++ # templates in Clang. @@ -110,6 +106,14 @@ config("compiler_defaults") { } } +config("no_rtti") { + if (current_os == "win") { + cflags_cc = [ "/GR-" ] + } else { + cflags_cc = [ "-fno-rtti" ] + } +} + config("llvm_code") { include_dirs = [ "//llvm/include", diff --git a/utils/gn/build/BUILDCONFIG.gn b/utils/gn/build/BUILDCONFIG.gn index a46725c6d4a..721011699a3 100644 --- a/utils/gn/build/BUILDCONFIG.gn +++ b/utils/gn/build/BUILDCONFIG.gn @@ -5,6 +5,7 @@ shared_binary_target_configs = [ "//llvm/utils/gn/build:compiler_defaults", "//llvm/utils/gn/build:llvm_code", + "//llvm/utils/gn/build:no_rtti", "//llvm/utils/gn/build:warn_covered_switch_default", ] -- 2.50.1