mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 19:26:06 +00:00

As reported in https://bugs.llvm.org/show_bug.cgi?id=42113, there are a number of locations in Clang where it is assumed that exception specifications are only valid in C++ mode. Since the original justification for the NoThrow Exception Specifier Type was C++ related, this patch just makes C mode use the attribute-based nothrow handling. Additionally, I noticed that the handling of non-prototype functions regressed the behavior of the nothrow attribute, in part because it is was listed in the function type macro(which I did in the previous patch). In reality, it should only be doing so in a conditional nature, so this patch removes it there and puts it directly in the switch to be handled correctly. llvm-svn: 362607
19 lines
650 B
C
19 lines
650 B
C
// RUN: %clang_cc1 %s -verify
|
|
// RUN: %clang_cc1 %s -ast-dump | FileCheck %s
|
|
// expected-no-diagnostics
|
|
|
|
// PR42113: The following caused an assertion in mergeFunctionTypes
|
|
// because it causes one side to have an exception specification, which
|
|
// isn't typically supported in C.
|
|
void PR42113a();
|
|
void PR42113a(void) __attribute__((nothrow));
|
|
// CHECK: FunctionDecl {{.*}} PR42113a
|
|
// CHECK: FunctionDecl {{.*}} PR42113a
|
|
// CHECK: NoThrowAttr
|
|
void PR42113b() __attribute__((nothrow));
|
|
// CHECK: FunctionDecl {{.*}} PR42113b
|
|
// CHECK: NoThrowAttr
|
|
__attribute__((nothrow)) void PR42113c();
|
|
// CHECK: FunctionDecl {{.*}} PR42113c
|
|
// CHECK: NoThrowAttr
|