summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* When we emit an error during the implicit definition of a specialDouglas Gregor2010-05-122-5/+41
| | | | | | | | member function (default constructor, copy constructor, copy assignment operator, destructor), emit a note showing where that implicit definition was required. llvm-svn: 103619
* Improve commentary on the indirect-goto jump scope checker and extractJohn McCall2010-05-121-69/+76
| | | | | | a convenience routine to find the innermost common ancestor of two scopes. llvm-svn: 103565
* When checking scopes for indirect goto, be more permissive (but still safe)John McCall2010-05-121-70/+249
| | | | | | | | | | | | | | | | | | | | | | | | | about the permitted scopes. Specifically: 1) Permit labels and gotos to appear after a prologue of variable initializations. 2) Permit indirect gotos to jump out of scopes that don't require cleanup. 3) Diagnose possible attempts to indirect-jump out of scopes that do require cleanup. This requires a substantial reinvention of the algorithm for checking indirect goto. The current algorithm is Omega(M*N), with M = the number of unique scopes being jumped from and N = the number of unique scopes being jumped to, with an additional factor that is probably (worst-case) linear in the depth of scopes. Thus the entire thing is likely cubic given some truly bizarre ill-formed code; on well-formed code the additional factor collapses to an amortized constant (when amortized over the entire function) and so the algorithm is quadratic. Even this requires every label to appear in its own scope, which would be very unusual for indirect-goto code (and extremely unlikely for well-formed code); it is far more likely that all labels will be in the same scope and so the algorithm becomes linear. For such a marginal feature, I am fairly happy with this result. (this is using JumpDiagnostic's definition of scope, where successive variables in a block appear in their own scope) llvm-svn: 103536
* Merged Elaborated and QualifiedName types.Abramo Bagnara2010-05-1112-173/+135
| | | | llvm-svn: 103517
* Speculatively revert r103497, "Do not mark the virtual members of anDaniel Dunbar2010-05-113-89/+10
| | | | | | implicitly-instantiated class as ...", which seems to have broken bootstrap. llvm-svn: 103515
* Do not mark the virtual members of an implicitly-instantiated class asDouglas Gregor2010-05-113-10/+89
| | | | | | | | referenced unless we see one of them defined (or the key function defined, if it as one) or if we need the vtable for something. Fixes PR7114. llvm-svn: 103497
* The C++98/03 standard is disturbingly silent about out-of-scopeDouglas Gregor2010-05-111-3/+12
| | | | | | | | | | explicit instantiations of template. C++0x clarifies the intent (they're ill-formed in some cases; see [temp.explicit] for details). However, one could squint at the C++98/03 standard and conclude they are permitted, so reduce the error to a warning (controlled by -Wc++0x-compat) in C++98/03 mode. llvm-svn: 103482
* Allow static_cast to objective-c pointers.Fariborz Jahanian2010-05-101-2/+3
| | | | | | Fixes radar 7952457. llvm-svn: 103447
* Be more careful about picking a template parameter when we fail to ↵Douglas Gregor2010-05-091-2/+4
| | | | | | substitute explicit template arguments into a function template llvm-svn: 103369
* Fix a silly bootstrap-breaking thinko, where we were trying to convertDouglas Gregor2010-05-081-20/+28
| | | | | | | non-existent condition expressions to boolean values during template instantiation. llvm-svn: 103364
* Improve our handling of the -Wunused-variable warning in templates. InDouglas Gregor2010-05-083-17/+30
| | | | | | | | | particular, don't complain about unused variables that have dependent type until instantiation time, so that we can look at the type of the variable. Moreover, only complain about unused variables that have neither a user-declared constructor nor a non-trivial destructor. llvm-svn: 103362
* Don't complain about an __builtin_va_arg expression's result beingDouglas Gregor2010-05-081-0/+1
| | | | | | unused, since the operation has side effects. llvm-svn: 103360
* When instantiating statements that involve conditions (if, while, do,Douglas Gregor2010-05-081-51/+58
| | | | | | | | | | | | | for, and switch), be careful to construct the full expressions as soon as we perform template instantation, so we don't either forget to call temporary destructors or destroy temporaries at the wrong time. This is the template-instantiation analogue to r103187, during which I hadn't realized that the issue would affect the handling of these constructs differently inside and outside of templates. Fixes a regression in Boost.Function. llvm-svn: 103357
* Don't destroy the data associated with an overload resolution candidate; ↵Douglas Gregor2010-05-081-7/+1
| | | | | | it's ASTContext-allocated now llvm-svn: 103350
* Record template argument deduction failures for member functionDouglas Gregor2010-05-081-11/+28
| | | | | | templates and conversion function templates. llvm-svn: 103349
* When printing an overload candidate that failed due to SFINAE, print aDouglas Gregor2010-05-083-12/+67
| | | | | | | | | | | specific message that includes the template arguments, e.g., test/SemaTemplate/overload-candidates.cpp:27:20: note: candidate template ignored: substitution failure [with T = int *] typename T::type get_type(const T&); // expected-note{{candidate ... ^ llvm-svn: 103348
* Improve overload-candidate diagnostic for a function template thatDouglas Gregor2010-05-082-15/+43
| | | | | | | | | | | | | | | | | | | | failed because the explicitly-specified template arguments did not match its template parameters, e.g., test/SemaTemplate/overload-candidates.cpp:18:8: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'I' void get(const T&); ^ test/SemaTemplate/overload-candidates.cpp:20:8: note: candidate template ignored: invalid explicitly-specified argument for 1st template parameter void get(const T&); ^ llvm-svn: 103344
* A leak is better than a double-free while I figure out how to addressDouglas Gregor2010-05-081-5/+0
| | | | | | this issue. llvm-svn: 103343
* Minor cleanup, and ban copying of OverloadCandidateSets. NoDouglas Gregor2010-05-082-14/+17
| | | | | | functionality change. llvm-svn: 103342
* When template argument deduction fails because the call had tooDouglas Gregor2010-05-081-5/+14
| | | | | | | many/too few arguments, use the same diagnostic we use for arity mismatches in non-templates (but note that it's a function template). llvm-svn: 103341
* When printing a non-viable overload candidate that failed due toDouglas Gregor2010-05-082-16/+205
| | | | | | | | | | | | conflicting deduced template argument values, give a more specific reason along with those values, e.g., test/SemaTemplate/overload-candidates.cpp:4:10: note: candidate template ignored: deduced conflicting types for parameter 'T' ('int' vs. 'long') const T& min(const T&, const T&); ^ llvm-svn: 103339
* When we encounter a non-dependent type during template instantiation,Douglas Gregor2010-05-074-3/+60
| | | | | | | mark any declarations we see inside of that type as "referenced". Fixes PR7079. llvm-svn: 103323
* Reapply the reference-binding patch applied below, along with a fix toDouglas Gregor2010-05-072-5/+6
| | | | | | | | | | | | | | | | ensure that we complete the type when we need to look at constructors during reference binding. When determining whether the two types involved in reference binding are reference-compatible, reference-related, etc., do not complete the type of the reference itself because it is not necessary to determine well-formedness of the program. Complete the type that we are binding to, since that can affect whether we know about a derived-to-base conversion. Re-fixes PR7080. llvm-svn: 103283
* Revert r103220. It seems to be breaking self-hostDouglas Gregor2010-05-071-1/+2
| | | | llvm-svn: 103259
* A correct fix for bug 6466.Sebastian Redl2010-05-071-0/+3
| | | | llvm-svn: 103250
* Revert 103247, it causes lots of test failures.Sebastian Redl2010-05-071-1/+1
| | | | llvm-svn: 103248
* Pass the correct type to BuildMemberReferenceExpr. Fixes bug 6466.Sebastian Redl2010-05-071-1/+1
| | | | llvm-svn: 103247
* When determining whether the two types involved in reference bindingDouglas Gregor2010-05-071-2/+1
| | | | | | | | | | | | are reference-compatible, reference-related, etc., do not complete the type of the reference itself because it is not necessary to determine well-formedness of the program. Complete the type that we are binding to, since that can affect whether we know about a derived-to-base conversion. Fixes PR7080. llvm-svn: 103220
* After some discussion, conservatively extend our sentinel check to discardJohn McCall2010-05-061-10/+13
| | | | | | casts, but still require the (casted) type to be a pointer. Fixes PR5685. llvm-svn: 103216
* It turns out that we should be allowing redeclarations within functionDouglas Gregor2010-05-061-2/+3
| | | | | | scope. Thanks to Steven Watanabe for correcting me. llvm-svn: 103210
* Fixed DISABLE_SMART_POINTERS breakageDouglas Gregor2010-05-064-14/+23
| | | | llvm-svn: 103198
* Diagnose deprecated/unavailable functions selected by overload resolution.John McCall2010-05-062-3/+21
| | | | | | Fixes rdar://problem/4232969, or at least the clang parts of it. llvm-svn: 103191
* Rework our handling of temporary objects within the conditions ofDouglas Gregor2010-05-065-81/+118
| | | | | | | | | | | | | | | | | | | if/switch/while/do/for statements. Previously, we would end up either: (1) Forgetting to destroy temporaries created in the condition (!), (2) Destroying the temporaries created in the condition *before* converting the condition to a boolean value (or, in the case of a switch statement, to an integral or enumeral value), or (3) In a for statement, destroying the condition's temporaries at the end of the increment expression (!). We now destroy temporaries in conditions at the right times. This required some tweaking of the Parse/Sema interaction, since the parser was building full expressions too early in many places. Fixes PR7067. llvm-svn: 103187
* Rearchitect -Wconversion and -Wsign-compare. Instead of computing themJohn McCall2010-05-065-141/+260
| | | | | | | | | | | | | | "bottom-up" when implicit casts and comparisons are inserted, compute them "top-down" when the full expression is finished. Makes it easier to coordinate warnings and thus implement -Wconversion for signedness conversions without double-warning with -Wsign-compare. Also makes it possible to realize that a signedness conversion is okay because the context is performing the inverse conversion. Also simplifies some logic that was trying to calculate the ultimate comparison/result type and getting it wrong. Also fixes a problem with the C++ explicit casts which are often "implemented" in the AST with a series of implicit cast expressions. llvm-svn: 103174
* Remember the number of positive and negative bits used by the enumerators ofJohn McCall2010-05-061-2/+3
| | | | | | | an enum in the enum decl itself. Use some spare bits from TagDecl for this purpose. llvm-svn: 103173
* optimize builtin_isnan/isinf to not do an extraneous extension fromChris Lattner2010-05-061-1/+14
| | | | | | | float -> double (which happens because they are modelled as int(...) functions), and add a testcase for isinf. llvm-svn: 103167
* Partial and full specializations of a class template may have aDouglas Gregor2010-05-064-9/+13
| | | | | | | | | different tag kind ("struct" vs. "class") than the primary template, which has an affect on access control. Should fix the last remaining Boost.Accumulors failure. llvm-svn: 103144
* Silence a pedantic GCC warning by making the grouping of && and || explicit.Chandler Carruth2010-05-061-4/+4
| | | | llvm-svn: 103141
* When implicit definition of the copy-assignment operator fails,Douglas Gregor2010-05-051-6/+12
| | | | | | | | | provide a note that shows where the copy-assignment operator was needed. We used to have this, but I broke it during refactoring. Finishes PR6999. llvm-svn: 103127
* This patch deals with Sema Part of Setter/Getter synthesisFariborz Jahanian2010-05-053-14/+66
| | | | | | | of properties which are of C++ objects. Code Gen to follow (Radar 7468090). llvm-svn: 103123
* Reapplying patch to change StmtNodes.def to StmtNodes.td, this timeAlexis Hunt2010-05-051-7/+7
| | | | | | | with no whitespace. This will allow statements to be referred to in attribute TableGen files. llvm-svn: 103087
* Revert r103072; I accidentally ended up deleting a bunch of trailingAlexis Hunt2010-05-051-213/+213
| | | | | | | whitespace which makes this patch unreadable. Will recommit without the whitespace. llvm-svn: 103086
* Support for 'template' as a disambiguator (PR7030)Douglas Gregor2010-05-051-2/+4
| | | | | | | | | | | | | ParseOptionalCXXScopeSpecifier() only annotates the subset of template-ids which are not subject to lexical ambiguity. Add support for the more general case in ParseUnqualifiedId() to handle cases such as A::template B(). Also improve some diagnostic locations. Fixes PR7030, from Alp Toker! llvm-svn: 103081
* Reimplement code generation for copying fields in theDouglas Gregor2010-05-051-49/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implicitly-generated copy constructor. Previously, Sema would perform some checking and instantiation to determine which copy constructors, etc., would be called, then CodeGen would attempt to figure out which copy constructor to call... but would get it wrong, or poke at an uninstantiated default argument, or fail in other ways. The new scheme is similar to what we now do for the implicit copy-assignment operator, where Sema performs all of the semantic analysis and builds specific ASTs that look similar to the ASTs we'd get from explicitly writing the copy constructor, so that CodeGen need only do a direct translation. However, it's not quite that simple because one cannot explicit write elementwise copy-construction of an array. So, I've extended CXXBaseOrMemberInitializer to contain a list of indexing variables used to copy-construct the elements. For example, if we have: struct A { A(const A&); }; struct B { A array[2][3]; }; then we generate an implicit copy assignment operator for B that looks something like this: B::B(const B &other) : array[i0][i1](other.array[i0][i1]) { } CodeGen will loop over the invented variables i0 and i1 to visit all elements in the array, so that each element in the destination array will be copy-constructed from the corresponding element in the source array. Of course, if we're dealing with arrays of scalars or class types with trivial copy-assignment operators, we just generate a memcpy rather than a loop. Fixes PR6928, PR5989, and PR6887. Boost.Regex now compiles and passes all of its regression tests. Conspicuously missing from this patch is handling for the exceptional case, where we need to destruct those objects that we have constructed. I'll address that case separately. llvm-svn: 103079
* Unbreak CMake build.Douglas Gregor2010-05-051-1/+1
| | | | llvm-svn: 103077
* Change StmtNodes.def to StmtNodes.td in anticipation of a rewrite of attributesAlexis Hunt2010-05-051-213/+213
| | | | llvm-svn: 103072
* When instantiating a function that was declared via a typedef, e.g.,Douglas Gregor2010-05-044-5/+28
| | | | | | | | | | | | | typedef int functype(int, int); functype func; also instantiate the synthesized function parameters for the resulting function declaration. With this change, Boost.Wave builds and passes all of its regression tests. llvm-svn: 103025
* When creating a call to a base subobject's operator= in anDouglas Gregor2010-05-041-4/+29
| | | | | | | | | implicitly-defined copy assignment operator, suppress the protected access check. This eliminates the remaining failure in the Boost.SmartPtr library (that was a product of the copy-assignment generation rewrite) and, presumably, the Boost.TR1 library as well. llvm-svn: 103010
* An access is permitted if the current template instantiates to the appropriateJohn McCall2010-05-041-3/+29
| | | | | | class. Add some conservative support for the idea. Fixes PR 7024. llvm-svn: 102999
* When inheriting a default argument expression, inherit the full expression,John McCall2010-05-041-2/+4
| | | | | | | | | not just the inner expression. This is important if the expression has any temporaries. Fixes PR 7028. Basically a symptom of really tragic method names. llvm-svn: 102998
OpenPOWER on IntegriCloud