[PATCH] D124312: [Driver] Call hasFlag instead of hasArg
Akira Hatanaka via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 22 16:59:37 PDT 2022
ahatanak created this revision.
ahatanak added a reviewer: zero9178.
ahatanak added a project: clang.
Herald added a project: All.
ahatanak requested review of this revision.
Herald added a subscriber: MaskRay.
`_HAS_STATIC_RTTI` should be set to 0 only by `-fno-rtti` according to the summary of https://reviews.llvm.org/D103771.
rdar://92039243
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D124312
Files:
clang/lib/Driver/ToolChains/MSVC.cpp
clang/test/Driver/msvc-static-rtti.cpp
Index: clang/test/Driver/msvc-static-rtti.cpp
===================================================================
--- clang/test/Driver/msvc-static-rtti.cpp
+++ clang/test/Driver/msvc-static-rtti.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang -target x86_64-pc-windows-msvc -fno-rtti -### %s 2>&1 | FileCheck %s -check-prefix STATIC-RTTI-DEF
-// RUN: %clang -target x86_64-pc-windows-msvc -frtti -### %s 2>&1 | FileCheck %s -check-prefix STATIC-RTTI-DEF-NOT
+// RUN: %clang -target x86_64-pc-windows-msvc -fno-rtti -### %s 2>&1 | FileCheck %s -check-prefix NO-RTTI
+// RUN: %clang -target x86_64-pc-windows-msvc -frtti -### %s 2>&1 | FileCheck %s -check-prefix RTTI
-// STATIC-RTTI-DEF: -D_HAS_STATIC_RTTI=0
-// STATIC-RTTI-DEF-NOT: -D_HAS_STATIC_RTTI=0
+// RTTI-NOT: -D_HAS_STATIC_RTTI=0
+// NO-RTTI: -D_HAS_STATIC_RTTI=0
Index: clang/lib/Driver/ToolChains/MSVC.cpp
===================================================================
--- clang/lib/Driver/ToolChains/MSVC.cpp
+++ clang/lib/Driver/ToolChains/MSVC.cpp
@@ -963,7 +963,7 @@
Action::OffloadKind DeviceOffloadKind) const {
// MSVC STL kindly allows removing all usages of typeid by defining
// _HAS_STATIC_RTTI to 0. Do so, when compiling with -fno-rtti
- if (DriverArgs.hasArg(options::OPT_fno_rtti, options::OPT_frtti,
- /*Default=*/false))
+ if (DriverArgs.hasFlag(options::OPT_fno_rtti, options::OPT_frtti,
+ /*Default=*/false))
CC1Args.push_back("-D_HAS_STATIC_RTTI=0");
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124312.424668.patch
Type: text/x-patch
Size: 1496 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220422/dd5de7cd/attachment-0001.bin>
More information about the cfe-commits
mailing list