Commit Graph

634 Commits

Author SHA1 Message Date
Douglas Gregor b491ed36b4 Handle the resolution of a reference to a function template (which
includes explicitly-specified template arguments) to a function
template specialization in cases where no deduction is performed or
deduction fails. Patch by Faisal Vali, fixes PR7505!

llvm-svn: 126048
2011-02-19 21:32:49 +00:00
Fariborz Jahanian 12834e19c1 Use hasSameType in one more, hopefully, last place.
llvm-svn: 125468
2011-02-13 20:11:42 +00:00
Fariborz Jahanian 4de45dc6a7 Some refactoring and using more modern APIs for
implementation of co/contra-variance objc++
block pointers. // rdar://8979379.

llvm-svn: 125467
2011-02-13 20:01:48 +00:00
Fariborz Jahanian 42455ea935 Implement objective-c++'s block pointer type matching involving
types which are contravariance in argument types and covariance
in return types. // rdar://8979379.

llvm-svn: 125445
2011-02-12 19:07:46 +00:00
Peter Collingbourne 41f8546233 AST, Sema, Serialization: add CUDAKernelCallExpr and related semantic actions
llvm-svn: 125217
2011-02-09 21:07:24 +00:00
Sebastian Redl 0890502f44 Basic implementation of inherited constructors. Only generates declarations, and probably only works for very basic use cases.
llvm-svn: 124970
2011-02-05 19:23:19 +00:00
Douglas Gregor 058d3deab8 Implement reasonable conversion ranking for Objective-C pointer
conversions (<rdar://problem/8592139>) for overload resolution. The
conversion ranking mirrors C++'s conversion ranking fairly closely,
except that we use a same pseudo-subtyping relationship employed by
Objective-C pointer assignment rather than simple checking
derived-to-base conversions. This change covers:

  - Conversions to pointers to a specific object type are better than
  conversions to 'id', 'Class', qualified 'id', or qualified 'Class'
  (note: GCC doesn't perform this ranking, but it matches C++'s rules
  for ranking conversions to void*).
  - Conversions to qualified 'id' or qualified 'Class' are better than
  conversions to 'id' or 'Class', respectively.
  - When two conversion sequences convert to the same type, rank the
  conversions based on the relationship between the types we're
  converting from. 
  - When two conversion sequences convert from the same non-id,
  non-Class type, rank the conversions based on the relationship of
  the types we're converting to. (note: GCC allows this ranking even
  when converting from 'id', which is extremeley dangerous).

llvm-svn: 124591
2011-01-31 18:51:41 +00:00
NAKAMURA Takumi f9cbcc4cc2 Fix whitespace.
llvm-svn: 124364
2011-01-27 07:10:08 +00:00
NAKAMURA Takumi 7c2888689d 7bit-ize.
llvm-svn: 124363
2011-01-27 07:09:49 +00:00
Douglas Gregor 582813596a Fix a horrible bug in our handling of C-style casting, where a C-style
derived-to-base cast that also casts away constness (one of the cases
for static_cast followed by const_cast) would be treated as a bit-cast
rather than a derived-to-base class, causing miscompiles and
heartburn.

Fixes <rdar://problem/8913298>.

llvm-svn: 124340
2011-01-27 00:58:17 +00:00
Douglas Gregor c83f9865a0 Implement the restriction that a function with a ref-qualifier cannot
overload a function without a ref-qualifier (C++0x
[over.load]p2). This, apparently, completes the implementation of
rvalue references for *this.

llvm-svn: 124321
2011-01-26 21:20:37 +00:00
Douglas Gregor e1a47c1766 Rvalue references for *this: explicitly keep track of whether a
reference binding is for the implicit object parameter of a member
function with a ref-qualifier. My previous comment, that we didn't
need to track this explicitly, was wrong: we do in fact get
rvalue-references-prefer-rvalues overloading with ref-qualifiers.

llvm-svn: 124313
2011-01-26 19:41:18 +00:00
Douglas Gregor 0282432039 Rvalue references for *this: implement the implicit conversion rules
for the implicit object argument to a non-static member function with
a ref-qualifier (C++0x [over.match.funcs]p4).

