summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Instantiate class member template partial specialization declarationsDouglas Gregor2010-11-102-98/+49
| | | | | | | | | in the order they occur within the class template, delaying out-of-line member template partial specializations until after the class has been fully instantiated. This fixes a regression introduced by r118454 (itself a fix for PR8001). llvm-svn: 118704
* Check for duplicate declaration of a property in current andFariborz Jahanian2010-11-101-9/+16
| | | | | | other class extensions. // rdar://7629420 llvm-svn: 118689
* Propagate the deprecated and unavailable attributes from aJohn McCall2010-11-101-0/+17
| | | | | | | | | | @property declaration to the autogenerated methods. I'm uncertain whether this should apply to attributes in general, but these are a reasonable core. Implements rdar://problem/8617301 llvm-svn: 118676
* Region-allocate all AttributeList objects from a factory object instead of ↵Ted Kremenek2010-11-103-24/+10
| | | | | | | | | | | | | | | | | | | | | | | | manually managing them using new/delete and OwningPtrs. After memory profiling Clang, I witnessed periodic leaks of these objects; digging deeper into the code, it was clear that our management of these objects was a mess. The ownership rules were murky at best, and not always followed. Worse, there are plenty of error paths where we could screw up. This patch introduces AttributeList::Factory, which is a factory class that creates AttributeList objects and then blows them away all at once. While conceptually simple, most of the changes in this patch just have to do with migrating over to the new interface. Most of the changes have resulted in some nice simplifications. This new strategy currently holds on to all AttributeList objects during the lifetime of the Parser object. This is easily tunable. If we desire to have more bound the lifetime of AttributeList objects more precisely, we can have the AttributeList::Factory object (in Parser) push/pop its underlying allocator as we enter/leave key methods in the Parser. This means that we get simple memory management while still having the ability to finely control memory use if necessary. Note that because AttributeList objects are now BumpPtrAllocated, we may reduce malloc() traffic in many large files with attributes. This fixes the leak reported in: <rdar://problem/8650003> llvm-svn: 118675
* Friend function declarations can overload with tag declarations.John McCall2010-11-101-1/+3
| | | | | | Fixes PR7915. llvm-svn: 118670
* Diagnose attempst to template using declarations and using directives.John McCall2010-11-102-8/+20
| | | | | | Recover from the latter and fail early for the former. Fixes PR8022. llvm-svn: 118669
* Tweak to bitfield-overflow warning: don't warn about storingJohn McCall2010-11-101-1/+8
| | | | | | | a positive value into a signed bitfield of the exact width of the value. llvm-svn: 118657
* Add a warning for implicit truncation of constant values due toJohn McCall2010-11-091-3/+55
| | | | | | | | bitfield assignment. Implements rdar://problem/7809123 llvm-svn: 118647
* Split out -Wconversion warnings about constant precision into theirJohn McCall2010-11-091-0/+26
| | | | | | | | | | | own subcategory, -Wconstant-conversion, which is on by default. Tweak the constant folder to give better results in the invalid case of a negative shift amount. Implements rdar://problem/6792488 llvm-svn: 118636
* Test moved to its correct place.Fariborz Jahanian2010-11-091-12/+0
| | | | llvm-svn: 118635
* Restore patch reversed in r118475. FixesFariborz Jahanian2010-11-092-0/+17
| | | | | | // rdar://8632525 llvm-svn: 118634
* Attempt to resolve overloaded functions in comma expressions andDouglas Gregor2010-11-091-0/+24
| | | | | | conditional operators. Fixes PR7863. llvm-svn: 118631
* tidy upChris Lattner2010-11-091-5/+4
| | | | llvm-svn: 118626
* Revert the fix for PR8013.Douglas Gregor2010-11-092-8/+6
| | | | | | | | | | | | | That bug concerned the well-formedness of code such as (&ovl)(a, b, c). GCC rejects the code, while EDG accepts it. On further study of the standard, I see no support for EDG's position: in particular, C++ [over.over] does not list this as a context where we can take the address of an overloaded function, C++ [over.call.func] does not reference the address-of operator at any point, and C++ [expr.call] claims that the function argument in a call is either a function lvalue or a pointer-to-function; (&ovl) is neither. llvm-svn: 118620
* Handle overload resolution when calling an overloaded function setDouglas Gregor2010-11-092-6/+8
| | | | | | with, e.g., (&f)(a, b, c). Fixes PR8013. llvm-svn: 118508
* Make #pragma unused work for static local variables.Douglas Gregor2010-11-091-1/+1
| | | | llvm-svn: 118500
* Teach code completion not to include out-of-line declarations andDouglas Gregor2010-11-091-1/+8
| | | | | | | definitions in its results. The original declarations will be visible wherever they are declared. llvm-svn: 118484
* Fix source locations in unnamed bitfield diagnostic, from JakubDouglas Gregor2010-11-091-0/+5
| | | | | | Wieczorek! Fixes PR8025. llvm-svn: 118481
* Fix warning about unused variable 'Fn' in no-asserts builds. Also reflow thisNick Lewycky2010-11-091-8/+5
| | | | | | block so that it looks more like the rest of the file. No functional change. llvm-svn: 118459
* Don't lose track of previous-declarations when instantiating a class template.Nick Lewycky2010-11-081-1/+11
| | | | | | Fixes PR8001. llvm-svn: 118454
* If an instance method messages is sending to an expression of type Class,Douglas Gregor2010-11-081-8/+15
| | | | | | | | and we statically can compute a bound on the actual type (e.g., because it's a send to the the magic "class" instance method), code complete as if we were performing a class message send to that class. llvm-svn: 118443
* When building a compound literal, check that the base element of the array ↵Argyrios Kyrtzidis2010-11-081-0/+5
| | | | | | | | is complete. Fixes rdar://8620582 & http://llvm.org/PR7905 llvm-svn: 118428
* Improve our handling of C++ [class.copy]p3, which specifies that aDouglas Gregor2010-11-082-9/+31
| | | | | | | | | constructor template will not be used to copy a class object to a value of its own type. We were eliminating all constructor templates whose specializations look like a copy constructor, which eliminated important candidates. Fixes PR8182. llvm-svn: 118418
* When attempting reference binding to an overloaded function, alsoDouglas Gregor2010-11-081-10/+13
| | | | | | | consider that we might be trying to bind a reference to a class type, which involves a constructor call. Fixes PR7425. llvm-svn: 118407
* Properly diagnose invalid casts to function references. Patch byDouglas Gregor2010-11-083-14/+100
| | | | | | Faisal Vali, tweaked by me. Fixes PR8230. llvm-svn: 118400
* Remove broken support for variadic templates, along with the variousDouglas Gregor2010-11-075-121/+111
| | | | | | | | | | | | | abstractions (e.g., TemplateArgumentListBuilder) that were designed to support variadic templates. Only a few remnants of variadic templates remain, in the parser (parsing template type parameter packs), AST (template type parameter pack bits and TemplateArgument::Pack), and Sema; these are expected to be used in a future implementation of variadic templates. But don't get too excited about that happening now. llvm-svn: 118385
* A union cannot contain static data members or data members of reference type.Anders Carlsson2010-11-071-11/+30
| | | | llvm-svn: 118381
* Fix memory leak of IdentifierIterator object.Ted Kremenek2010-11-071-1/+1
| | | | llvm-svn: 118371
* When determining which template partial specialization is more specialized,Argyrios Kyrtzidis2010-11-051-2/+8
| | | | | | make sure to setup the instantiation stack. Fixes rdar://8620775 & http://llvm.org/PR8234 llvm-svn: 118314
* When searching for an instantiated declaration requires instantiationDouglas Gregor2010-11-051-0/+2
| | | | | | | | of its parent context, be sure to update the parent-context pointer after instantiation. Fixes two anonymous-union instantiation issues in <rdar://problem/8635664>. llvm-svn: 118313
* Check for an invalid field earlier in a constructor's initializationDouglas Gregor2010-11-051-3/+3
| | | | | | | | | | | of that field. Otherwise, we can end up building and later trying to instantiate a dependent member initializer that will fail at instantiation time. Unfortunately, I've only managed to trigger this bug with very large sources, so there's no test case :( llvm-svn: 118306
* Expressions of type std::nullptr_t can be used as sentinels.Anders Carlsson2010-11-051-0/+4
| | | | llvm-svn: 118276
* Implement [over.ics.rank]p4: A conversion that does not convert an ↵Anders Carlsson2010-11-051-0/+1
| | | | | | std::nullptr_t to bool is better than one than does. llvm-svn: 118269
* Use the real keyword location when rebuilding an elaborated type instead ofJohn McCall2010-11-042-7/+11
| | | | | | making something up. Fixes PR8129. llvm-svn: 118258
* std::nullptr_t is a fundamental type for RTTI purposes.Anders Carlsson2010-11-041-1/+1
| | | | llvm-svn: 118238
* Don't instantiate members not belonging in the semantic context of the template.Argyrios Kyrtzidis2010-11-041-0/+12
| | | | | | | | | | | | | | | e.g. for: template <int i> class A { class B *g; }; 'class B' has the template as lexical context but semantically it is introduced in namespace scope. Fixes rdar://8611125 & http://llvm.org/PR8505 llvm-svn: 118235
* It's OK to use nullptr in relational operators if the other side is a null ↵Anders Carlsson2010-11-041-6/+7
| | | | | | pointer constant. llvm-svn: 118234
* When producing overload candidates for binary built-in operators, keepDouglas Gregor2010-11-031-123/+258
| | | | | | | | | the sets of available conversions for the first and second arguments separate. This is apparently the indent of C++ [over.built], and reduces the number of overload candidates generated, eliminating some ambiguities. Fixes PR8477. llvm-svn: 118178
* Provide an error when a non-identifier name (such as an operator) is used as aAlexis Hunt2010-11-031-1/+11
| | | | | | | | parameter name. Fixes PR8012. llvm-svn: 118138
* Improve source-location information for CXXConstructExpr nodes, byDouglas Gregor2010-11-031-1/+3
| | | | | | | | | ensuring that they cover all of their child nodes. There's still a clang_getCursor()-related issue with CXXFunctionalCastExprs with CXXConstructExprs as children (see FIXME in the test case); I'll look at that separately. llvm-svn: 118132
* Teach code completion to provide property results when the propertyDouglas Gregor2010-11-023-18/+85
| | | | | | can be used to automatically synthesize an ivar. llvm-svn: 118052
* Properly handle temporaries that are created in a AsmStmt.Argyrios Kyrtzidis2010-11-021-0/+26
| | | | | | Previously the temporaries would get destroyed before the asm call. llvm-svn: 118001
* When performing template argument deduction against a template-id,Douglas Gregor2010-11-021-2/+9
| | | | | | | only keep deduction results for successful deductions, so that they can be compared against each other. Fixes PR8462, from Richard Smith! llvm-svn: 117983
* Eliminate an unused local variableDouglas Gregor2010-11-011-2/+0
| | | | llvm-svn: 117963
* Harden Sema::MaybeBindTotemporary.Douglas Gregor2010-11-011-0/+3
| | | | llvm-svn: 117954
* Emit error when using a bound member function for something other than ↵Argyrios Kyrtzidis2010-11-013-0/+19
| | | | | | | | calling it. Also avoids IRGen crashes due to accepting invalid code. llvm-svn: 117943
* Require that the types of the parameters of a block literal are complete.Douglas Gregor2010-11-013-16/+15
| | | | llvm-svn: 117942
* Preserve the template type parameter name when instantiating a templace.Nick Lewycky2010-10-301-1/+1
| | | | | | Fixes PR8489. llvm-svn: 117776
* Don't remove the init expression from the initializer list if it had a ↵Argyrios Kyrtzidis2010-10-301-1/+0
| | | | | | | | | semantic error. We already flag the error with InitListChecker's hadError and we mess up the AST unnecessarily. Fixes rdar://8605381. llvm-svn: 117760
* When list-initializing a vector, try to copy-initialize from vectors insteadJohn McCall2010-10-301-53/+82
| | | | | | | | of descending into the subelements. rdar://problem/8345836 llvm-svn: 117749
OpenPOWER on IntegriCloud