summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Make sure to call PerformObjectMemberConversion where necessary.Eli Friedman2009-12-041-1/+4
| | | | llvm-svn: 90555
* Make the type of the Decl referred to by a MemberExpr a bit more precise.Eli Friedman2009-12-041-1/+1
| | | | llvm-svn: 90549
* Use a more rigorous definition of 'class member'. I don't have any evidenceJohn McCall2009-12-021-7/+19
| | | | | | that this was causing a problem, but it could have. llvm-svn: 90343
* Recognize that EnumConstantDecls can be found by lookup and are not instanceJohn McCall2009-12-021-0/+3
| | | | | | members. Fixes PR5667. llvm-svn: 90341
* Rip out the last remaining implicit use of OverloadedFunctionDecl in Sema:John McCall2009-12-021-2/+1
| | | | | | | LookupResult::getAsSingleDecl() is no more. Shift Sema::LookupSingleName to return null on overloaded results. llvm-svn: 90309
* Push overloaded function templates through the parser using a totally differentJohn McCall2009-12-021-3/+3
| | | | | | | leaked data structure than before. This kills off the last remaining explicit uses of OverloadedFunctionDecl in Sema. llvm-svn: 90306
* Stop trying to analyze class-hierarchies for dependently-scoped id-expressions;John McCall2009-12-021-17/+23
| | | | | | | | | | | | | there's nothing interesting we can say now that we're correctly not requiring the qualifier to name a known base class in dependent contexts. Require scope specifiers on member access expressions to name complete types if they're not dependent; delay lookup when they are dependent. Use more appropriate diagnostics when qualified implicit member access expressions find declarations from unrelated classes. llvm-svn: 90289
* Fix IsProvablyNotDerivedFrom to always use record definitions when available.John McCall2009-12-011-5/+5
| | | | | | Gets clang-on-clang passing again. llvm-svn: 90270
* Rework how we support C++ implicit member accesses. If we can resolve anJohn McCall2009-12-011-168/+349
| | | | | | | | | | | | | | | implicit member access to a specific declaration, go ahead and create it as a DeclRefExpr or a MemberExpr (with implicit CXXThisExpr base) as appropriate. Otherwise, create an UnresolvedMemberExpr or DependentScopeMemberExpr with a null base expression. By representing implicit accesses directly in the AST, we get the ability to correctly delay the decision about whether it's actually an instance member access or not until resolution is complete. This permits us to correctly avoid diagnosing the 'problem' of 'MyType::foo()' where the relationship to the type isn't really known until instantiation. llvm-svn: 90266
* Don't automatically assume that an id-expression refers to aDouglas Gregor2009-12-011-1/+17
| | | | | | | | | | ValueDecl, because that isn't always the case in ill-formed code. Diagnose a common mistake (forgetting to provide a template argument list for a class template, PR5655) and dyn_cast so that we handle the general problem of referring to a non-value declaration gracefully. llvm-svn: 90239
* Eliminate warning in Release-Asserts mode. No functionality changeDouglas Gregor2009-12-011-0/+1
| | | | llvm-svn: 90204
* Fix and test for a problem caught by the clang-on-clang buildbot: qualifiedJohn McCall2009-11-301-17/+24
| | | | | | IDs in dependent contexts are not dependent if the context names a namespace. llvm-svn: 90171
* Remove all of Sema's explicit uses of OverloadedFunctionDecl except forJohn McCall2009-11-301-2/+0
| | | | | | those associated with TemplateNames. llvm-svn: 90162
* Eliminate the use of OverloadedFunctionDecl in member expressions.John McCall2009-11-301-346/+574
| | | | | | | | Create a new UnresolvedMemberExpr for these lookups. Assorted hackery around qualified member expressions; this will all go away when we implement the correct (i.e. extremely delayed) implicit-member semantics. llvm-svn: 90161
* Add DeclarationName support for C++0x operator literals. They should now work asAlexis Hunt2009-11-291-0/+1
| | | | | | | function names outside of templates - they'll probably cause some damage there as they're largely untested. llvm-svn: 90064
* Refactor our handling of expression evaluation contexts, so that SemaDouglas Gregor2009-11-261-21/+28
| | | | | | | | | | | | maintains a stack of evaluation contexts rather than having the parser do it. This change made it simpler to track in which contexts temporaries were created, so that we could... "Forget" about temporaries created within unevaluated contexts, so that we don't build a CXXExprWithTemporaries and, therefore, destroy the integral-constness of our expressions. Fixes PR5609. llvm-svn: 89908
* Allow user re-definition of SEL as well as accessing its fields.Fariborz Jahanian2009-11-251-0/+21
| | | | | | This fixes pr5611. llvm-svn: 89895
* Some fancy footwork to move the decision on how Fariborz Jahanian2009-11-251-4/+9
| | | | | | to build casted expression-list AST to Sema. llvm-svn: 89827
* Refactor argument collection of constructor calls usingFariborz Jahanian2009-11-241-2/+1
| | | | | | the common routine. llvm-svn: 89802
* More cleanup of argument call collection.Fariborz Jahanian2009-11-241-10/+10
| | | | llvm-svn: 89789
* Rip out TemplateIdRefExpr and make UnresolvedLookupExpr and John McCall2009-11-241-238/+268
| | | | | | | | | | | | DependentScopeDeclRefExpr support storing templateids. Unite the common code paths between ActOnDeclarationNameExpr and ActOnTemplateIdExpr. This gets us to a point where we don't need to store function templates in the AST using TemplateNames, which is critical to ripping out OverloadedFunction. Also resolves a few FIXMEs. llvm-svn: 89785
* Refactor collection of call arguments in common code.Fariborz Jahanian2009-11-241-28/+47
| | | | | | | Add support for variadic collection functions. More to do here. llvm-svn: 89781
* GNUNullExpr is a valid sentinel even though it isn't of pointer type.Anders Carlsson2009-11-241-3/+4
| | | | llvm-svn: 89778
* Convert the && and || operands to bool using standard conversions. Fixes PR5593.Anders Carlsson2009-11-231-9/+31
| | | | llvm-svn: 89704
* Intercept sizeof and alignof references before they get into ASTContext ↵Sebastian Redl2009-11-231-0/+7
| | | | | | methods. This fixes a crash when writing sizeof(Incomplete&), and lets ASTContext's methods do the right thing for CodeGen, which fixes PR5590. llvm-svn: 89668
* Improve type-checking of templates by distinguishing between membersDouglas Gregor2009-11-231-6/+2
| | | | | | | of the current instantiation and members of an unknown specialization when type-checking a qualified-if expression. llvm-svn: 89653
* Centralize and complete the computation of value- and type-dependence for ↵Douglas Gregor2009-11-231-54/+3
| | | | | | DeclRefExprs llvm-svn: 89649
* Encapsulate "an array of TemplateArgumentLocs and two angle bracket ↵John McCall2009-11-231-41/+19
| | | | | | | | | | locations" into a new class. Use it pervasively throughout Sema. My fingers hurt. llvm-svn: 89638
* If a C++ qualified id is followed by a postfix suffix, it is never the directJohn McCall2009-11-221-1/+4
| | | | | | | | | | | | | | operand of an addressof operator, and so we should not treat it as an abstract member-pointer expression and therefore suppress the implicit member access. This is really a well-formedness constraint on expressions: a DeclRefExpr of a FieldDecl or a non-static CXXMethodDecl (or template thereof, or unresolved collection thereof) should not be allowed in an arbitrary location in the AST. Arguably it shouldn't be allowed anywhere and we should have a different expr node type for this. But unfortunately we don't have a good way of enforcing this kind of constraint right now. llvm-svn: 89578
* Reorganize the intermediate BuildDeclarationNameExpr routines again.John McCall2009-11-221-79/+66
| | | | llvm-svn: 89575
* Consider a FunctionTemplate to be an overload all on its lonesome. TrackJohn McCall2009-11-221-49/+73
| | | | | | this information through lookup rather than rederiving it. llvm-svn: 89570
* "Incremental" progress on using expressions, by which I mean totally rippingJohn McCall2009-11-211-150/+288
| | | | | | | | | | | | | | | | | | | | | | into pretty much everything about overload resolution in order to wean BuildDeclarationNameExpr off LookupResult::getAsSingleDecl(). Replace UnresolvedFunctionNameExpr with UnresolvedLookupExpr, which generalizes the idea of a non-member lookup that we haven't totally resolved yet, whether by overloading, argument-dependent lookup, or (eventually) the presence of a function template in the lookup results. Incidentally fixes a problem with argument-dependent lookup where we were still performing ADL even when the lookup results contained something from a block scope. Incidentally improves a diagnostic when using an ObjC ivar from a class method. This just fell out from rewriting BuildDeclarationNameExpr's interaction with lookup, and I'm too apathetic to break it out. The only remaining uses of OverloadedFunctionDecl that I know of are in TemplateName and MemberExpr. llvm-svn: 89544
* Draw a brighter line between "unresolved" expressions, where we have done theJohn McCall2009-11-191-4/+4
| | | | | | | | appropriate lookup and simply can't resolve the referrent yet, and "dependent scope" expressions, where we can't do the lookup yet because the entity we need to look into is a dependent type. llvm-svn: 89402
* Split LookupResult into its own header.John McCall2009-11-181-0/+1
| | | | llvm-svn: 89199
* Simplify ActOnPostfixUnaryOp.Eli Friedman2009-11-181-122/+1
| | | | llvm-svn: 89188
* Incremental progress on using declarations. Split UnresolvedUsingDecl intoJohn McCall2009-11-181-1/+1
| | | | | | | | | | two classes, one for typenames and one for values; this seems to have some support from Doug if not necessarily from the extremely-vague-on-this-point standard. Track the location of the 'typename' keyword in a using-typename decl. Make a new lookup result for unresolved values and deal with it in most places. llvm-svn: 89184
* Eliminate some completely-redundant lookupsDouglas Gregor2009-11-181-10/+0
| | | | llvm-svn: 89181
* Carry lookup configuration throughout lookup on the LookupResult. GiveJohn McCall2009-11-171-15/+8
| | | | | | | | | | | | | LookupResult RAII powers to diagnose ambiguity in the results. Other diagnostics (e.g. access control and deprecation) will be moved to automatically trigger during lookup as part of this same mechanism. This abstraction makes it much easier to encapsulate aliasing declarations (e.g. using declarations) inside the lookup system: eventually, lookup will just produce the aliases in the LookupResult, and the standard access methods will naturally strip the aliases off. llvm-svn: 89027
* PR5526: Make sure to set the right cast kinds for the inserted implicit casts.Eli Friedman2009-11-171-2/+2
| | | | llvm-svn: 89023
* First part of changes to eliminate problems with cv-qualifiers andDouglas Gregor2009-11-161-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sugared types. The basic problem is that our qualifier accessors (getQualifiers, getCVRQualifiers, isConstQualified, etc.) only look at the current QualType and not at any qualifiers that come from sugared types, meaning that we won't see these qualifiers through, e.g., typedefs: typedef const int CInt; typedef CInt Self; Self.isConstQualified() currently returns false! Various bugs (e.g., PR5383) have cropped up all over the front end due to such problems. I'm addressing this problem by splitting each qualifier accessor into two versions: - the "local" version only returns qualifiers on this particular QualType instance - the "normal" version that will eventually combine qualifiers from this QualType instance with the qualifiers on the canonical type to produce the full set of qualifiers. This commit adds the local versions and switches a few callers from the "normal" version (e.g., isConstQualified) over to the "local" version (e.g., isLocalConstQualified) when that is the right thing to do, e.g., because we're printing or serializing the qualifiers. Also, switch a bunch of Context.getCanonicalType(T1).getUnqualifiedType() == Context.getCanonicalType(T2).getQualifiedType() expressions over to Context.hasSameUnqualifiedType(T1, T2) llvm-svn: 88969
* Always build a builtin operator expression for the __extension__ unary operator.Anders Carlsson2009-11-141-1/+2
| | | | llvm-svn: 88811
* PR5462: Don't run off the edge of the argument array for vararg handlingEli Friedman2009-11-141-1/+1
| | | | | | when there are more parameters in the prototype than arguments to the call. llvm-svn: 88759
* Don't bind arguments to temporaries if the argument has a reference type.Anders Carlsson2009-11-131-1/+2
| | | | llvm-svn: 88662
* Fix two bugs with temporaries:Anders Carlsson2009-11-131-0/+2
| | | | | | | | | | | | | | | | | | | | | | 1. For A f() { return A(); } we were incorrectly calling the A destructor on the returned object. 2. For void f(A); void g() { A a; f(a); } we were incorrectly not calling the copy constructor. llvm-svn: 87082
* Note to self: don't leave debugging statements in the code for four hours.John McCall2009-11-121-2/+0
| | | | llvm-svn: 86931
* Add <foo> = [<bar> nextObject] to the -Widiomatic-parentheses category,John McCall2009-11-121-8/+17
| | | | | | | and give that category an explicit test. Generalize the internal diagnostic name. llvm-svn: 86905
* Preserve source locations when building offsetof expressions featuringJohn McCall2009-11-111-1/+1
| | | | | | anonymous members. Partial fix for PR 5390. llvm-svn: 86796
* Apparently the following idiom is specifically encouraged:John McCall2009-11-111-1/+12
| | | | | | | if (self = [super init]) Recognize it and only warn if -Wparentheses is explicitly enabled. llvm-svn: 86790
* Improve parsing of template arguments to lay the foundation forDouglas Gregor2009-11-101-4/+1
| | | | | | | | | | | | | | | | | | | | | | handling template template parameters properly. This refactoring: - Parses template template arguments as id-expressions, representing the result of the parse as a template name (Action::TemplateTy) rather than as an expression (lame!). - Represents all parsed template arguments via a new parser-specific type, ParsedTemplateArgument, which stores the kind of template argument (type, non-type, template) along with all of the source information about the template argument. This replaces an ad hoc set of 3 vectors (one for a void*, which was either a type or an expression; one for a bit telling whether the first was a type or an expression; and one for a single source location pointing at the template argument). - Moves TemplateIdAnnotation into the new Parse/Template.h. It never belonged in the Basic library anyway. llvm-svn: 86708
* When trying to assign a regular string literal to an Objective-C 'id' type ↵Anders Carlsson2009-11-101-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | or a pointer to an NSString, emit a code insertion hint that turns it into an Objective-C string. For example: @class NSString; @interface Test + (void)test:(NSString *)string; @end void g(NSString *a); void f() { NSString *a = "Foo"; g("Foo"); [Test test:"Foo"]; } will produce t.m:10:17: warning: incompatible pointer types initializing 'char [4]', expected 'NSString *' NSString *a = "Foo"; ^~~~~ @ t.m:11:5: warning: incompatible pointer types passing 'char [4]', expected 'NSString *' g("Foo"); ^~~~~ @ t.m:12:14: warning: incompatible pointer types sending 'char [4]', expected 'NSString *' [Test test:"Foo"]; ^~~~~ @ 3 diagnostics generated. llvm-svn: 86665
OpenPOWER on IntegriCloud