llvm-svn: 124311
2011-01-26 19:30:28 +00:00
Douglas Gregor b2f8aa9556 Rvalue references for *this: allow functions to be overloaded based on
the presence and form of a ref-qualifier. Note that we do *not* yet
implement the restriction in C++0x [over.load]p2 that requires either
all non-static functions with a given parameter-type-list to have a
ref-qualifier or none of them to have a ref-qualifier.

llvm-svn: 124297
2011-01-26 17:47:49 +00:00
Douglas Gregor e696ebbd70 Reinstate r124236 (tweaking the rvalue-reference overload resolution
rules), now that we've actually have a clean build for me to sully.

llvm-svn: 124290
2011-01-26 14:52:12 +00:00
Douglas Gregor 41e4e2c798 Speculatively revert r124236
llvm-svn: 124247
2011-01-25 23:49:36 +00:00
Douglas Gregor 407371a1e4 Speculatively implement a tweak to the C++0x overload resolution rules
for reference binding (C++ [over.rank.ics]p3b1sb4), so that we prefer
the binding of an lvalue reference to a function lvalue over the
binding of an rvalue reference. This change resolves the ambiguity
with std::forward and lvalue references to function types in a way
that seems consistent with the original rvalue references proposal.

My proposed wording for this change is shown in
isBetterReferenceBindingKind(); we'll try to get this change adopted
in the C++0x working paper as well.

llvm-svn: 124236
2011-01-25 22:19:32 +00:00
Douglas Gregor 1c5a53e200 Fix the ranking of reference bindings during overload resolution
(C++0x [over.ics.rank]p3) when one binding is an lvalue reference and
the other is an rvalue reference that binds to an rvalue. In
particular, we were using the predict "is an rvalue reference" rather
than "is an rvalue reference that binds to an rvalue", which was
incorrect in the one case where an rvalue reference can bind to an
lvalue: function references.

This particular issue cropped up with std::forward, where Clang was
picking an std::forward overload while forwarding an (lvalue)
reference to a function. However (and unfortunately!), the right
answer for this code is that the call to std::forward is
ambiguous. Clang now gets that right, but we need to revisit the
std::forward implementation in libc++.

llvm-svn: 124216
2011-01-25 19:39:31 +00:00
Douglas Gregor f143cd5051 Re-instate r123977/r123978, my updates of the reference-binding
implementation used by overload resolution to support rvalue
references. The original commits caused PR9026 and some
hard-to-reproduce self-host breakage.

The only (crucial!) difference between this commit and the previous
commits is that we now properly check the SuppressUserConversions flag
before attempting to perform a second user-defined conversion in
reference binding, breaking the infinite recursion chain of
user-defined conversions.

Rvalue references should be working a bit better now.

llvm-svn: 124121
2011-01-24 16:14:37 +00:00
Rafael Espindola be468d9a2b revert r123977 and r123978 to fix PR9026.
llvm-svn: 124033
2011-01-22 15:32:35 +00:00
Douglas Gregor cc73795cd8 Add test for overload resolution's preference for binding an rvalue
reference to an rvalue rather than binding a const-qualified lvalue
reference to that rvalue.

llvm-svn: 123979
2011-01-21 16:48:38 +00:00
Douglas Gregor e916d0508b Eliminate an unused variable
llvm-svn: 123978
2011-01-21 16:37:29 +00:00
Douglas Gregor 95273c3a22 Update the reference-binding implementation used for overload
resolution to match the latest C++0x working paper's semantics. The
implementation now matching up with the reference-binding
implementation used for initialization.

llvm-svn: 123977
2011-01-21 16:36:05 +00:00
Douglas Gregor cba72b1f62 Implement the special template argument deduction rule for T&& in a
call (C++0x [temp.deduct.call]p3).

As part of this, start improving the reference-binding implementation
used in the computation of implicit conversion sequences (for overload
resolution) to reflect C++0x semantics. It still needs more work and
testing, of course.

llvm-svn: 123966
2011-01-21 05:18:22 +00:00
Douglas Gregor 2bbfba0f0c When building a user-defined conversion sequence, keep track of the
declaration that name lookup actually found, so that we can use it for
access checking later on. Fixes <rdar://problem/8876150>.

llvm-svn: 123867
2011-01-20 01:32:05 +00:00
Douglas Gregor 668443efb1 Sema::BuildCXXMemberCallExpr() can fail due to access or ambiguities,
so allow it to propagate the failure outward. Fixes the crashing part
of <rdar://problem/8876150>.

