зеркало из https://github.com/microsoft/clang.git
Only predefine the __EXCEPTIONS macro if C++ exceptions are turned on.
Only predefine the OBJC_ZEROCOST_EXCEPTIONS macro if Objective-C exceptions are turned on. Fixes PR10910. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139496 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
cb4d7c202e
Коммит
eced60c185
|
@ -426,7 +426,9 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
|
|||
if (LangOpts.ObjC1) {
|
||||
if (LangOpts.ObjCNonFragileABI) {
|
||||
Builder.defineMacro("__OBJC2__");
|
||||
Builder.defineMacro("OBJC_ZEROCOST_EXCEPTIONS");
|
||||
|
||||
if (LangOpts.ObjCExceptions)
|
||||
Builder.defineMacro("OBJC_ZEROCOST_EXCEPTIONS");
|
||||
}
|
||||
|
||||
if (LangOpts.getGCMode() != LangOptions::NonGC)
|
||||
|
@ -452,7 +454,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
|
|||
Builder.defineMacro("__BLOCKS__");
|
||||
}
|
||||
|
||||
if (LangOpts.Exceptions)
|
||||
if (LangOpts.CXXExceptions)
|
||||
Builder.defineMacro("__EXCEPTIONS");
|
||||
if (LangOpts.RTTI)
|
||||
Builder.defineMacro("__GXX_RTTI");
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
// OBJCGC:#define __OBJC_GC__ 1
|
||||
//
|
||||
//
|
||||
// RUN: %clang_cc1 -x objective-c -fobjc-nonfragile-abi -E -dM < /dev/null | FileCheck -check-prefix NONFRAGILE %s
|
||||
// RUN: %clang_cc1 -x objective-c -fobjc-exceptions -fobjc-nonfragile-abi -E -dM < /dev/null | FileCheck -check-prefix NONFRAGILE %s
|
||||
//
|
||||
// NONFRAGILE:#define OBJC_ZEROCOST_EXCEPTIONS 1
|
||||
// NONFRAGILE:#define __OBJC2__ 1
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
// RUN: %clang_cc1 -x objective-c -fobjc-exceptions -fobjc-nonfragile-abi -fexceptions -E -dM %s | FileCheck -check-prefix=CHECK-OBJC-NOCXX %s
|
||||
// CHECK-OBJC-NOCXX: #define OBJC_ZEROCOST_EXCEPTIONS 1
|
||||
// CHECK-OBJC-NOCXX-NOT: #define __EXCEPTIONS 1
|
||||
|
||||
// RUN: %clang_cc1 -x objective-c++ -fobjc-exceptions -fobjc-nonfragile-abi -fexceptions -fcxx-exceptions -E -dM %s | FileCheck -check-prefix=CHECK-OBJC-CXX %s
|
||||
// CHECK-OBJC-CXX: #define OBJC_ZEROCOST_EXCEPTIONS 1
|
||||
// CHECK-OBJC-CXX: #define __EXCEPTIONS 1
|
||||
|
||||
// RUN: %clang_cc1 -x objective-c++ -fobjc-nonfragile-abi -fexceptions -fcxx-exceptions -E -dM %s | FileCheck -check-prefix=CHECK-NOOBJC-CXX %s
|
||||
// CHECK-NOOBJC-CXX-NOT: #define OBJC_ZEROCOST_EXCEPTIONS 1
|
||||
// CHECK-NOOBJC-CXX: #define __EXCEPTIONS 1
|
||||
|
||||
// RUN: %clang_cc1 -x objective-c -fobjc-nonfragile-abi -E -dM %s | FileCheck -check-prefix=CHECK-NOOBJC-NOCXX %s
|
||||
// CHECK-NOOBJC-NOCXX-NOT: #define OBJC_ZEROCOST_EXCEPTIONS 1
|
||||
// CHECK-NOOBJC-NOCXX-NOT: #define __EXCEPTIONS 1
|
Загрузка…
Ссылка в новой задаче