summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaInit.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Downgrade C++11 narrowing conversion errors to warnings default-mappedDouglas Gregor2012-01-231-9/+15
| | | | | | | | | to an error, so that users can turn them off if necessary. Note that this does *not* change the behavior of in a SFINAE context, where we still flag an error even if the warning is disabled. This matches GCC's behavior. llvm-svn: 148701
* constexpr: converted constant expression handling for enumerator values, caseRichard Smith2012-01-181-1/+1
| | | | | | | | | | values and non-type template arguments of integral and enumeration types. This change causes some legal C++98 code to no longer compile in C++11 mode, by enforcing the C++11 rule that narrowing integral conversions are not permitted in the final implicit conversion sequence for the above cases. llvm-svn: 148439
* Move narrowing conversion detection code from SemaInit to SemaOverload, readyRichard Smith2012-01-181-180/+79
| | | | | | | | | | | | | for it to be used in converted constant expression checking, and fix a couple of issues: - Conversion operators implicitly invoked prior to the narrowing conversion were not being correctly handled when determining whether a constant value was narrowed. - For conversions from floating-point to integral types, the diagnostic text incorrectly always claimed that the source expression was not a constant expression. llvm-svn: 148381
* Sema support for initialization of std::initializer_list from initializer lists.Sebastian Redl2012-01-171-3/+108
| | | | | | This does not yet support CodeGen. llvm-svn: 148349
* Re-add an over-zealously removed break.David Blaikie2012-01-171-0/+1
| | | | llvm-svn: 148296
* Remove unreachable code in Clang. (replace with llvm_unreachable where ↵David Blaikie2012-01-171-9/+4
| | | | | | appropriate or when GCC requires it) llvm-svn: 148292
* Remove unnecessary default cases in switches over enums.David Blaikie2012-01-171-1/+0
| | | | | | This allows -Wswitch-enum to find switches that need updating when these enums are modified. llvm-svn: 148281
* Convert SemaInit.cpp to pass a callback object to CorrectTypo.Kaelyn Uhrain2012-01-121-7/+25
| | | | | | | And once again improve the typo correction results in certain situations just by moving the existing checks on the correction. llvm-svn: 148037
* The value of a const weak variable is not an integer constant.John McCall2012-01-051-0/+15
| | | | llvm-svn: 147575
* Change the diagnostics which said 'accepted as an extension' to instead sayRichard Smith2011-12-291-4/+1
| | | | | | | 'is an extension'. The former is inappropriate and confusing when building with -Werror/-pedantic-errors. llvm-svn: 147357
* Fix build under -Wswitch by adding support for FK_ListConstructorOverloadFailedNick Lewycky2011-12-221-0/+4
| | | | | | to initialization sequence dumping. llvm-svn: 147171
* Overloading for initializer list construction.Sebastian Redl2011-12-221-4/+14
| | | | llvm-svn: 147156
* List-initialization via constructor part 1. Still needs: pretty-printing, ↵Sebastian Redl2011-12-221-218/+304
| | | | | | overloading, initializer_list. llvm-svn: 147145
* Revert r146766, and add a testcase for which it introduced a wrong-code bug.Richard Smith2011-12-201-37/+6
| | | | llvm-svn: 146961
* Fix an inconsistency in the syntactic form of InitListExpr in case of ↵Nicola Gigante2011-12-161-6/+37
| | | | | | initialization that involves a ConstructorConversion llvm-svn: 146766
* C++11 constexpr: Add note stacks containing backtraces if constant evaluationRichard Smith2011-12-161-1/+1
| | | | | | | | | | fails within a call to a constexpr function. Add -fconstexpr-backtrace-limit argument to driver and frontend, to control the maximum number of notes so produced (default 10). Fix APValue printing to be able to pretty-print all APValue types, and move the testing for this functionality from a unittest to a -verify test now that it's visible in clang's output. llvm-svn: 146749
* Revert r145244. It causes us to create broken ASTs with missing type informationRichard Smith2011-11-291-1/+1
| | | | | | | | | | for some cast expressions. Original commit message: Removed useless ImplicitCast nodes in explicit cstyle and static casts llvm-svn: 145447
* Removed useless ImplicitCast nodes in explicit cstyle and static castsNicola Gigante2011-11-281-1/+1
| | | | llvm-svn: 145244
* Reference initialization with initializer lists.Sebastian Redl2011-11-271-24/+211
| | | | | | This supports single-element initializer lists for references according to DR1288, as well as creating temporaries and binding to them for other initializer lists. llvm-svn: 145186
* Add feature to diagnostics that will provide more information on functionRichard Trieu2011-11-231-1/+3
| | | | | | | | | | pointer mismatch. Cases covered are: initialization, assignment, and function arguments. Additional text will give the extra information about the nature of the mismatch: different classes for member functions, wrong number of parameters, different parameter type, different return type, and function qualifier mismatch. llvm-svn: 145114
* Fixed HadMultipleCandidates loading.Abramo Bagnara2011-11-191-26/+39
| | | | llvm-svn: 144995
* Added missing ImplicitCastExpr around conversion operator call.Abramo Bagnara2011-11-161-5/+5
| | | | llvm-svn: 144850
* Resolve placeholder expressions before trying to deduceJohn McCall2011-11-151-9/+6
| | | | | | | 'auto'. Introduce a convenience method to make this a bit easier, and use it elsewhere. llvm-svn: 144605
* When reference binding array rvalues, such as those created by compoundPeter Collingbourne2011-11-131-1/+1
| | | | | | literals of array type, materialise a temporary. llvm-svn: 144483
* Rename Expr::Evaluate to Expr::EvaluateAsRValue to make it clear that it willRichard Smith2011-10-291-1/+1
| | | | | | | | implicitly perform an lvalue-to-rvalue conversion if used on an lvalue expression. Also improve the documentation of Expr::Evaluate* to indicate which of them will accept expressions with side-effects. llvm-svn: 143263
* Restore r142914 and r142915, now with missing file and apparentJohn McCall2011-10-251-16/+2
| | | | | | GCC compiler workaround. llvm-svn: 142931
* Revert r142914 and r142915, due to possibly missing file.NAKAMURA Takumi2011-10-251-2/+16
| | | | | | r142914: "Introduce a placeholder type for "pseudo object"" r142915: "Pull the pseudo-object stuff into its own file." llvm-svn: 142921
* Introduce a placeholder type for "pseudo object"John McCall2011-10-251-16/+2
| | | | | | | | | | | | | | | expressions: expressions which refer to a logical rather than a physical l-value, where the logical object is actually accessed via custom getter/setter code. A subsequent patch will generalize the AST for these so that arbitrary "implementing" sub-expressions can be provided. Right now the only client is ObjC properties, but this should be generalizable to similar language features, e.g. Managed C++'s __property methods. llvm-svn: 142914
* Don't try to set the "array filler" in a InitListExpr twice.Argyrios Kyrtzidis2011-10-211-2/+3
| | | | llvm-svn: 142695
* -Wc++98-compat: diagnose if a reference is bound to a prvalue which does notRichard Smith2011-10-191-66/+138
| | | | | | have an unambiguous accessible copying constructor; this is ill-formed in C++98. llvm-svn: 142533
* -Wc++98-compat and -Wc++98-compat-pedantic warnings for Sema, part 2.Richard Smith2011-10-181-6/+7
| | | | llvm-svn: 142426
* Teach the ARC compiler to not require __bridge casts whenJohn McCall2011-10-171-0/+23
| | | | | | | passing/receiving CF objects at +0 to/from Objective-C methods or audited C functions. llvm-svn: 142219
* Diagnose when omitting braces in direct list-initialization in C++0x.Sebastian Redl2011-10-161-10/+25
| | | | | | This also applies to C99-style aggregate literals, should they be used in C++11, since they are effectively identical to constructor call list-initialization syntax. llvm-svn: 142147
* In the verify-only pass, check that items that don't have an initializer in ↵Sebastian Redl2011-10-161-17/+62
| | | | | | an init list can be value-initialized, at least when designated initializers are not involved. No test case yet, since early failures cannot be distinguished from late failures until overload resolution works. llvm-svn: 142146
* Change operator<< for raw_ostream and NamedDecl to take a reference instead ↵Benjamin Kramer2011-10-141-2/+2
| | | | | | | | of a pointer. Passing a pointer was a bad idea as it collides with the overload for void*. llvm-svn: 141971
* Constant expression evaluation refactoring:Richard Smith2011-10-101-3/+3
| | | | | | | | | | | - Remodel Expr::EvaluateAsInt to behave like the other EvaluateAs* functions, and add Expr::EvaluateKnownConstInt to capture the current fold-or-assert behaviour. - Factor out evaluation of bitfield bit widths. - Fix a few places which would evaluate an expression twice: once to determine whether it is a constant expression, then again to get the value. llvm-svn: 141561
* Per C++ [class.bit]p2, unnamed bit-fields are not members. Fixes PR10289.Douglas Gregor2011-10-101-1/+1
| | | | llvm-svn: 141549
* Initialize the HadMultipleCandidates flag.Benjamin Kramer2011-10-091-0/+3
| | | | | | Found by valgrind. llvm-svn: 141510
* Added a flag to identify resolved overloaded function references.Abramo Bagnara2011-10-051-1/+11
| | | | llvm-svn: 141171
* Remove a nonsensical bit of code from ↵Eli Friedman2011-10-041-3/+0
| | | | | | | | InitListChecker::getStructuredSubobjectInit which was increasing the reserved size for an init list past its maximum possible size. Fixes PR11056, a case where we were reserving a bunch of memory for arrays that was never actually used. (No testcase because I don't think we have any way to actually write a testcase for this; the chosen value of NumElements has no effects on anything other than performance and memory usage.) llvm-svn: 141106
* Get rid of useless helper Sema::CastCategory.Eli Friedman2011-09-271-1/+1
| | | | llvm-svn: 140642
* PR11009: Fix a FIXME which was leading to an assertion failure with rvalue ↵Eli Friedman2011-09-271-4/+1
| | | | | | references. llvm-svn: 140594
* CheckStringInit has side effects; make sure we don't run it in VerifyOnly ↵Eli Friedman2011-09-261-3/+5
| | | | | | | | mode, at least for the moment. <rdar://problem/10185490>. Sebastian, please take a look at this; I'm not entirely sure it is the right thing to do. llvm-svn: 140552
* Fix a typo in the new VerifyOnly handling in SemaInit. No visible ↵Eli Friedman2011-09-261-1/+1
| | | | | | difference at the moment, as far as I can tell. llvm-svn: 140546
* Add a missing increment to avoid infinite looping in the regression test.Benjamin Kramer2011-09-251-1/+4
| | | | | | Also make sure we set the error flag when correcting a typo. llvm-svn: 140466
* Treat list-initialization of scalars as a first-class citizen in C++11.Sebastian Redl2011-09-241-5/+6
| | | | | | | | | Allow empty initializer lists for scalars, which mean value-initialization. Constant evaluation for single-element and empty initializer lists for scalars. Codegen for empty initializer lists for scalars. Test case comes in next commit. llvm-svn: 140459
* Give InitListChecker a verification-only mode, where it neither emits ↵Sebastian Redl2011-09-241-217/+320
| | | | | | | | | | | diagnostics nor builds a semantic (structured) initializer list, just reports on whether it can match the given list to the target type. Use this mode for doing init list checking in the initial step of initialization, which will eventually allow us to do overload resolution based on the outcome. llvm-svn: 140457
* In Initialization, add step kind SK_ListConstructorCall (list-initializationSebastian Redl2011-09-241-5/+21
| | | | | | | resolves to a constructor call in C++11) and failure kind FK_ListInitializationFailed (early InitListChecker run failed). llvm-svn: 140456
* Inline Sema::CheckInitList into its only user.Sebastian Redl2011-09-241-11/+4
| | | | llvm-svn: 140455
* Fix typos and non-doxygen-ness in a few comments.Sebastian Redl2011-09-241-4/+2
| | | | llvm-svn: 140454
OpenPOWER on IntegriCloud