llvm-svn: 123863
2011-01-20 00:18:04 +00:00
Douglas Gregor 6edd977c6f Explicitly track the number of call arguments provided when performing
overload resolution, so that we only use that number of call arguments
for partial ordering. Fixes PR9006, a recent regression.

llvm-svn: 123861
2011-01-19 23:54:39 +00:00
John McCall 33ddac05bb Change the canonical representation of array types to store qualifiers on the
outermost array types and not on the element type.  Move the CanonicalType
member from Type to ExtQualsTypeCommonBase;  the canonical type on an ExtQuals
node includes the qualifiers on the ExtQuals.  Assorted optimizations enabled
by this change.

getQualifiers(), hasQualifiers(), etc. should all now implicitly look through
array types.

llvm-svn: 123817
2011-01-19 10:06:00 +00:00
John McCall 424cec97bd Change QualType::getTypePtr() to return a const pointer, then change a
thousand other things which were (generally inadvertantly) relying on that.

llvm-svn: 123814
2011-01-19 06:33:43 +00:00
Francois Pichet 6422579411 Add support for explicit constructor calls in Microsoft mode.
For example: 

class A{ 
public:
  A& operator=(const A& that) {
      if (this != &that) {
          this->A::~A();
          this->A::A(that);  // <=== explicit constructor call.
      }
      return *this;
  }
};

More work will be needed to support an explicit call to a template constructor.

llvm-svn: 123735
2011-01-18 05:04:39 +00:00
Douglas Gregor b837ea4eee Implement C++ [temp.func.order]p5 more directly, by passing down the
number of explicit call arguments. This actually fixes an erroneous
test for [temp.deduct.partial]p11, where we were considering
parameters corresponding to arguments beyond those that were
explicitly provided.

llvm-svn: 123244
2011-01-11 17:34:58 +00:00
Douglas Gregor 7825bf3a12 Implement template argument deduction from a call to a function
template whose last parameter is a parameter pack. This allows us to
form a call to, e.g.,

  template<typename ...Args1, typename ...Args2>
  void f(std::pair<Args1, Args2> ...pairs);

given zero or more instances of "pair".

llvm-svn: 122973
2011-01-06 22:09:01 +00:00
Douglas Gregor 66990031e2 Many of the built-in operator candidates introduced into overload
resolution require that the pointed-to type be an object type, but we
weren't filtering out non-object types. Do so, fixing PR7851.

llvm-svn: 122853
2011-01-05 00:13:17 +00:00
Douglas Gregor 7f6ae6958c For member pointer conversions potentially involving derived-to-base
conversions, make sure that the (possibly) derived type is complete
before looking for base classes.

Finishes the fix for PR8801.

llvm-svn: 122363
2010-12-21 21:40:41 +00:00
John McCall 991eb4b319 Fix the noreturn conversion to only strip off a single level of indirection.
Apply the noreturn attribute while creating a builtin function's type.
Remove the getNoReturnType() API.

llvm-svn: 122295
2010-12-21 00:44:39 +00:00
Douglas Gregor a6e053e61a Variadic templates: extend the Expr class with a bit that specifies
whether the expression contains an unexpanded parameter pack, in the
same vein as the changes to the Type hierarchy. Compute this bit
within all of the Expr subclasses.

This change required a bunch of reshuffling of dependency
calculations, mainly to consolidate them inside the constructors and
to fuse multiple loops that iterate over arguments to determine type
dependence, value dependence, and (now) containment of unexpanded
parameter packs.

Again, testing is painfully sparse, because all of the diagnostics
will change and it is more important to test the to-be-written visitor
that collects unexpanded parameter packs.

llvm-svn: 121831
2010-12-15 01:34:56 +00:00
Chandler Carruth 00a3833638 Reduce the number of builtin operator overload candidates added in certain
cases. First, omit all builtin overloads when no non-record type is in the set
of candidate types. Second, avoid arithmetic type overloads for non-arithmetic
or enumeral types (counting vector types as arithmetic due to Clang
extensions). When heavily using constructs such as STL's '<<' based stream
logging, this can have a significant impact. One logging-heavy test case's
compile time dropped by 10% with this. Self-host shows 1-2% improvement in
compile time, but that's likely in the noise.

