Граф коммитов

23 Коммитов

Автор SHA1 Сообщение Дата
Aaron Ballman c3f7ae01e2 Generate a diagnostic when a catch handler cannot execute due to class hierarchy inversion with regards to other catch handlers for the same block.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234375 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-08 00:05:29 +00:00
David Majnemer 26405073db Sema: Caught exception objects should be unqualified
The exception object should be unqualified.  Using a qualified exception
object results in the wrong copy constructor getting called when the
catch handler executes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231054 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-03 04:38:34 +00:00
David Majnemer c69762c6e8 Sema: Properly initialize the thrown exception object
We would create the exception object with the wrong qualifiers, ensuring
that the wrong copy constructor would get called.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231049 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-03 01:50:05 +00:00
Aaron Ballman 310d7861ec Partial revert of r229336; this wasn't intended to go in.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229338 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-15 22:18:04 +00:00
Aaron Ballman 1a93c73434 Removing LLVM_EXPLICIT, as MSVC 2012 was the last reason for requiring the macro. NFC; Clang edition.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229336 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-15 22:00:28 +00:00
Richard Smith 06260b83cc Reword switch/goto diagnostics "protected scope" diagnostics. Making up a term
"protected scope" is very unhelpful here and actively confuses users. Instead,
simply state the nature of the problem in the diagnostic: we cannot jump from
here to there. The notes explain nicely why not.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217293 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-06 00:24:58 +00:00
Richard Smith a70c3f8738 Per C++11 [except.spec]p2, rvalue references are not permitted in exception specifications.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168824 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 22:52:42 +00:00
Richard Smith 21173b1080 PR14388: An array or function type in an exception specification should be
decayed to a pointer type. Patch by WenHan Gu, with a little tweaking and
additional testcases by me.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168822 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 22:33:28 +00:00
Douglas Gregor ecd7b04ae7 Promote the extension warning for attempts to catch a reference or
pointer to incomplete type from an ExtWarn to an error. We put the
ExtWarn in place as part of a workaround for Boost (PR6527), but it
(1) doesn't actually match a GCC extension and (2) has been fixed for
two years in Boost, and (3) causes us to emit code that fails badly at
run time, so it's a bad idea to keep it. Fixes PR11803.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148838 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-24 19:01:26 +00:00
Richard Trieu 2fe9b7fb07 Modify how the -verify flag works. Currently, the verification string and
diagnostic message are compared.  If either is a substring of the other, then
no error is given.  This gives rise to an unexpected case:

  // expect-error{{candidate function has different number of parameters}}

will match the following error messages from Clang:

  candidate function has different number of parameters (expected 1 but has 2)
  candidate function has different number of parameters

It will also match these other error messages:

  candidate function
  function has different number of parameters
  number of parameters

This patch will change so that the verification string must be a substring of
the diagnostic message before accepting.  Also, all the failing tests from this
change have been corrected.  Some stats from this cleanup:

87 - removed extra spaces around verification strings
70 - wording updates to diagnostics
40 - extra leading or trailing characters (typos, unmatched parens or quotes)
35 - diagnostic level was included (error:, warning:, or note:)
18 - flag name put in the warning (-Wprotocol)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146619 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-15 00:38:15 +00:00
Anders Carlsson abea951c34 Add -fcxx-exceptions to all tests that use C++ exceptions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126599 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-28 00:40:07 +00:00
Anders Carlsson e41721e7df Pass -fexceptions to all tests that use try/catch/throw.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126037 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-19 19:23:03 +00:00
Chandler Carruth 45f11b7875 Fix PR8767, improve diagnostic wording when allocating an object of an
abstract class type.

Patch by Stephen Hines, with a wording tweak from Doug applied by me.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125996 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-18 23:59:51 +00:00
Douglas Gregor c0b39640de Audit uses of Sema::LookupSingleName for those lookups that are
intended for redeclarations, fixing those that need it. Fixes PR6831.

This uncovered an issue where the C++ type-specifier-seq parsing logic
would try to perform name lookup on an identifier after it already had
a type-specifier, which could also lead to spurious ambiguity errors
(as in PR6831, but with a different test case).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101419 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 23:40:53 +00:00
Douglas Gregor bf422f9d7e Diagnose attempts to throw an abstract class type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101381 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 18:05:39 +00:00
John McCall 7c2342dd4c When pretty-printing tag types, only print the tag if we're in C (and
therefore not creating ElaboratedTypes, which are still pretty-printed
with the written tag).

Most of these testcase changes were done by script, so don't feel too
sorry for my fingers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98149 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10 11:27:22 +00:00
Douglas Gregor a2762918ec Downgrade errors when trying to catch a pointer or reference to
incomplete type to warnings; GCC (and EDG in GCC compatibility mode)
permit such handles. Fixes PR6527.

(For real this time)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97927 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-08 01:47:36 +00:00
Chandler Carruth 3604160c2c Revert r97925, it only contained the test updates not the actual fix.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97926 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-08 00:41:19 +00:00
Douglas Gregor d7bf93c190 Downgrade errors when trying to catch a pointer or reference to
incomplete type to warnings; GCC (and EDG in GCC compatibility mode)
permit such handles. Fixes PR6527.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97925 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-07 23:28:27 +00:00
Daniel Dunbar a5728872c7 Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91446 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-15 20:14:24 +00:00
Sebastian Redl 13e8854b18 Track down return statements in the handlers of a function-try-block of constructors. Meh ...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70256 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 21:33:24 +00:00
Sebastian Redl fef9f59e80 Don't allow catch declarations to name an abstract class
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70248 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 21:03:30 +00:00
Sebastian Redl 972041f45b Improve validation of C++ exception handling: diagnose throwing incomplete types and jumps into protected try-catch scopes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70242 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 20:27:31 +00:00