summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* In C++98/03, when binding a reference to an rvalue ofDouglas Gregor2010-04-183-16/+95
| | | | | | | | | | | | | | | | | reference-compatible type, the implementation is permitted to make a copy of the rvalue (or many such copies, even). However, even though we don't make that copy, we are required to check for the presence of a suitable copy constructor. With this change, we do. Note that in C++0x we are not allowed to make these copies, so we test both dialects separately. Also note the FIXME in one of the C++03 tests, where we are not instantiating default function arguments for the copy constructor we pick (but do not call). The fix is obvious; eliminating the infinite recursion it causes is not. Will address that next. llvm-svn: 101704
* Allow the 'ibaction' attribute to be attached to method declarations (and ↵Ted Kremenek2010-04-181-2/+12
| | | | | | not issue a warning). llvm-svn: 101699
* Do not consider explicit constructors when performing a copy to aDouglas Gregor2010-04-181-1/+2
| | | | | | | | | temporary object. This is blindingly obvious from reading C++ [over.match.ctor]p1, but somehow I'd missed it and it took DR152 to educate me. Adjust one test that was relying on this non-standard behavior. llvm-svn: 101688
* Improve our handling of user-defined conversions as part of overloadDouglas Gregor2010-04-174-77/+138
| | | | | | | | | | | | | | | | | resolution. There are two sources of problems involving user-defined conversions that this change eliminates, along with providing simpler interfaces for checking implicit conversions: - It eliminates a case of infinite recursion found in Boost. - It eliminates the search for the constructor needed to copy a temporary generated by an implicit conversion from overload resolution. Overload resolution assumes that, if it gets a value of the parameter's class type (or a derived class thereof), there is a way to copy if... even if there isn't. We now model this properly. llvm-svn: 101680
* Vtable -> VTable renames across the board.Anders Carlsson2010-04-171-2/+2
| | | | llvm-svn: 101666
* Add raw_ostream operators to NamedDecl for convenience. Switch over all ↵Benjamin Kramer2010-04-173-4/+3
| | | | | | | | users of getNameAsString on a stream. The next step is to print the name directly into the stream, avoiding a temporary std::string copy. llvm-svn: 101632
* Consolidate most of the integer constant expression builtin requirementEric Christopher2010-04-172-70/+52
| | | | | | | | checking into a single function and use that throughout. Remove some now unnecessary diagnostics and update tests with now more accurate diagnostics. llvm-svn: 101610
* make our existing "switch on bool" warning work for C. SinceChris Lattner2010-04-161-1/+1
| | | | | | | the result of comparisons are 'int' in C, it doesn't work to test just the result type of the expression. llvm-svn: 101576
* If a non-noreturn virtual member function is guaranteed not to return,Douglas Gregor2010-04-161-5/+16
| | | | | | | do *not* suggest that the function could be attribute 'noreturn'; overridden functions may end up returning. llvm-svn: 101572
* Switch Sema::FindCompositePointerType() over to InitializationSequence. Douglas Gregor2010-04-163-42/+72
| | | | | | | This is the last of the uses of TryImplicitConversion outside of overload resolution and InitializationSequence itself. llvm-svn: 101569
* Move Sema::PerformImplicitConversion over to where ↵Douglas Gregor2010-04-162-24/+24
| | | | | | Sema::TryImplicitConversion is, for my own sanity. No functionality change llvm-svn: 101554
* Make Sema::BuildCXXCastArgument static, since it now only has one caller. No ↵Douglas Gregor2010-04-162-44/+40
| | | | | | functionality change llvm-svn: 101550
* Collapse the three separate initialization paths inDouglas Gregor2010-04-169-234/+51
| | | | | | | | | | | | | | | | | | TryStaticImplicitCast (for references, class types, and everything else, respectively) into a single invocation of InitializationSequence. One of the paths (for class types) was the only client of Sema::TryInitializationByConstructor, which I have eliminated. This also simplified the interface for much of the cast-checking logic, eliminating yet more code. I've kept the representation of C++ functional casts with <> 1 arguments the same, despite the fact that I hate it. That fix will come soon. To satisfy my paranoia, I've bootstrapped + tested Clang with these changes. llvm-svn: 101549
* Switch the checking of implicit casts for static_cast, C-style, andDouglas Gregor2010-04-162-22/+23
| | | | | | | | | | functional casts over to InitializationSequence, eliminating a caller of Sema::TryImplicitConversion. We also get access and ambiguity checking "for free". More cleanups to come in this routine. llvm-svn: 101526
* Kill ForceRValue once and for allDouglas Gregor2010-04-165-17/+2
| | | | llvm-svn: 101502
* Eliminate the ForceRValue parameter from TryCopyInitialization.Douglas Gregor2010-04-161-9/+2
| | | | llvm-svn: 101498
* Move Sema::TryCopyInitialization into a static function inDouglas Gregor2010-04-162-29/+24
| | | | | | SemaOverload.cpp; no functionality change. llvm-svn: 101497
* Eliminate ForceRValue parameters from reference binding. Did I mentionDouglas Gregor2010-04-162-14/+9
| | | | | | that we aren't using ForceRValue any more? llvm-svn: 101496
* Silence warning.Benjamin Kramer2010-04-161-1/+1
| | | | llvm-svn: 101495
* Eliminate the ForceRValue parameter to Sema::AddOverloadCandidateDouglas Gregor2010-04-163-10/+6
| | | | llvm-svn: 101494
* Eliminate the ForceRValue parameter from most of Sema's Add*CandidateDouglas Gregor2010-04-162-25/+17
| | | | | | functions. llvm-svn: 101492
* Eliminate the ForceRValue parameter from Sema::IsUserDefinedConversion. It's ↵Douglas Gregor2010-04-162-8/+5
| | | | | | not the way we're going to handle this. llvm-svn: 101483
* Eliminate the default value for the UserCast parameter of ↵Douglas Gregor2010-04-162-2/+2
| | | | | | Sema::IsUserDefinedConversion. No functionality change llvm-svn: 101482
* Eliminate the Elidable parameter to PerformImplicitConversion; weDouglas Gregor2010-04-163-27/+10
| | | | | | don't need it. llvm-svn: 101481
* Start working on handling wide bitfields in C++Anders Carlsson2010-04-161-4/+16
| | | | llvm-svn: 101464
* Expand the argument diagnostics for too many arguments and giveEric Christopher2010-04-163-8/+15
| | | | | | | | both number seen and number expected. Finishes fixing PR6501. llvm-svn: 101442
* Expand argument diagnostic for too few arguments to give the numberEric Christopher2010-04-163-13/+23
| | | | | | | | of arguments both seen and expected. Fixes PR6501. llvm-svn: 101441
* Audit uses of Sema::LookupSingleName for those lookups that areDouglas Gregor2010-04-153-15/+13
| | | | | | | | | | | 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). llvm-svn: 101419
* Feed proper source-location information into Sema::LookupSingleResult,Douglas Gregor2010-04-1510-62/+98
| | | | | | | | in case it ends up doing something that might trigger diagnostics (template instantiation, ambiguity reporting, access reporting). Noticed while working on PR6831. llvm-svn: 101412
* Improve the bit-field too wide error message.Anders Carlsson2010-04-151-2/+2
| | | | llvm-svn: 101384
* Diagnose attempts to throw an abstract class type.Douglas Gregor2010-04-151-0/+5
| | | | llvm-svn: 101381
* Fix a few cases where enum constant handling was usingDouglas Gregor2010-04-151-3/+3
| | | | | | | | | | ASTContext::getTypeSize() rather than ASTContext::getIntWidth() for the width of an integral type. The former includes padding for bools (to the target's size) while the latter does not, so we woud end up zero-extending bools to the target width when we shouldn't. Fixes a crash-on-valid in the included test. llvm-svn: 101372
* Warn about non-aggregate classes with no user-declared constructorsDouglas Gregor2010-04-151-0/+24
| | | | | | | that have reference or const scalar members, since those members can never be initializer or modified. Fixes <rdar://problem/7804350>. llvm-svn: 101316
* Always diagnose and complain about problems inDouglas Gregor2010-04-143-69/+89
| | | | | | | | | | ResolveAddressOfOverloadedFunction when asked to complain. Previously, we had some weird handshake where ResolveAddressOfOverloadedFunction expected its caller to handle some of the diagnostics but not others, and yet there was no way for the caller to know which case we were in. Eliminate this madness, fixing <rdar://problem/7765884>. llvm-svn: 101312
* Thread a Scope pointer into BuildRecoveryCallExpr to help typoDouglas Gregor2010-04-143-6/+6
| | | | | | | correction find names when a call failed. Fixes <rdar://problem/7853795>. llvm-svn: 101278
* Teach typo correction about various language keywords. We can'tDouglas Gregor2010-04-1410-105/+409
| | | | | | | | | | | | | generally recover from typos in keywords (since we would effectively have to mangle the token stream). However, there are still benefits to typo-correcting with keywords: - We don't make stupid suggestions when the user typed something that is similar to a keyword. - We can suggest the keyword in a diagnostic (did you mean "static_cast"?), even if we can't recover and therefore don't have a fix-it. llvm-svn: 101274
* Return the corrected DeclarationName from Sema::CorrectTypo ratherDouglas Gregor2010-04-142-19/+23
| | | | | | | | than just a bool indicating that correction occurred. No actual functionality change (it's still always used like a bool), but this refactoring will be used to support typo correction to keywords. llvm-svn: 101259
* When diagnosing suspicious precedence or assignments, move the fix-itDouglas Gregor2010-04-141-20/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | that adds parentheses from the main diagnostic down to a new note. This way, when the fix-it represents a choice between two options, each of the options is associted with a note. There is no default option in such cases. For example: /Users/dgregor/t.c:2:9: warning: & has lower precedence than ==; == will be evaluated first [-Wparentheses] if (x & y == 0) { ^~~~~~~~ /Users/dgregor/t.c:2:9: note: place parentheses around the & expression to evaluate it first if (x & y == 0) { ^ ( ) /Users/dgregor/t.c:2:9: note: place parentheses around the == expression to silence this warning if (x & y == 0) { ^ ( ) llvm-svn: 101249
* remove some obsolete super-handling code that I forgot to zap.Chris Lattner2010-04-141-30/+0
| | | | llvm-svn: 101212
* Implement typo correction for Objective-C message sends when theDouglas Gregor2010-04-142-0/+61
| | | | | | | | | | | | | | | | | | | | | receiver is a mis-typed class name. Previously, we would give a non-specific typo-correction diagnostic from the expression-parsing code, but there was no fix-it because it was too late to recover. Now, we give a nice diagnostic honk.m:6:4: error: unknown receiver 'Hnk'; did you mean 'Honk'? [Hnk method]; ^~~ Honk honk.m:1:1: note: 'Honk' declared here @interface Honk ^ which includes a fix-it. We still need to recover better from mis-typing "super". llvm-svn: 101211
* Mark a function declaration invalid if any of its parameter declarationsJohn McCall2010-04-141-0/+3
| | | | | | | are invalid. Prevents a crash-on-invalid during template instantiation. I... really don't understand how this wasn't already present. llvm-svn: 101203
* Use ASTVector instead of std::vector for the Exprs in InitListExpr. PerformanceTed Kremenek2010-04-132-10/+13
| | | | | | | measurements of '-fsyntax-only' on combine.c (403.gcc) shows no real performance change, but now the vector isn't leaked. llvm-svn: 101195
* Support befriending members of class template specializations.John McCall2010-04-133-8/+38
| | | | llvm-svn: 101173
* Twik to radar 7839485. Do not attach weak_import attribute to classFariborz Jahanian2010-04-131-3/+3
| | | | | | for non-fragile abi on darwin. llvm-svn: 101168
* Turn off warning about weak_import attributeFariborz Jahanian2010-04-131-3/+1
| | | | | | on objc classes for Darwin. Radar 7839485. llvm-svn: 101164
* Refactor and simplify the computation of implicit conversion sequencesDouglas Gregor2010-04-133-493/+334
| | | | | | | | | | | | | for reference binding. The code attempted to handle both the computation of the ICS and the actual conversion, but the latter is an anachronism: we now use InitializationSequence for that. Sema::CheckReferenceInit is now a static function TryReferenceInit that's only use within overload resolution, and has been simplified slightly. It still needs to be updated per C++ [over.ics.ref], by eliminating more of the lvalue/rvalue checks. llvm-svn: 101136
* When returning the result of a call to an object of class type, do notDouglas Gregor2010-04-131-2/+2
| | | | | | | return a NULL expression; return either an error or a proper expression. Fixes PR6078. llvm-svn: 101133
* During referencing binding, only consider conversion functions forDouglas Gregor2010-04-131-7/+9
| | | | | | | direct reference binding when the source and target types are not reference-related. Fixes PR6066. llvm-svn: 101132
* Allow classes to befriend implicitly-declared members. Fixes PR6207 forJohn McCall2010-04-132-11/+24
| | | | | | members of non-templated classes. llvm-svn: 101122
* Parse constructor names in friend declarations. Part of the fix forJohn McCall2010-04-131-1/+8
| | | | | | PR6207. llvm-svn: 101119
OpenPOWER on IntegriCloud