llvm-svn: 121665
2010-12-13 01:44:01 +00:00
Chandler Carruth c6586e52a9 Finish cleaning up the static utility code for adding builtin operator overload
candidates. They're now wrapped in nice APIs which hide the tables, etc. Also
removes some repetitive code from clients.

llvm-svn: 121634
2010-12-12 10:35:00 +00:00
Chandler Carruth 3b35b78dd0 Clean up the helpers used to compute the usual arithmetic conversions' result
type. Localize all of the logic within a single function rather than spreading
it throughout the class.

Also fixes a buglet where we failed to check for a RHS arithmetic type wider
than the LHS and return its canonical type. I've yet to produce a test case
that breaks because of this, but it was spotted by inspection by folks on the
IRC channel and is obviously correct now.

llvm-svn: 121633
2010-12-12 09:59:53 +00:00
Chandler Carruth 5659c0c480 Add a comment to a helper function.
llvm-svn: 121632
2010-12-12 09:22:45 +00:00
Chandler Carruth c02db8cfb3 Sink the logic to suppress builtin operator overloads in the presence of
user-defined operator overloads on the same enumeral types to the one place
where it is used.

In theory this removes wasted computation from several paths through this code,
but I'm not aware of a case where it actually matters. This is mostly for
cleanliness.

llvm-svn: 121630
2010-12-12 09:14:11 +00:00
Chandler Carruth 5184de0aff Reorder the cases in the switch to be more logically grouped (to my mind). If
others have another ordering they would prefer, I'm all ears, but this one made
it much easier for me to find the group of operators I'm interested in.

llvm-svn: 121629
2010-12-12 08:51:33 +00:00
Chandler Carruth 9de23cdb45 Remove the final goto from this switch making it explict which overload set is
added for binary operator&.

llvm-svn: 121628
2010-12-12 08:45:02 +00:00
Chandler Carruth 9694b9cdfb Fold away completely identical code with simple fallthrough.
llvm-svn: 121627
2010-12-12 08:41:34 +00:00
Chandler Carruth f9802446a5 Move and copy function calls around to remove the indirection through gotos
from the switch statement.

llvm-svn: 121626
2010-12-12 08:39:38 +00:00
Chandler Carruth 0375e95446 Simplify the flow through the switch by explicitly listing the added overloads
for a few cases.

llvm-svn: 121625
2010-12-12 08:32:28 +00:00
Chandler Carruth 8e543b3d46 Fix 80-column violations and reflowing some code to facilitate those fixes.
llvm-svn: 121624
2010-12-12 08:17:55 +00:00
Chandler Carruth 85c2d09a5a Begin the refactoring of how builtin operators are added to the overload
candidate set. This breaks apart a huge switch + goto system into distinct
methods on a class. It also places the current mess of tables and other static
state used in the process within that class.

This is still a work in progress. I did a few simplifications that jumped out
at me as I went, but I plan to iterate on this a bit before it's truly clean.
However, this is easily the most invasive chunk. I benchmarked it on
all-std-headers.cpp and an internal testcase that has a major hotspot in
overload resolution and saw no real performance impact.

llvm-svn: 121623
2010-12-12 08:11:30 +00:00
John McCall 717d9b0e2f It's kindof silly that ExtQuals has an ASTContext&, and we can use that
space better.  Remove this reference.  To make that work, change some APIs
(most importantly, getDesugaredType()) to take an ASTContext& if they
need to return a QualType.  Simultaneously, diminish the need to return a
QualType by introducing some useful APIs on SplitQualType, which is
just a std::pair<const Type *, Qualifiers>.

llvm-svn: 121478
2010-12-10 11:01:00 +00:00
Douglas Gregor c6bd1d32bf Objective-C pointer conversions to 'id' or qualified 'id' subsume
cv-qualification conversions. More specifically, there's an implicit
cv-qualification conversion (even one that drops qualifiers) when
converting to 'id' or qualified 'id'. Fixes <rdar://problem/8734046>.

llvm-svn: 121047
2010-12-06 22:09:19 +00:00
John McCall e26a872b02 Remove some defensive calls to EmitLoadOfPropertyRefLValue that shouldn't
be required, and then fix up some missing loads on overloaded-operator
paths which that exposed.

