summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-25 08:47:54 +0000
committerChris Lattner <sabre@nondot.org>2009-04-25 08:47:54 +0000
commitedfa8d45572d970a3ccfaad73675eafa269e21d0 (patch)
tree2e35afb00db158527a659ee46a504932379eb3e0 /clang/test/Sema
parentb41df4f6223aedd30a3a96588420cc035f648ff2 (diff)
downloadbcm5719-llvm-edfa8d45572d970a3ccfaad73675eafa269e21d0.tar.gz
bcm5719-llvm-edfa8d45572d970a3ccfaad73675eafa269e21d0.zip
Change SemaType's "GetTypeForDeclarator" and "ConvertDeclSpecToType" to
always return a non-null QualType + error bit. This fixes a bunch of cases that didn't check for null result (and could thus crash) and eliminates some crappy code scattered throughout sema. This also improves the diagnostics in the recursive struct case to eliminate a bogus second error. It also cleans up the case added to function.c by forming a proper function type even though the declarator is erroneous, allowing the parameter to be added to the function. Before: t.c:2:1: error: unknown type name 'unknown_type' unknown_type f(void*P) ^ t.c:4:3: error: use of undeclared identifier 'P' P+1; ^ After: t.c:2:1: error: unknown type name 'unknown_type' unknown_type f(void*P) ^ llvm-svn: 70023
Diffstat (limited to 'clang/test/Sema')
-rw-r--r--clang/test/Sema/function.c6
-rw-r--r--clang/test/Sema/nested-redef.c3
2 files changed, 6 insertions, 3 deletions
diff --git a/clang/test/Sema/function.c b/clang/test/Sema/function.c
index 974f6e97372..8b5c8572076 100644
--- a/clang/test/Sema/function.c
+++ b/clang/test/Sema/function.c
@@ -80,6 +80,10 @@ typedef void fn_t(void);
fn_t t17;
// PR4049
-unknown_type t18(void*) { // expected-error {{unknown type name 'unknown_type'}}
+unknown_type t18(void*) { // expected-error {{unknown type name 'unknown_type'}} expected-error{{parameter name omitted}}
+}
+
+unknown_type t19(int* P) { // expected-error {{unknown type name 'unknown_type'}}
+ P = P+1; // no warning.
}
diff --git a/clang/test/Sema/nested-redef.c b/clang/test/Sema/nested-redef.c
index 53b22d69893..ea180910128 100644
--- a/clang/test/Sema/nested-redef.c
+++ b/clang/test/Sema/nested-redef.c
@@ -1,7 +1,6 @@
// RUN: clang-cc -fsyntax-only -verify %s
struct X { // expected-note{{previous definition is here}}
- struct X { } x; // expected-error{{nested redefinition of 'X'}} \
- expected-error {{field has incomplete type}}
+ struct X { } x; // expected-error{{nested redefinition of 'X'}}
};
struct Y { };
OpenPOWER on IntegriCloud