[cfe-commits] r92090 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaCXX/attr-noreturn.cpp
Nuno Lopes
nunoplopes at sapo.pt
Wed Dec 23 15:40:33 PST 2009
Author: nlopes
Date: Wed Dec 23 17:40:33 2009
New Revision: 92090
URL: http://llvm.org/viewvc/llvm-project?rev=92090&view=rev
Log:
allow the noreturn attribute to be used in class methods
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCXX/attr-noreturn.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=92090&r1=92089&r2=92090&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Dec 23 17:40:33 2009
@@ -929,7 +929,9 @@
// (C++98 8.3.5p3):
// All declarations for a function shall agree exactly in both the
// return type and the parameter-type-list.
- if (OldQType == NewQType)
+ // attributes should be ignored when comparing.
+ if (Context.getNoReturnType(OldQType, false) ==
+ Context.getNoReturnType(NewQType, false))
return MergeCompatibleFunctionDecls(New, Old);
// Fall through for conflicting redeclarations and redefinitions.
Modified: cfe/trunk/test/SemaCXX/attr-noreturn.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-noreturn.cpp?rev=92090&r1=92089&r2=92090&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/attr-noreturn.cpp (original)
+++ cfe/trunk/test/SemaCXX/attr-noreturn.cpp Wed Dec 23 17:40:33 2009
@@ -28,3 +28,12 @@
f3(f0); // okay
f3(f2); // expected-error{{no matching function for call}}
}
+
+
+class xpto {
+ int blah() __attribute__((noreturn));
+};
+
+int xpto::blah() {
+ return 3; // expected-warning {{function 'blah' declared 'noreturn' should not return}}
+}
More information about the cfe-commits
mailing list