llvm-svn: 120896
2010-12-04 08:14:53 +00:00
Douglas Gregor 8d6d06761f Improve our handling of cv-qualifiers in Objective-C pointer
conversions. Previously, we would end up collapsing qualification
conversions into the Objective-C pointer conversion step, including
(possibly) stripping qualifiers that shouldn't be removed.

This generalizes BuildSimilarlyQualifiedPointerType() to also work on
Objective-C object pointers, then eliminates the (redundant, not
totally correct) BuildSimilarlyQualifiedObjCObjectPointerType()
function.

Fixes <rdar://problem/8714395>.

llvm-svn: 120607
2010-12-01 21:43:58 +00:00
John McCall 086a464e24 Switch a lot of call-sites over to using the new value-kind calculations.
llvm-svn: 120084
2010-11-24 05:12:34 +00:00
Nick Lewycky 9331ed89f8 A bundle of whitespace changes, separated out from the functional changes.
llvm-svn: 119886
2010-11-20 01:29:55 +00:00
John McCall 7decc9e4ea Calculate the value kind of an expression when it's created and
store it on the expression node.  Also store an "object kind",
which distinguishes ordinary "addressed" l-values (like
variable references and pointer dereferences) and bitfield,
@property, and vector-component l-values.

Currently we're not using these for much, but I aim to switch
pretty much everything calculating l-valueness over to them.
For now they shouldn't necessarily be trusted.

llvm-svn: 119685
2010-11-18 06:31:45 +00:00
Argyrios Kyrtzidis 9813d3221d Improve diagnostic for calling non-const method on const object. Fixes rdar://7743000
llvm-svn: 119336
2010-11-16 08:04:45 +00:00
John McCall 8cb679e4e1 Assorted work leading towards the elimination of CK_Unknown.
llvm-svn: 119138
2010-11-15 09:13:47 +00:00
Douglas Gregor 052caec1f3 When complaining about ambiguous overload resolution for a unary or
binary operator, provide the types.

llvm-svn: 119008
2010-11-13 20:06:38 +00:00
Douglas Gregor 72ebdabc5d When we're type-checking the result of calling a conversion function
(while computing user conversion sequences), make sure that a result
of class type is a complete class type. Had we gone through
ActOnCallExpr, this would have happened when we built the CallExpr.

Fixes PR8425.

llvm-svn: 119005
2010-11-13 19:36:57 +00:00
John McCall 528729872e Pre-compute all possible usual-arithmetic-conversions results for the
promoted arithmetic types for which builtin operator candidates are
emitted.  A few of these need further analysis.

Removes all the uses of UsualArithmeticConversionsType except the
core function in SemaExpr.cpp.

llvm-svn: 118988
2010-11-13 05:51:15 +00:00
John McCall 988ffb7a11 Store the list of arithmetic types as a static array of member pointers
instead of copying them all out at the start.  Not a significant
optimization.

llvm-svn: 118967
2010-11-13 02:01:09 +00:00
John McCall a8987a294d Friend function declarations can overload with tag declarations.
Fixes PR7915.

llvm-svn: 118670
2010-11-10 03:01:53 +00:00
Douglas Gregor bd6b17f4ef Improve our handling of C++ [class.copy]p3, which specifies that a
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
2010-11-08 17:16:59 +00:00
Douglas Gregor e81f58e180 Properly diagnose invalid casts to function references. Patch by
Faisal Vali, tweaked by me. Fixes PR8230.

llvm-svn: 118400
2010-11-08 03:40:48 +00:00
Anders Carlsson 7da7cc568f Implement [over.ics.rank]p4: A conversion that does not convert an std::nullptr_t to bool is better than one than does.
llvm-svn: 118269
2010-11-05 00:12:09 +00:00
Anders Carlsson ba37e1eb49 std::nullptr_t is a fundamental type for RTTI purposes.
llvm-svn: 118238
2010-11-04 05:28:09 +00:00
Douglas Gregor b37c9af75d When producing overload candidates for binary built-in operators, keep
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
2010-11-03 17:00:07 +00:00
John McCall c3007a2145 No really, we don't have a retain/release system for statements/expressions
anymore.

llvm-svn: 117357
2010-10-26 07:05:15 +00:00
John McCall 75851b1a7f Actually, that doesn't really work, and anyway we should choose
conversion to id over conversion to void*.

