aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExpr.cpp
AgeCommit message (Collapse)Author
2009-09-03Improved handling for dependent, qualified member access expressions, e.g.,Douglas Gregor
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80925 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03This patch does the following.Fariborz Jahanian
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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80860 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02It is illegal to derefrercne to an interface inFariborz Jahanian
objc's non-fragile ABI. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80739 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-01Add a CK_FunctionToPointerDecay cast kind.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80719 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-01Preliminary AST representation and semantic analysis forDouglas Gregor
explicitly-specified template argument lists in member reference expressions, e.g., x->f<int>() git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80646 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31Eliminate CXXAdornedMemberExpr entirely. Instead, optionally allocateDouglas Gregor
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80642 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31Rename CXXQualifiedMemberExpr -> CXXAdornedMemberExpr, since we willDouglas Gregor
also be adding explicit template arguments as an additional "adornment". No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80628 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31Add parsing for references to member function templates with explicitDouglas Gregor
template argument lists, e.g., x.f<int>(). Semantic analysis will be a separate commit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80624 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30Improve diagnostics for missing members. This renames the ↵Anders Carlsson
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80469 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-29Patch for code gen. for c-style cast which ends inFariborz Jahanian
using class's conversion functions [12.3.2-p2] git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80433 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-29CreateDeclRefExprs that point to UnresolvedUsingDecls.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80413 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28Implement template instantiation for member class templates.Douglas Gregor
When performing template instantiation of the definitions of member templates (or members thereof), we build a data structure containing the template arguments from each "level" of template instantiation. During template instantiation, we substitute all levels of template arguments simultaneously. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80389 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26Bye-bye old RequireCompleteType.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80182 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26Remove the PrintType argument from RequireCompleteType.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80174 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26When a member reference expression includes a qualifier on the memberDouglas Gregor
name, e.g., x->Base::f() retain the qualifier (and its source range information) in a new subclass of MemberExpr called CXXQualifiedMemberExpr. Provide construction, transformation, profiling, printing, etc., for this new expression type. When a virtual function is called via a qualified name, don't emit a virtual call. Instead, call that function directly. Mike, could you add a CodeGen test for this, too? git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80167 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26update to CXXFunctionalCastExpr to support ir-gen forFariborz Jahanian
type convesions of class objects [class.conv]. WIP. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80127 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26Add Sema::BuildMemberReferenceExpr and have Sema::ActOnMemberReferenceExpr ↵Anders Carlsson
call it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80122 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26Source location information for ? and : in a ConditionalOperator, from Enea ↵Douglas Gregor
Zaffanella git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80097 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25Parsing of pseudo-destructors.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80055 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25Clarify the difference between substitution and instantiation by renamingJohn McCall
functions that don't instantiate definitions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80037 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25Factor building of CXXDefaultArgExpr expressions out into a separate function.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79974 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25Basic support for default argument expressions for function templates.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79972 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25Factor setting default arguments out into SetParamDefaultArgument.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79970 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-24Use the right cast kind when comparing null to member pointers.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79927 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-24Implement support for equality comparisons (!=, ==) of memberDouglas Gregor
pointers, by extending the "composite pointer type" logic to include member pointer types. Introduce test cases for member pointer comparisons, including those that involve the builtin operator candidates implemented earlier. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79925 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23Catch a few more cases of illegal comparisons.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79793 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23Eli points out that we really must diagnose "void* > 0" as an extension. Chris Lattner
Explicitly add it as an EXTENSION instead of an EXTWARN so that it only comes out with -pedantic. Thanks Eli! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79791 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-22Type of a ?: expression whose either expression is a built-in 'id'Fariborz Jahanian
type is 'id' type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79781 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-22tweak some pointer sema checking stuff (which was added to implement PR4175) to Chris Lattner
avoid emitting a warning on "someptr > 0". This is obviously questionable (they could use != instead) but is reasonable, and the warning "ordered comparison between pointer and integer" didn't make a ton of sense because 0 is a valid null pointer constant. Just silence the warning in this case, it is unlikely to indicate a bug. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79743 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21Implement support for calling member function templates, which involves:Douglas Gregor
- Allowing one to name a member function template within a class template and on the right-hand side of a member access expression. - Template argument deduction for calls to member function templates. - Registering specializations of member function templates (and finding them later). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79581 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-20Using "ObjCImplicitSetterGetterRefExpr" instead of ↵Fariborz Jahanian
"ObjCImplctSetterGetterRefExpr". A field rename and more comments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79537 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-20Fix bit-field promotion to be a bit closer to the behavior of gcc. Eli Friedman
Patch by Enea Zaffanella, with some simplifications/corrections to isPromotableBitField by me. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79510 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-19Make integer promotions work correctly on PIC16 and other platforms Eli Friedman
where sizeof(short) == sizeof(int). Move UsualArithmeticConversionsType out of Sema, since it was only there as a historical artifact. Patch by Enea Zaffanella. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79412 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-19Use Sema's LocInfoType to pass and preserve type source info through the Parser.Argyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79395 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-18Renamed ObjCKVCRefExpr to ObjCImplctSetterGetterRefExpr.Fariborz Jahanian
Removed an unnecessary loop to get to setters incoming argument. Added DoxyGen comments. Still more work to do in this area (WIP). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79365 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-17Initial patch to support definitions of id and Class from headers in ↵David Chisnall
Objective-C code. This currently breaks test/SemaObjC/id-isa-ref.m and issues some spurious warnings when you attempt to assign a struct objc_class* value to a Class variable. The test case probably should fail as it's written, because without the definition of Class the compiler should not assume struct objc_class* is a valid receiver type, but it's left broken because it would be nice if we could get that passing too for the special case of isa. Approved by snaroff. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79248 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-16Make sure to call MaybeBindToTemporary when creating CallExprs.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79168 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-16Move builtin call checking out into a separate function, make ↵Anders Carlsson
CheckFunctionCall and CheckBlockCall return bool instead. No intended functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79157 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-15Don't perform integer promotions on the operand to a cast; this Eli Friedman
simplifies the AST, and can matter in some rare cases involving casts to vector types. Patch by Enea Zaffanella. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79126 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-14Make the CXXDefaultArgExpr constructor protected and add a static Create ↵Anders Carlsson
function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79013 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10Take 2 on AltiVec-style vector initializers. Nate Begeman
Fixes PR4704 problems Addresses Eli's patch feedback re: ugly cast code Updates all postfix operators to remove ParenListExprs. While this is awful, no better solution (say, in the parser) is obvious to me. Better solutions welcome. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78621 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10Revert r78535, it is causing a number of failures to build projects.Daniel Dunbar
--- Reverse-merging r78535 into '.': D test/Sema/altivec-init.c U include/clang/Basic/DiagnosticSemaKinds.td U include/clang/AST/Expr.h U include/clang/AST/StmtNodes.def U include/clang/Parse/Parser.h U include/clang/Parse/Action.h U tools/clang-cc/clang-cc.cpp U lib/Frontend/PrintParserCallbacks.cpp U lib/CodeGen/CGExprScalar.cpp U lib/Sema/SemaInit.cpp U lib/Sema/Sema.h U lib/Sema/SemaExpr.cpp U lib/Sema/SemaTemplateInstantiateExpr.cpp U lib/AST/StmtProfile.cpp U lib/AST/Expr.cpp U lib/AST/StmtPrinter.cpp U lib/Parse/ParseExpr.cpp U lib/Parse/ParseExprCXX.cpp git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78551 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-09AltiVec-style vector initializer syntax, vec4 a = (vec4)(a, b, c, d);Nate Begeman
In addition to being defined by the AltiVec PIM, this is also the vector initializer syntax used by OpenCL, so that vector literals are compatible with macro arguments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78535 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-08PR4700 - remove shift by 0 warningRyan Flynn
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78488 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-08Make sure to diagnose use of declarations in the case where we create an ↵Anders Carlsson
implicit CXXThisExpr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78474 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-07Add a CK_ArrayToPointerDecay cast kind.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78434 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-07Add CK_ToUnion and use it for aggregate expression codegen.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78429 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-07More CastKind work.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78415 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-07PR3333: warn when shifting by invalid amountRyan Flynn
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78385 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-06Implement transformation of nested-name-specifiers within the generalDouglas Gregor
tree transformation. Template instantiation uses this general transformation rather than implementing its own transformation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78286 91177308-0d34-0410-b5e6-96231b3b80d8