summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-08-08 04:39:56 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-08-08 04:39:56 +0000
commitecffd83c85ea9d2ef7cb041712988a350daf82cf (patch)
tree32a4a83a35c0268f6b38bd81841f6c336ce3cdb8
parentf6d2184c833a798275fc6993695df320ad12405d (diff)
downloadbcm5719-llvm-ecffd83c85ea9d2ef7cb041712988a350daf82cf.tar.gz
bcm5719-llvm-ecffd83c85ea9d2ef7cb041712988a350daf82cf.zip
Get rid of an early return in Sema::ActOnFields which doesn't make sense anymore.
Fixes a crash (<rdar://problem/11067144>), and generally seems to improve recovery in other cases. llvm-svn: 161474
-rw-r--r--clang/lib/Sema/SemaDecl.cpp5
-rw-r--r--clang/test/Sema/invalid-decl.c9
-rw-r--r--clang/test/SemaCXX/PR9460.cpp6
-rw-r--r--clang/test/SemaCXX/constructor-initializer.cpp4
4 files changed, 14 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index ffe45fad039..869fedb00c2 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -9751,11 +9751,6 @@ void Sema::ActOnFields(Scope* S,
AttributeList *Attr) {
assert(EnclosingDecl && "missing record or interface decl");
- // If the decl this is being inserted into is invalid, then it may be a
- // redeclaration or some other bogus case. Don't try to add fields to it.
- if (EnclosingDecl->isInvalidDecl())
- return;
-
// If this is an Objective-C @implementation or category and we have
// new fields here we should reset the layout of the interface since
// it will now change.
diff --git a/clang/test/Sema/invalid-decl.c b/clang/test/Sema/invalid-decl.c
index a5e7ad3b1ec..2699b254926 100644
--- a/clang/test/Sema/invalid-decl.c
+++ b/clang/test/Sema/invalid-decl.c
@@ -20,3 +20,12 @@ zend_module_entry openssl_module_entry = {
sizeof(zend_module_entry)
};
+// <rdar://problem/11067144>
+typedef int (FunctionType)(int *value);
+typedef struct {
+ UndefinedType undef; // expected-error {{unknown type name 'UndefinedType'}}
+ FunctionType fun; // expected-error {{field 'fun' declared as a function}}
+} StructType;
+void f(StructType *buf) {
+ buf->fun = 0;
+}
diff --git a/clang/test/SemaCXX/PR9460.cpp b/clang/test/SemaCXX/PR9460.cpp
index 5b8b7b2cf68..0dd84467705 100644
--- a/clang/test/SemaCXX/PR9460.cpp
+++ b/clang/test/SemaCXX/PR9460.cpp
@@ -8,11 +8,11 @@ struct basic_string{
basic_string(aT*);
};
-struct runtime_error{ // expected-note{{candidate constructor}}
- runtime_error( // expected-note{{candidate constructor}}
+struct runtime_error{
+ runtime_error(
basic_string<char> struct{ // expected-error {{cannot combine with previous 'type-name' declaration specifier}}
a(){ // expected-error {{requires a type specifier}}
- runtime_error(0); // expected-error{{no matching conversion for functional-style cast from 'int' to 'runtime_error'}}
+ runtime_error(0);
}
}
);
diff --git a/clang/test/SemaCXX/constructor-initializer.cpp b/clang/test/SemaCXX/constructor-initializer.cpp
index 1a4e54444f4..f503d01f360 100644
--- a/clang/test/SemaCXX/constructor-initializer.cpp
+++ b/clang/test/SemaCXX/constructor-initializer.cpp
@@ -232,13 +232,13 @@ namespace PR7402 {
// <rdar://problem/8308215>: don't crash.
// Lots of questionable recovery here; errors can change.
namespace test3 {
- class A : public std::exception {}; // expected-error {{undeclared identifier}} expected-error {{expected class name}} expected-note 3 {{candidate}} expected-note {{passing argument}}
+ class A : public std::exception {}; // expected-error {{undeclared identifier}} expected-error {{expected class name}} expected-note 2 {{candidate}}
class B : public A {
public:
B(const String& s, int e=0) // expected-error {{unknown type name}}
: A(e), m_String(s) , m_ErrorStr(__null) {} // expected-error {{no matching constructor}} expected-error {{does not name}}
B(const B& e)
- : A(e), m_String(e.m_String), m_ErrorStr(__null) { // expected-error {{no viable conversion}} expected-error {{does not name}}
+ : A(e), m_String(e.m_String), m_ErrorStr(__null) { // expected-error {{does not name}} expected-error {{no member named 'm_String' in 'test3::B'}}
}
};
}
OpenPOWER on IntegriCloud