summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExceptionSpec.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Make IgnoreParens() look through ChooseExprs.Eli Friedman2013-07-201-1/+1
| | | | | | | | | | | | | This is the same way GenericSelectionExpr works, and it's generally a more consistent approach. A large part of this patch is devoted to caching the value of the condition of a ChooseExpr; it's needed to avoid threading an ASTContext into IgnoreParens(). Fixes <rdar://problem/14438917>. llvm-svn: 186738
* Fix regression from r184810.Eli Friedman2013-06-251-1/+3
| | | | | | | Specifically, CallExpr::getCalleeDecl() can return null, so make sure to handle that correctly. llvm-svn: 184813
* Fix noexcept for delete expressions.Eli Friedman2013-06-251-6/+5
| | | | | | | Using "delete" on a pointer to an incomplete type can't throw. While I'm here, clean up the signature of the canCalleeThrow() helper. llvm-svn: 184810
* Delete a couple dead checks.Eli Friedman2013-06-251-82/+76
| | | | | | | | Use castAs<> where appropriate. Don't check conditionals which are always true. Delete a bit of dead code. Reindent a bunch of code which is no longer guarded by an if statement. llvm-svn: 184801
* Delete dead code.Eli Friedman2013-06-251-17/+0
| | | | llvm-svn: 184795
* PR12086, PR15117Richard Smith2013-06-121-0/+1
| | | | | | | | | | | | | | | | | | | Introduce CXXStdInitializerListExpr node, representing the implicit construction of a std::initializer_list<T> object from its underlying array. The AST representation of such an expression goes from an InitListExpr with a flag set, to a CXXStdInitializerListExpr containing a MaterializeTemporaryExpr containing an InitListExpr (possibly wrapped in a CXXBindTemporaryExpr). This more detailed representation has several advantages, the most important of which is that the new MaterializeTemporaryExpr allows us to directly model lifetime extension of the underlying temporary array. Using that, this patch *drastically* simplifies the IR generation of this construct, provides IR generation support for nested global initializer_list objects, fixes several bugs where the destructors for the underlying array would accidentally not get invoked, and provides constant expression evaluation support for std::initializer_list objects. llvm-svn: 183872
* Use FPT::getArgTypes() instead of manually building ArrayRefsReid Kleckner2013-06-101-10/+4
| | | | | | | | Made significantly easier with git-clang-format. Differential Revision: http://llvm-reviews.chandlerc.com/D947 llvm-svn: 183694
* C++1y: Allow aggregates to have default initializers.Richard Smith2013-04-201-1/+6
| | | | | | | | | | | Add a CXXDefaultInitExpr, analogous to CXXDefaultArgExpr, and use it both in CXXCtorInitializers and in InitListExprs to represent a default initializer. There's an additional complication here: because the default initializer can refer to the initialized object via its 'this' pointer, we need to make sure that 'this' points to the right thing within the evaluation. llvm-svn: 179958
* Basic support for Microsoft property declarations andJohn McCall2013-04-161-0/+3
| | | | | | | | references thereto. Patch by Tong Shen! llvm-svn: 179585
* PR15597: Fix a confusion between the implicit exception specification and theRichard Smith2013-03-271-1/+1
| | | | | | | | uninstantiated exception specification when a special member within a class template is both defaulted and given an exception specification on its first declaration. llvm-svn: 178103
* ArrayRef-ize ASTContext::getFunctionType and Sema::BuildFunctionType.Jordan Rose2013-03-081-8/+10
| | | | | | No (intended) functionality change. llvm-svn: 176726
* Replace TypeLoc llvm::cast support to be well-defined.David Blaikie2013-02-181-2/+2
| | | | | | | | | | | | | | The TypeLoc hierarchy used the llvm::cast machinery to perform undefined behavior by casting pointers/references to TypeLoc objects to derived types and then using the derived copy constructors (or even returning pointers to derived types that actually point to the original TypeLoc object). Some context is in this thread: http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056804.html Though it's spread over a few months which can be hard to read in the mail archive. llvm-svn: 175462
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-3/+3
| | | | llvm-svn: 171367
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-1/+1
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Per C++11 [except.spec]p2, rvalue references are not permitted in exception ↵Richard Smith2012-11-281-33/+34
| | | | | | specifications. llvm-svn: 168824
* PR14388: An array or function type in an exception specification should beRichard Smith2012-11-281-12/+23
| | | | | | | decayed to a pointer type. Patch by WenHan Gu, with a little tweaking and additional testcases by me. llvm-svn: 168822
* Rework implementation of DR1492: Apply the resolution to operator delete too,Richard Smith2012-10-201-18/+37
| | | | | | | | | | | | since it also has an implicit exception specification. Downgrade the error to an extwarn, since at least for operator delete, system headers like to declare it as 'noexcept' whereas the implicit definition does not have an explicit exception specification. Move the exception specification for user-declared 'operator delete' functions from the type-as-written into the type, to reflect reality and to allow us to detect whether there was an implicit exception spec or not. llvm-svn: 166372
* DR1492: In a definition of a destructor, the exception specification must beRichard Smith2012-10-161-16/+28
| | | | | | explicitly specified iff it was specified in the declaration. llvm-svn: 166071
* PR13811: Add a FunctionParmPackExpr node to handle references to functionRichard Smith2012-09-121-0/+1
| | | | | | | parameter packs where the reference is not being expanded but the pack has been. Previously, Clang would segfault in such cases. llvm-svn: 163672
* Store SourceManager pointer on PrintingPolicy in the case where we're dumping,Richard Smith2012-08-161-2/+1
| | | | | | | | | and remove ASTContext reference (which was frequently bound to a dereferenced null pointer) from the recursive lump of printPretty functions. In so doing, fix (at least) one case where we intended to use the 'dump' mode, but that failed because a null ASTContext reference had been passed in. llvm-svn: 162011
* Final piece of core issue 1330: delay computing the exception specification ofRichard Smith2012-07-271-19/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a defaulted special member function until the exception specification is needed (using the same criteria used for the delayed instantiation of exception specifications for function temploids). EST_Delayed is now EST_Unevaluated (using 1330's terminology), and, like EST_Uninstantiated, carries a pointer to the FunctionDecl which will be used to resolve the exception specification. This is enabled for all C++ modes: it's a little faster in the case where the exception specification isn't used, allows our C++11-in-C++98 extensions to work, and is still correct for C++98, since in that mode the computation of the exception specification can't fail. The diagnostics here aren't great (in particular, we should include implicit evaluation of exception specifications for defaulted special members in the template instantiation backtraces), but they're not much worse than before. Our approach to the problem of cycles between in-class initializers and the exception specification for a defaulted default constructor is modified a little by this change -- we now reject any odr-use of a defaulted default constructor if that constructor uses an in-class initializer and the use is in an in-class initialzer which is declared lexically earlier. This is a closer approximation to the current draft solution in core issue 1351, but isn't an exact match (but the current draft wording isn't reasonable, so that's to be expected). llvm-svn: 160847
* Move Sema::RequireCompleteType() and Sema::RequireCompleteExprType()Douglas Gregor2012-05-041-3/+5
| | | | | | | | | | | off PartialDiagnostic. PartialDiagnostic is rather heavyweight for something that is in the critical path and is rarely used. So, switch over to an abstract-class-based callback mechanism that delays most of the work until a diagnostic is actually produced. Good for ~11k code size reduction in the compiler and 1% speedup in -fsyntax-only on the code in <rdar://problem/11004361>. llvm-svn: 156176
* Implements boxed expressions for Objective-C. <rdar://problem/10194391>Patrick Beard2012-04-191-1/+1
| | | | llvm-svn: 155082
* Implement DR1330 in C++11 mode, to support libstdc++4.7 which uses it.Richard Smith2012-04-171-1/+358
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We have a new flavor of exception specification, EST_Uninstantiated. A function type with this exception specification carries a pointer to a FunctionDecl, and the exception specification for that FunctionDecl is instantiated (if needed) and used in the place of the function type's exception specification. When a function template declaration with a non-trivial exception specification is instantiated, the specialization's exception specification is set to this new 'uninstantiated' kind rather than being instantiated immediately. Expr::CanThrow has migrated onto Sema, so it can instantiate exception specs on-demand. Also, any odr-use of a function triggers the instantiation of its exception specification (the exception specification could be needed by IRGen). In passing, fix two places where a DeclRefExpr was created but the corresponding function was not actually marked odr-used. We used to get away with this, but don't any more. Also fix a bug where instantiating an exception specification which refers to function parameters resulted in a crash. We still have the same bug in default arguments, which I'll be looking into next. This, plus a tiny patch to fix libstdc++'s common_type, is enough for clang to parse (and, in very limited testing, support) all of libstdc++4.7's standard headers. llvm-svn: 154886
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-8/+8
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-051-1/+1
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* Move a method from IdentifierTable.h out of line and remove the SmallString ↵Benjamin Kramer2012-02-041-0/+1
| | | | | | | | include. Fix all the transitive include users. llvm-svn: 149783
* Remove unreachable code in Clang. (replace with llvm_unreachable where ↵David Blaikie2012-01-171-2/+0
| | | | | | appropriate or when GCC requires it) llvm-svn: 148292
* Only print _Bool as 'bool' when 'bool' is defined as an object-likeDouglas Gregor2011-09-271-3/+3
| | | | | | macro whose only replacement token is '_Bool'. llvm-svn: 140656
* When 'bool' is not a built-in type but is defined as a macro, printDouglas Gregor2011-09-271-2/+2
| | | | | | | 'bool' rather than '_Bool' within types, to make things a bit more readable. Fixes <rdar://problem/10063263>. llvm-svn: 140650
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-1/+1
| | | | llvm-svn: 140367
* Rename LangOptions::Microsoft to LangOptions::MicrosoftExt to make it clear ↵Francois Pichet2011-09-171-3/+3
| | | | | | | | that this flag must be used only for Microsoft extensions and not emulation; to avoid confusion with the new LangOptions::MicrosoftMode flag. Many of the code now under LangOptions::MicrosoftExt will eventually be moved under the LangOptions::MicrosoftMode flag. llvm-svn: 139987
* Implement support for C++11 in-class initialization of non-static data members.Richard Smith2011-06-111-4/+6
| | | | llvm-svn: 132878
* MSVC doesn't do any validation regarding exception specification.Francois Pichet2011-05-241-1/+4
| | | | llvm-svn: 131950
* Fix PR9941 for out-of-line template destructors too.Sebastian Redl2011-05-201-7/+12
| | | | llvm-svn: 131722
* Reapply r121528, fixing PR9941 by delaying the exception specification check ↵Sebastian Redl2011-05-191-0/+8
| | | | | | for destructors until the class is complete and destructors have been adjusted. llvm-svn: 131632
* For consistency, change suffix from war_ to warn_ for some Microsoft ↵Francois Pichet2011-04-221-2/+2
| | | | | | warnings I introduced lately. llvm-svn: 129986
* Downgrade err_mismatched_exception_spec to a ExtWarning in Microsoft mode. ↵Francois Pichet2011-03-191-11/+10
| | | | | | | | MSVC doesn't do any validation on exception specifications. This remove 1 error when parsing MSVC stl lib with clang. llvm-svn: 127961
* More robust check for the special C++0x operator new workaround.Sebastian Redl2011-03-151-5/+5
| | | | llvm-svn: 127692
* Implement a hack to work around the changing exception specification of ↵Sebastian Redl2011-03-151-2/+38
| | | | | | operator new in C++0x. llvm-svn: 127688
* Instead of storing an ASTContext* in FunctionProtoTypes with computed ↵Sebastian Redl2011-03-131-4/+4
| | | | | | noexcept specifiers, unique FunctionProtoTypes with a ContextualFoldingSet, as suggested by John McCall. llvm-svn: 127568
* Propagate the new exception information to FunctionProtoType.Sebastian Redl2011-03-121-45/+200
| | | | | | | | Change the interface to expose the new information and deal with the enormous fallout. Introduce the new ExceptionSpecificationType value EST_DynamicNone to more easily deal with empty throw specifications. Update the tests for noexcept and fix the various bugs uncovered, such as lack of tentative parsing support. llvm-svn: 127537
* Forgotten part of previous commit.Abramo Bagnara2011-03-121-4/+4
| | | | llvm-svn: 127536
* Reinstate r127112, "Propagate new-style exception spec information to ↵Sebastian Redl2011-03-061-4/+4
| | | | | | ExtProtoInfo.", this time with the missing header. llvm-svn: 127118
* Revert r127112, "Propagate new-style exception spec information to ↵NAKAMURA Takumi2011-03-061-4/+4
| | | | | | | | ExtProtoInfo." It seems missing "clang/Basic/ExceptionSpecificationType.h". llvm-svn: 127115
* Propagate new-style exception spec information to ExtProtoInfo.Sebastian Redl2011-03-051-4/+4
| | | | llvm-svn: 127112
* Semantic checking for exception specifications should be triggered byJohn McCall2011-03-021-3/+3
| | | | | | whether C++ exceptions are enabled, not exceptions in general. PR9358. llvm-svn: 126820
* Added missing IgnoreParens().Abramo Bagnara2010-12-141-3/+1
| | | | llvm-svn: 121795
* Restore r121752 without modification.John McCall2010-12-141-18/+17
| | | | llvm-svn: 121763
* Pull out r121752 in case it's causing the selfhost breakage.John McCall2010-12-141-17/+18
| | | | llvm-svn: 121759
OpenPOWER on IntegriCloud