llvm-svn: 117355
2010-10-26 06:40:27 +00:00
John McCall f28e83a73a Consider conversions of Objective-C pointers to 'id' to be basically of
the same rank as conversions of normal pointers to 'void*'.

Also, resurrect a test case.

Fixes rdar://problem/8592139

llvm-svn: 117354
2010-10-26 06:23:29 +00:00
Douglas Gregor cd1d0b4f98 Implement the integral promotion rules for the C++0x char16_t and
char32_t character types and enable built-in overloaded operator
candidates for these types. Fixes PR8432.

llvm-svn: 117038
2010-10-21 18:04:08 +00:00
Douglas Gregor 8a8e0313bf Add builtin conditional operator candidates for scoped enumeration
types, from Alp Toker! Fixes PR8344.

llvm-svn: 116549
2010-10-15 00:50:56 +00:00
Douglas Gregor 7731d3fafc Teach the warning about unnamed/local types in template arguments to
actually walk the template argument type to find any unnamed/local
types within it. Fixes PR6784.

llvm-svn: 116382
2010-10-13 00:27:52 +00:00
Douglas Gregor 5bb5e4ad9d Introduce support for emitting diagnostics (warnings + their notes)
that are suppressed during template argument deduction. This change
queues diagnostics computed during template argument deduction. Then,
if the resulting function template specialization or partial
specialization is chosen by overload resolution or partial ordering
(respectively), we will emit the queued diagnostics at that point. 

This addresses most of PR6784. However, the check for unnamed/local
template arguments (which existed before this change) is still only
skin-deep, and needs to be extended to look deeper into types. It must
be improved to finish PR6784.

llvm-svn: 116373
2010-10-12 23:32:35 +00:00
Douglas Gregor 0bf3140424 Implement C++0x scoped enumerations, from Daniel Wallin! (and tweaked a
bit by me). 

llvm-svn: 116122
2010-10-08 23:50:27 +00:00
Douglas Gregor 4ed49f375d When performing template argument deduction of a function template
against a function type, be sure to check the type of the resulting
function template specialization against the desired function type
after substituting the deduced/defaulted template arguments. Fixes PR8196.

llvm-svn: 115086
2010-09-29 21:14:36 +00:00
Argyrios Kyrtzidis d6ea6bd2a3 Don't warn with -Wbool-conversions if the user wrote an explicit cast like "(void *)false".
Fixes rdar://8459342.

llvm-svn: 114955
2010-09-28 14:54:11 +00:00
Douglas Gregor ec3bec0c7a Kill FunctionDecl's IsCopyAssignment bit; it duplicated what could
already be determined by isCopyAssignmentOperator(), and was set too
late in the process for all clients to see the appropriate
value. Cleanup only; no functionality change.

llvm-svn: 114916
2010-09-27 22:37:28 +00:00
Fariborz Jahanian 8fb87aec78 Patch implements passing arrays to functions expecting
vla. Implements pr7827.

llvm-svn: 114737
2010-09-24 17:30:16 +00:00
Douglas Gregor bdd7b2358b Don't assert when attempting to take the address of an overloaded
function fails due to ambiguities in partial ordering of function
templates. Fixes PR8033.

llvm-svn: 113725
2010-09-12 08:16:09 +00:00
Douglas Gregor d5b730c9d5 When performing overload resolution, only compare the final conversion
sequences for two conversion functions when in fact we are in the text
of initialization by a user-defined conversion sequences. Fixes PR8034.

llvm-svn: 113724
2010-09-12 08:07:23 +00:00
Douglas Gregor 2bbc0266e0 Implement the "note" in C++ [over.built]p1, which is actually meant to
be a semantic requirement that a built-in overloaded operator is not
added to the overload set of there is already a user-defined
overloaded operator with the same parameter types. Fixes PR8087.

llvm-svn: 113713
2010-09-12 04:28:07 +00:00
Douglas Gregor c87f4d4aba Don't perform integral promotions from an incompletion enumeration
type. Fixes PR8089 in a slightly different way than had been suggested.

llvm-svn: 113711
2010-09-12 03:38:25 +00:00
Douglas Gregor ce5aa33385 Eliminate the comma locations from all of the Sema routines that deal
with comma-separated lists. We never actually used the comma
locations, nor did we store them in the AST, but we did manage to
waste time during template instantiation to produce fake locations.

