r284458 - [c++1z] Include "noexcept" in builtin function types where appropriate. Fixes
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 18 00:13:55 PDT 2016
Author: rsmith
Date: Tue Oct 18 02:13:55 2016
New Revision: 284458
URL: http://llvm.org/viewvc/llvm-project?rev=284458&view=rev
Log:
[c++1z] Include "noexcept" in builtin function types where appropriate. Fixes
an assertion failure looking up a matching ::operator delete for
__builtin_operator_delete.
Added:
cfe/trunk/test/CodeGenCXX/cxx1z-noexcept-function-type.cpp
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/test/Analysis/cfg.cpp
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=284458&r1=284457&r2=284458&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Tue Oct 18 02:13:55 2016
@@ -8671,6 +8671,9 @@ QualType ASTContext::GetBuiltinType(unsi
FunctionProtoType::ExtProtoInfo EPI;
EPI.ExtInfo = EI;
EPI.Variadic = Variadic;
+ if (getLangOpts().CPlusPlus && BuiltinInfo.isNoThrow(Id))
+ EPI.ExceptionSpec.Type =
+ getLangOpts().CPlusPlus11 ? EST_BasicNoexcept : EST_DynamicNone;
return getFunctionType(ResType, ArgTypes, EPI);
}
Modified: cfe/trunk/test/Analysis/cfg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/cfg.cpp?rev=284458&r1=284457&r2=284458&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/cfg.cpp (original)
+++ cfe/trunk/test/Analysis/cfg.cpp Tue Oct 18 02:13:55 2016
@@ -92,7 +92,7 @@ void F(EmptyE e) {
// CHECK-NEXT: Succs (1): B1
// CHECK: [B1]
// CHECK-NEXT: 1: __builtin_object_size
-// CHECK-NEXT: 2: [B1.1] (ImplicitCastExpr, BuiltinFnToFnPtr, unsigned long (*)(const void *, int))
+// CHECK-NEXT: 2: [B1.1] (ImplicitCastExpr, BuiltinFnToFnPtr, unsigned long (*)(const void *, int) noexcept)
// CHECK-NEXT: 3: [B1.2](dummy(), 0)
// CHECK-NEXT: 4: (void)[B1.3] (CStyleCastExpr, ToVoid, void)
// CHECK-NEXT: Preds (1): B2
Added: cfe/trunk/test/CodeGenCXX/cxx1z-noexcept-function-type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/cxx1z-noexcept-function-type.cpp?rev=284458&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/cxx1z-noexcept-function-type.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/cxx1z-noexcept-function-type.cpp Tue Oct 18 02:13:55 2016
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fexceptions -fcxx-exceptions -std=c++1z -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s
+
+// CHECK-LABEL: define {{.*}} @_Z11builtin_newm(
+// CHECK: call {{.*}} @_Znwm(
+void *builtin_new(unsigned long n) { return __builtin_operator_new(n); }
+
+// CHECK-LABEL: define {{.*}} @_Z14builtin_deletePv(
+// CHECK: call {{.*}} @_ZdlPv(
+void builtin_delete(void *p) { return __builtin_operator_delete(p); }
More information about the cfe-commits
mailing list