aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExpr.cpp
AgeCommit message (Collapse)Author
2011-09-07In Microsoft mode, if we are inside a template class member function and we ↵Francois Pichet
can't resolve a function call then create a type-dependent CallExpr even if the function has no type dependent arguments. The goal is to postpone name lookup to instantiation time to be able to search into type dependent base classes. With this patch in, clang will generate only 37 errors (down from 212) when parsing a typical MFC source file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139210 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06Rename variables in SemaExpr.cpp to give a more consistant naming scheme.Richard Trieu
ExprResult LHS, RHS, Expr *LHSExpr, *RHSExpr QualType LHSType, RHSType Functions changed: CheckCompareOperands() git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139187 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06Rename variables in SemaExpr.cpp to give a more consistant naming scheme.Richard Trieu
ExprResult LHS, RHS, Expr *LHSExpr, *RHSExpr QualType LHSType, RHSType Functions changed: checkEnumComparison() diagnoseDistinctPointerComparison() convertPointersToCompositeType() diagnoseFunctionPointerToVoidComparison() git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139184 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06Rename variables in SemaExpr.cpp to give a more consistant naming scheme.Richard Trieu
ExprResult LHS, RHS, Expr *LHSExpr, *RHSExpr QualType LHSType, RHSType Functions changed: DiagnoseBadShiftValues() CheckShiftOperands() git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139183 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06Rename variables in SemaExpr.cpp to give a more consistant naming scheme.Richard Trieu
ExprResult LHS, RHS, Expr *LHSExpr, *RHSExpr QualType LHSType, RHSType Functions changed: diagnoseArithmeticOnTwoVoidPointers() checkArithmeticBinOpPointerOperands() diagnosePointerIncompatibility() CheckAdditionOperands() CheckSubtractionOperands() git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139182 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06Rename variables in SemaExpr.cpp to give a more consistant naming scheme.Richard Trieu
ExprResult LHS, RHS, Expr *LHSExpr, *RHSExpr QualType LHSType, RHSType Functions changed: CheckVectorOperands() CheckMultiplyDivideOperands() CheckRemainderOperands() git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139181 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06Implement the Named Return Value Optimization (NRVO) for blocks.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139178 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06Rename variables in SemaExpr.cpp to give a more consistant naming scheme.Richard Trieu
ExprResult LHS, RHS, Expr *LHSExpr, *RHSExpr QualType LHSType, RHSType Functions changed: CheckTransparentUnionArgumentConstraints() CheckSingleAssignmentConstraints() InvalidOperands() git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139176 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06Rename variables in SemaExpr.cpp to give a more consistant naming scheme.Richard Trieu
ExprResult LHS, RHS, Expr *LHSExpr, *RHSExpr QualType LHSType, RHSType Functions changed: CheckAssignmentConstraints() git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139173 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06Rename variables in SemaExpr.cpp to give a more consistant naming scheme.Richard Trieu
ExprResult LHS, RHS, Expr *LHSExpr, *RHSExpr QualType LHSType, RHSType Functions changed: checkPointerTypesForAssignment() checkBlockPointerTypesForAssignment() checkObjCPointerTypesForAssignment() CheckAssignmentConstraints() git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139170 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06Rename variables in SemaExpr.cpp to give a more consistant naming scheme.Richard Trieu
ExprResult LHS, RHS, Expr *LHSExpr, *RHSExpr QualType LHSType, RHSType Functions changed: DiagnoseConditionalForNull() CheckConditionalOperands() IsArithmeticBinaryExpr() DiagnoseConditionalPrecedence() git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139167 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06Spelling.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139165 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06Rename variables in SemaExpr.cpp to give a more consistant naming scheme.Richard Trieu
ExprResult LHS, RHS, Expr *LHSExpr, *RHSExpr QualType LHSType, RHSType Functions changed: handleIntegerConversion() UsualArithmeticConversions() git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139164 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06Rename variables in SemaExpr.cpp to give a more consistant naming scheme.Richard Trieu
ExprResult LHS, RHS, Expr *LHSExpr, *RHSExpr QualType LHSType, RHSType Functions changed: handleFloatConversion() handleComplexIntConvsersion() git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139153 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06Rename variables in SemaExpr.cpp to give a more consistant naming scheme.Richard Trieu
ExprResult LHS, RHS, Expr *LHSExpr, *RHSExpr QualType LHSType, RHSType Functions changed: handleComplexFloatToComplexFloatConverstion() handleComplexFloatConversion() git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139151 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-04Pass 0 instead of a empty TemplateArgumentListInfo when creating a ↵Francois Pichet
CXXDependentScopeMemberExpr to handle a "this->" fixit (lookup into dependent bases of class template) Otherwise the fixit doesn't really work for subsequent lookup. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139105 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-03More unused variable removal.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139080 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-03Make helpers static, remove unused variables.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139078 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-02Fix some indenting issues in SemaExpr.cppRichard Trieu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139042 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-02Refactor UsualArithmeticConversions() in SemaExpr.cpp into several functions.Richard Trieu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139033 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-02Move the warning for different enum comparisons and the warning for using ↵Richard Trieu
NULL as a non-pointer in a binary operation into separate functions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138995 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-02Reduce code duplication for pointer comparisons in CheckCompareOperands().Richard Trieu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138994 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-02Pull out incomplete pointer type checking code, used from arithmetic ↵Richard Trieu
checking functions, into its own function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138993 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-02Refactor CheckConditionalOperands() by moving chunks of code to helper ↵Richard Trieu
functions making a slimmer function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138992 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-02Refactor CheckAddressOfOperand() by pulling out redundant code and moving ↵Richard Trieu
hard coding strings from SemaExpr.cpp to DiagnosticSemaKinds.td. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138987 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-02Extend the ASTContext constructor to delay the initialization ofDouglas Gregor
builtin types (When requested). This is another step toward making ASTUnit build the ASTContext as needed when loading an AST file, rather than doing so after the fact. No actual functionality change (yet). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138985 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-01Refactor CheckAdditionOperands(), CheckSubtractionOperands(), and ↵Richard Trieu
CheckIncrementDecrementOperand() in SemaExpr.cpp to move reused code to separate functions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138975 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-31objective-c: this patch (re)introduces objective-c's default propertyFariborz Jahanian
synthesis. This new feature is currently placed under -fobjc-default-synthesize-properties option and is off by default pending further testing. It will become the default feature soon. // rdar://8843851 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138913 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-31Don't assert when diagnosing a missing cast of an unknown-anytypeJohn McCall
message send to an unknown method. rdar://problem/9416370, redux. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138893 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-30Declare and define implicit move constructor and assignment operator.Sebastian Redl
This makes the code duplication of implicit special member handling even worse, but the cleanup will have to come later. For now, this works. Follow-up with tests for explicit defaulting and enabling the __has_feature flag to come. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138821 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-29Update the comment on the default-argument conversion fix; thanks toJohn McCall
Johannes Schaub for talking me around to sense. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138784 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-27Disable the l-value to r-value conversion on C++ class types passedJohn McCall
to varargs functions in unevaluated contexts. AFAICT, there is no standards justification for this, but it matches what other compilers do and therefore preserves compatibility with certain template metaprogramming idioms. Should fix self-host. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138715 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-27The lvalue-to-rvalue on structs in C++ is actually partJohn McCall
of default argument promotion and needs to happen unconditionally. This is particularly semantically important in C++0x. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138691 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-26Don't assert on taking the address of a non-type template parameter. Fixes ↵Eli Friedman
PR10766. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138648 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-26In -Wno-error=non-pod-varargs, initialize a temporary withJohn McCall
the crazy comma expression so that we get an r-value in the varargs position. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138638 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-16Switch this code to use the more idiomatic 'dyn_cast' pattern.Chandler Carruth
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137780 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-15Add fixit notes for -Wconstant-logical-operand.Matt Beaumont-Gay
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137620 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-11The current warning in -Wnull-arithmetic for comparisons between NULL and ↵Richard Trieu
non-pointers is not very helpful. This patch will update the wording to be more helpful to users. Old warning: warning: use of NULL in arithmetic operation [-Wnull-arithmetic] return 10 <= NULL; ^ ~~~~ New warning: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic] return 10 <= NULL; ~~ ^ ~~~~ git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137377 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-11Encapsulate the Objective-C id/Class/SEL "redefinition" types inDouglas Gregor
ASTContext with accessors/mutators. The only functional change is that the AST writer won't bother writing the id/Class/SEL redefinition type if it hasn't been explicitly set; previously, it ended up being written as a synonym for the built-in id/Class/SEL. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137349 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-10Refactoring of DiagnoseBitwisePrecedence() in SemaExpr.cpp to reduce code ↵Richard Trieu
duplication. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137259 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-10Change an assert into a check. I'm pretty sure there was a pointJohn McCall
in time when this assert was valid, but it's not valid now. Also teach this code to correctly introduce function-to-pointer decay. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137201 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-08Make sure FunctionDecls aren't considered during overload resolution if thereKaelyn Uhrain
are explicit template args. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137054 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-05Perform array bounds checking in more situations and properly handle specialKaelyn Uhrain
case situations with the unary operators & and *. Also extend the array bounds checking to work with pointer arithmetic; the pointer arithemtic checking can be turned on using -Warray-bounds-pointer-arithmetic. The changes to where CheckArrayAccess gets called is based on some trial & error and a bunch of digging through source code and gdb backtraces in order to have the check performed under as many situations as possible (such as for variable initializers, arguments to function calls, and within conditional in addition to the simpler cases of the operands to binary and unary operator) while not being called--and triggering warnings--more than once for a given ArraySubscriptExpr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136997 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-05Have the typo correction in DiagnoseEmptyLookup properly handle templateKaelyn Uhrain
functions when performing function overload resolution. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136948 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-04Fix a small bug where DiagnoseEmptyLookup would no longer print any messagesKaelyn Uhrain
when performing typo correction involving any overloaded template functions. The added test cases, while currently demontrating sub-optimal behavior, will not trigger any messages without the 1-line change to SemaExpr.cpp. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136943 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-03Improve overloaded function handling in the typo correction code.Kaelyn Uhrain
Change TypoCorrection to store a set of NamedDecls instead of a single NamedDecl. Also add initial support for performing function overload resolution to Sema::DiagnoseEmptyLookup. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136807 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-02Fix formatting of SemaExpr.cpp, mainly fixing lines greater than 80 characters.Richard Trieu
No functional change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136678 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-30Introduce a Fix-It for the "missing sentinel" warning, adding anDouglas Gregor
appropriate sentinel at the end of the argument list. Also, put the sentinel warnings under -Wsentinel. Fixes <rdar://problem/8764236>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136566 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-30When complaining about a non-POD second argument to va_arg, use aDouglas Gregor
special diagnostic for ARC ownership-qualified types. We wouldn't want to expose Objective-C programmers to the term "POD", would we? Fixes <rdar://problem/9772982>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136558 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29Fix an inconsistency in Sema::ConvertArgumentsForCall in thatPeter Collingbourne
the callee note diagnostic was not emitted in the case where there were too few arguments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136437 91177308-0d34-0410-b5e6-96231b3b80d8