summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Check the return type of operator[]() and fix a thinko that lead to a crash ↵Anders Carlsson2009-10-131-6/+13
| | | | | | in SemaCXX/overloaded-operator.cpp. llvm-svn: 84041
* More return type checking.Anders Carlsson2009-10-131-6/+10
| | | | llvm-svn: 84034
* Unify our diagnostic printing for errors of the form, "we didn't likeDouglas Gregor2009-10-131-10/+9
| | | | | | | | | | what we found when we looked into <blah>", where <blah> is a DeclContext*. We can now format DeclContext*'s in nice ways, e.g., "namespace N", "the global namespace", "'class Foo'". This is part of PR3990, but we're not quite there yet. llvm-svn: 84028
* More appropriate API usage.John McCall2009-10-121-3/+1
| | | | llvm-svn: 83910
* Implement -Wparentheses: warn about using assignments in contexts that requireJohn McCall2009-10-121-0/+53
| | | | | | | | | conditions. Add a fixit to insert the parentheses. Also fix a very minor possible memory leak in 'for' conditions. Fixes PR 4876 and rdar://problem/7289172 llvm-svn: 83907
* Diagnose the declaration of explicit specializations after an implicitDouglas Gregor2009-10-121-7/+31
| | | | | | | instantiation has already been required. To do so, keep track of the point of instantiation for anything that can be instantiated. llvm-svn: 83890
* Add CheckCallReturnType and start using it for regular call expressions. ↵Anders Carlsson2009-10-091-5/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | This will improve error messages. For struct B; B f(); void g() { f(); } We now get t.cpp:6:3: error: calling 'f' with incomplete return type 'struct B' f(); ^~~ t.cpp:3:3: note: 'f' declared here B f(); ^ t.cpp:1:8: note: forward declaration of 'struct B' struct B; ^ llvm-svn: 83692
* Refactor the LookupResult API to simplify most common operations. Require ↵John McCall2009-10-091-14/+14
| | | | | | | | | users to pass a LookupResult reference to lookup routines. Call out uses which assume a single result. llvm-svn: 83674
* Implement support for -Wunused-variable, from Oscar Bonilla!Douglas Gregor2009-10-081-3/+6
| | | | llvm-svn: 83577
* For instantiations of static data members of class templates, keepDouglas Gregor2009-10-081-4/+2
| | | | | | | | track of the kind of specialization or instantiation. Also, check the scope of the specialization and ensure that a specialization declaration without an initializer is not a definition. llvm-svn: 83533
* Only perform an implicit instantiation of a function if its templateDouglas Gregor2009-10-081-9/+3
| | | | | | | | | specialization kind is TSK_ImplicitInstantiation. Previously, we would end up implicitly instantiating functions that had explicit specialization declarations or explicit instantiation declarations (with no corresponding definitions). llvm-svn: 83511
* Create CXXMemberCallExpr for pointer-to-member calls.Anders Carlsson2009-10-031-0/+22
| | | | llvm-svn: 83268
* - Remove Sema::FindMethodInNestedImplementations().Steve Naroff2009-10-011-18/+3
| | | | | | | | | - Add ObjCInterfaceDecl::lookupPrivateInstanceMethod(). - Convert clients. No functionality change - One less method in Sema:-) llvm-svn: 83224
* When overload resolution fails for an overloaded operator, show theDouglas Gregor2009-09-301-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | overload candidates (but not the built-in ones). We still rely on the underlying built-in semantic analysis to produce the initial diagnostic, then print the candidates following that diagnostic. One side advantage of this approach is that we can perform more validation of C++'s operator overloading with built-in candidates vs. the semantic analysis for those built-in operators: when there are no viable candidates, we know to expect an error from the built-in operator handling code. Otherwise, we are not modeling the built-in semantics properly within operator overloading. This is checked as: assert(Result.isInvalid() && "C++ binary operator overloading is missing candidates!"); if (Result.isInvalid()) PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false); The assert() catches cases where we're wrong in a +Asserts build. The "if" makes sure that, if this happens in a production clang (-Asserts), we still build the proper built-in operator and continue on our merry way. This is effectively what happened before this change, but we've added the assert() to catch more flies. llvm-svn: 83175
* Fix checking for a null pointer constant when the expression itself isDouglas Gregor2009-09-251-10/+23
| | | | | | | | | | | | value-dependent. Audit (and fixed) all calls to Expr::isNullPointerConstant() to provide the correct behavior with value-dependent expressions. Fixes PR5041 and a crash in libstdc++ <locale>. In the same vein, properly compute value- and type-dependence for ChooseExpr. Fixes PR4996. llvm-svn: 82748
* Refactor the representation of qualifiers to bring ExtQualType out of theJohn McCall2009-09-241-33/+50
| | | | | | | | Type hierarchy. Demote 'volatile' to extended-qualifier status. Audit our use of qualifiers and fix a few places that weren't dealing with qualifiers quite right; many more remain. llvm-svn: 82705
* Fix a regression in accessing class getter using the dot-syntaxFariborz Jahanian2009-09-221-55/+57
| | | | | | | | notation. There is still an issue accessing field of a 'Class''s isa in legacy code using dot field access notation (as noted in the test case) but unrelated to this patch. llvm-svn: 82555
* Implement code completion within a function call, triggered after theDouglas Gregor2009-09-221-63/+100
| | | | | | | | | | | | | | | | | | | | | opening parentheses and after each comma. We gather the set of visible overloaded functions, perform "partial" overloading based on the set of arguments that we have thus far, and return the still-viable results sorted by the likelihood that they will be the best candidate. Most of the changes in this patch are a refactoring of the overloading routines for a function call, since we needed to separate out the notion of building an overload set (common to code-completion and normal semantic analysis) and then what to do with that overload set. As part of this change, I've pushed explicit template arguments into a few more subroutines. There is still much more work to do in this area. Function templates won't be handled well (unless we happen to deduce all of the template arguments before we hit the completion point), nor will overloaded function-call operators or calls to member functions. llvm-svn: 82549
* Change all the Type::getAsFoo() methods to specializations of Type::getAs().John McCall2009-09-211-28/+28
| | | | | | | | | | | Several of the existing methods were identical to their respective specializations, and so have been removed entirely. Several more 'leaf' optimizations were introduced. The getAsFoo() methods which imposed extra conditions, like getAsObjCInterfacePointerType(), have been left in place. llvm-svn: 82501
* Fix two crashes on value dependent expressions (shift and null-pointer check).Daniel Dunbar2009-09-171-1/+2
| | | | | | | | - Doug, please check. - PR4940. llvm-svn: 82129
* Remove trailing whitespace.Daniel Dunbar2009-09-171-8/+7
| | | | llvm-svn: 82128
* Use getTrueExpr/getFalseExpr as suggested by Doug.Anders Carlsson2009-09-151-2/+2
| | | | llvm-svn: 81863
* Diagnose taking the address of a bit-field inside a conditional operator.Anders Carlsson2009-09-141-0/+4
| | | | llvm-svn: 81808
* -Wchar-subscripts should not warn for explicit signed char subscripts ↵Sam Weinig2009-09-141-3/+3
| | | | | | either. Another fix for PR4978. llvm-svn: 81780
* -Wchar-subscripts should not warn for unsigned char subscripts. Fixes PR4978.Sam Weinig2009-09-141-1/+3
| | | | llvm-svn: 81776
* Add support for -Wchar-subscripts. Fixes PR4801.Sam Weinig2009-09-141-0/+3
| | | | llvm-svn: 81747
* Remove unnecessary ASTContext parameter from FunctionDecl::isBuiltinIDDouglas Gregor2009-09-121-2/+2
| | | | llvm-svn: 81590
* Slight improvement for extern templates, so that an explicitDouglas Gregor2009-09-111-0/+1
| | | | | | | | | instantiation definition can follow an explicit instantiation declaration. This is as far as I want to go with extern templates now, but they will still need quite a bit more work to get all of the C++0x semantics right. llvm-svn: 81573
* Fix PR4878 for real.Anders Carlsson2009-09-111-1/+10
| | | | llvm-svn: 81507
* Test commitSam Weinig2009-09-111-1/+1
| | | | llvm-svn: 81500
* Instantiate PredefinedExprs correctly. Patch by Sam Weinig!Anders Carlsson2009-09-111-5/+10
| | | | llvm-svn: 81498
* Don't check use of a member function declaration used if the member function ↵Anders Carlsson2009-09-101-1/+9
| | | | | | is virtual and the member reference expression doesn't explicitly qualify it. Fixes PR4878. llvm-svn: 81460
* If a cast expression needs either a conversion function or a constructor to ↵Anders Carlsson2009-09-091-15/+13
| | | | | | be called, generate implicit child expressions that call them. llvm-svn: 81383
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-352/+345
| | | | llvm-svn: 81346
* Initial stab at implement dependent member references to memberDouglas Gregor2009-09-091-14/+22
| | | | | | | | | | | | | templates, e.g., x.template get<T> We can now parse these, represent them within an UnresolvedMemberExpr expression, then instantiate that expression node in simple cases. This allows us to stumble through parsing LLVM's Casting.h. llvm-svn: 81300
* Vastly improve PredefinedExpr output, both in Sema and CodeGen. Patch by Sam ↵Anders Carlsson2009-09-081-8/+6
| | | | | | Weinig! llvm-svn: 81237
* Use a separate diagnostic for default function argument expressions.Anders Carlsson2009-09-051-6/+3
| | | | llvm-svn: 81062
* Implement AST, semantics, and CodeGen for C++ pseudo-destructorDouglas Gregor2009-09-041-1/+61
| | | | | | | | | | | | | expressions, e.g., p->~T() when p is a pointer to a scalar type. We don't currently diagnose errors when pseudo-destructor expressions are used in any way other than by forming a call. llvm-svn: 81009
* Improve template instantiation for member access expressions thatDouglas Gregor2009-09-031-5/+24
| | | | | | | | | involve qualified names, e.g., x->Base::f. We now maintain enough information in the AST to compare the results of the name lookup of "Base" in the scope of the postfix-expression (determined at template definition time) and in the type of the object expression. llvm-svn: 80953
* Improved handling for dependent, qualified member access expressions, e.g.,Douglas Gregor2009-09-031-13/+17
| | | | | | | | | | | | | | | t->Base::f where t has a dependent type. We save the nested-name-specifier in the CXXUnresolvedMemberExpr then, during instantiation, substitute into the nested-name-specifier with the (transformed) object type of t, so that we get name lookup into the type of the object expression. Note that we do not yet retain information about name lookup into the lexical scope of the member access expression, so several regression tests are still disabled. llvm-svn: 80925
* This patch does the following.Fariborz Jahanian2009-09-031-9/+2
| | | | | | | | | | | 1) Issue digsnostics in non-fragile ABI, when an expression evaluates to an interface type (except when it is used to access a non-fragile ivar). 2) Issue unsupported error in fragile ABI when an expression evaluates to an interface type (except when it is used to access a fragile ivar). llvm-svn: 80860
* It is illegal to derefrercne to an interface inFariborz Jahanian2009-09-021-2/+9
| | | | | | objc's non-fragile ABI. llvm-svn: 80739
* Add a CK_FunctionToPointerDecay cast kind.Anders Carlsson2009-09-011-1/+2
| | | | llvm-svn: 80719
* Preliminary AST representation and semantic analysis forDouglas Gregor2009-09-011-2/+30
| | | | | | | | | explicitly-specified template argument lists in member reference expressions, e.g., x->f<int>() llvm-svn: 80646
* Eliminate CXXAdornedMemberExpr entirely. Instead, optionally allocateDouglas Gregor2009-08-311-6/+4
| | | | | | | | space within the MemberExpr for the nested-name-specifier and its source range. We'll do the same thing with explicitly-specified template arguments, assuming I don't flip-flop again. llvm-svn: 80642
* Rename CXXQualifiedMemberExpr -> CXXAdornedMemberExpr, since we willDouglas Gregor2009-08-311-6/+6
| | | | | | | also be adding explicit template arguments as an additional "adornment". No functionality change. llvm-svn: 80628
* Add parsing for references to member function templates with explicitDouglas Gregor2009-08-311-1/+1
| | | | | | | | template argument lists, e.g., x.f<int>(). Semantic analysis will be a separate commit. llvm-svn: 80624
* Improve diagnostics for missing members. This renames the ↵Anders Carlsson2009-08-301-6/+8
| | | | | | err_typecheck_no_member to err_typecheck_no_member_deprecated. The idea is that err_typecheck_no_member_deprecated should be phased out and any call sites that reference it should call DiagnoseMissingMember instead. llvm-svn: 80469
* Patch for code gen. for c-style cast which ends inFariborz Jahanian2009-08-291-0/+13
| | | | | | using class's conversion functions [12.3.2-p2] llvm-svn: 80433
* CreateDeclRefExprs that point to UnresolvedUsingDecls.Anders Carlsson2009-08-291-0/+5
| | | | llvm-svn: 80413
OpenPOWER on IntegriCloud