llvm-svn: 113495
2010-09-09 16:33:13 +00:00
Argyrios Kyrtzidis 43b205796f Fix the memory leak of FloatingLiteral/IntegerLiteral.
For large floats/integers, APFloat/APInt will allocate memory from the heap to represent these numbers.
Unfortunately, when we use a BumpPtrAllocator to allocate IntegerLiteral/FloatingLiteral nodes the memory associated with
the APFloat/APInt values will never get freed.
I introduce the class 'APNumericStorage' which uses ASTContext's allocator for memory allocation and is used internally by FloatingLiteral/IntegerLiteral.

Fixes rdar://7637185

llvm-svn: 112361
2010-08-28 09:06:06 +00:00
John McCall 8d08b9b408 Propagate whether an id-expression is the immediate argument of
an '&' expression from the second caller of ActOnIdExpression.

Teach template argument deduction that an overloaded id-expression
doesn't give a valid type for deduction purposes to a non-static
member function unless the expression has the correct syntactic
form.

Teach ActOnIdExpression that it shouldn't try to create implicit
member expressions for '&function', because this isn't a        
permitted form of use for member functions.

Teach CheckAddressOfOperand to diagnose these more carefully.
Some of these cases aren't reachable right now because earlier
diagnostics interrupt them.

llvm-svn: 112258
2010-08-27 09:08:28 +00:00
John McCall faf5fb4b78 One who seeks knowledge learns something new every day.
One who seeks the Tao unlearns something new every day.
Less and less remains until you arrive at non-action.
When you arrive at non-action,
nothing will be left undone.

llvm-svn: 112244
2010-08-26 23:41:50 +00:00
John McCall 8302463dc6 Split out a header to hold APIs meant for the Sema implementation from Sema.h.
Clients of Sema don't need to know (for example) the list of diagnostics we
support.

llvm-svn: 112093
2010-08-25 22:03:47 +00:00
John McCall e302792b61 GCC didn't care for my attempt at API compatibility, so brute-force everything
to the new constants.

llvm-svn: 112047
2010-08-25 11:45:40 +00:00
John McCall 2536c6da0e More incremental progress towards not including Expr.h in Sema.h.
llvm-svn: 112044
2010-08-25 10:28:54 +00:00
John McCall 19c1bfd1b0 Move more stuff out of Sema.h.
llvm-svn: 112026
2010-08-25 05:32:35 +00:00
John McCall 7d46051eea Catch the case of trying to turn '&(X::a)' into a member pointer as well.
llvm-svn: 111997
2010-08-24 23:26:21 +00:00
John McCall 24d189484b When trying to resolve the address of an overloaded expression,
only form pointers-to-member if the expression has the appropriate
form.  This avoids assertions later on on invalid code, but also
allows us to properly resolve mixed-staticity overloads.

llvm-svn: 111987
2010-08-24 22:52:39 +00:00
John McCall 5c32be0053 Move some of SemaOverload's API to various places in Overload.h, and kill
some of it off completely.

llvm-svn: 111957
2010-08-24 20:38:10 +00:00
John McCall de6836a384 Struggle mightily against header inclusion in Sema.h.
llvm-svn: 111904
2010-08-24 07:21:54 +00:00
John McCall dadc575b1e OwningExprResult -> ExprResult. This patch brought to you by
M-x query-replace-regexp
\(Sema::\|Action::\|Parser::\|\)Owning\(Expr\|Stmt\)Result -> \2Result

llvm-svn: 111903
2010-08-24 06:29:42 +00:00
John McCall e172be555d Fold ASTOwningResult back into ActionResult.
llvm-svn: 111902
2010-08-24 06:09:16 +00:00
John McCall b268a282a4 Kill off ExprArg (now just Expr*) and StmtArg (now just Stmt*).
llvm-svn: 111863
2010-08-23 23:25:46 +00:00
Argyrios Kyrtzidis 421ad5e1e6 In Sema::AddBuiltinOperatorCandidates, candidate pointer types set can also contain a ObjCObjectPointerType since r111699.
Don't assume that they are only PointerTypes or we will crash.

llvm-svn: 111798
2010-08-23 07:12:16 +00:00
John McCall 37ad551a25 Sundry incremental steps towards killing off Action.
llvm-svn: 111795
2010-08-23 06:44:23 +00:00