Richard Trieu
b420bcaeb0
Refactor CheckAdditionOperands() to use early return for pointer addition.
...
llvm-svn: 139520
2011-09-12 18:37:54 +00:00
Richard Trieu
993f3ab07b
Fix two comments from warn to emit error to match the actual diagnostic used.
...
llvm-svn: 139510
2011-09-12 18:08:02 +00:00
Hans Wennborg
be207b3c74
Silence ?: precendence warning when parenthesis are present.
...
Fixes PR10898. The warning should be silent when there are parenthesis
around the condition expression.
llvm-svn: 139492
2011-09-12 12:07:30 +00:00
John McCall
2d637d2e79
Rename the ARC cast kinds to start with "ARC".
...
llvm-svn: 139466
2011-09-10 06:18:15 +00:00
John McCall
cd78e805e9
When converting a block pointer to an Objective-C pointer type, extend
...
the lifetime of the block by copying it to the heap, or else we'll get
a dangling reference because the code working with the non-block-typed
object will not know it needs to copy.
There is some danger here, e.g. with assigning a block literal to an
unsafe variable, but, well, it's an unsafe variable.
llvm-svn: 139451
2011-09-10 01:16:55 +00:00
John McCall
b46f287e48
Clean up the sentinel-attribute checking code a lot. Document
...
what 'nullPos' is supposed to mean, at least at this one site.
Use closed forms for the arithmetic. Rip out some clever but
ultimately pointless code that was trying to use 0 or 0L depending
the size of a pointer vs. the size of int; first, it didn't work
on LLP64 systems, and second, the sentinel checking code requires
a pointer-typed value anyway, so this fixit would not have actually
removed the warning.
llvm-svn: 139361
2011-09-09 07:56:05 +00:00
John McCall
9320b87cff
Give conversions of block pointers to ObjC pointers a different cast kind
...
than conversions of C pointers to ObjC pointers. In order to ensure that
we've caught every case, add asserts to CastExpr that strictly determine
which cast kind is used for which kind of bit cast.
llvm-svn: 139352
2011-09-09 05:25:32 +00:00
Richard Trieu
10162ab7ed
Clean up the RebuildUnknownAnyExpr visitor in SemaExpr.cpp. Mainly swapped around variable names so that this visitor be more like other visitors in clang.
...
llvm-svn: 139351
2011-09-09 03:59:41 +00:00
Richard Trieu
ba63ce6b7b
Capitialize paramater names in SemaExpr.cpp and resolve any parameter name conflicts between declarations and definitions from this and previous refactorings.
...
llvm-svn: 139346
2011-09-09 01:45:06 +00:00
Richard Trieu
5f376f6d34
Change diagnoseAddressOfInvalidType() to use an enum to determine what error message to display. Also, move the function call into on location instead of having it spread among many places in the if/else statements.
...
llvm-svn: 139260
2011-09-07 21:46:33 +00:00
Richard Trieu
f9bd0f5d99
Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
...
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType
Functions changed:
DiagnoseLogicalAndInLogicalOrLHS()
DiagnoseBinOpPrecedence()
ActOnBinOp()
BuildBinOp()
llvm-svn: 139219
2011-09-07 02:02:10 +00:00
Richard Trieu
4a287fb926
Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
...
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType
Functions changed:
CreateBuiltinBinOp()
DiagnoseBitwisePrecedence()
llvm-svn: 139218
2011-09-07 01:49:20 +00:00
Richard Trieu
da4f43a609
Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
...
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType
Functions changed:
CheckAssignmentOperands()
DiagnoseSelfAssignment()
checkArithmeticNull()
llvm-svn: 139215
2011-09-07 01:33:52 +00:00
Richard Trieu
bcce2f7189
Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
...
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType
Functions changed:
CheckVectorCompareOperands()
CheckBitwiseOperands()
CheckLogicalOperands()
llvm-svn: 139214
2011-09-07 01:19:57 +00:00
Francois Pichet
bcf6471010
In Microsoft mode, if we are inside a template class member function and we 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.
llvm-svn: 139210
2011-09-07 00:14:57 +00:00
Richard Trieu
b80728fe9a
Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
...
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType
Functions changed:
CheckCompareOperands()
llvm-svn: 139187
2011-09-06 21:43:51 +00:00
Richard Trieu
1762d7cc35
Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
...
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType
Functions changed:
checkEnumComparison()
diagnoseDistinctPointerComparison()
convertPointersToCompositeType()
diagnoseFunctionPointerToVoidComparison()
llvm-svn: 139184
2011-09-06 21:27:33 +00:00
Richard Trieu
e4a19fbd0c
Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
...
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType
Functions changed:
DiagnoseBadShiftValues()
CheckShiftOperands()
llvm-svn: 139183
2011-09-06 21:21:28 +00:00
Richard Trieu
4ae7e97667
Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
...
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType
Functions changed:
diagnoseArithmeticOnTwoVoidPointers()
checkArithmeticBinOpPointerOperands()
diagnosePointerIncompatibility()
CheckAdditionOperands()
CheckSubtractionOperands()
llvm-svn: 139182
2011-09-06 21:13:51 +00:00
Richard Trieu
859d23fa5e
Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
...
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType
Functions changed:
CheckVectorOperands()
CheckMultiplyDivideOperands()
CheckRemainderOperands()
llvm-svn: 139181
2011-09-06 21:01:04 +00:00
Douglas Gregor
49695f078e
Implement the Named Return Value Optimization (NRVO) for blocks.
...
llvm-svn: 139178
2011-09-06 20:46:03 +00:00
Richard Trieu
eb29914c5d
Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
...
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType
Functions changed:
CheckTransparentUnionArgumentConstraints()
CheckSingleAssignmentConstraints()
InvalidOperands()
llvm-svn: 139176
2011-09-06 20:40:12 +00:00
Richard Trieu
de4958fb28
Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
...
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType
Functions changed:
CheckAssignmentConstraints()
llvm-svn: 139173
2011-09-06 20:30:53 +00:00
Richard Trieu
a871b97da5
Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
...
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType
Functions changed:
checkPointerTypesForAssignment()
checkBlockPointerTypesForAssignment()
checkObjCPointerTypesForAssignment()
CheckAssignmentConstraints()
llvm-svn: 139170
2011-09-06 20:21:22 +00:00
Richard Trieu
d33e46e943
Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
...
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType
Functions changed:
DiagnoseConditionalForNull()
CheckConditionalOperands()
IsArithmeticBinaryExpr()
DiagnoseConditionalPrecedence()
llvm-svn: 139167
2011-09-06 20:06:39 +00:00
Benjamin Kramer
499c68b5f6
Spelling.
...
llvm-svn: 139165
2011-09-06 19:57:14 +00:00
Richard Trieu
9a52fbb2d0
Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
...
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType
Functions changed:
handleIntegerConversion()
UsualArithmeticConversions()
llvm-svn: 139164
2011-09-06 19:52:52 +00:00
Richard Trieu
cfe3f21cec
Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
...
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType
Functions changed:
handleFloatConversion()
handleComplexIntConvsersion()
llvm-svn: 139153
2011-09-06 18:38:41 +00:00
Richard Trieu
5065cdd0ea
Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
...
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType
Functions changed:
handleComplexFloatToComplexFloatConverstion()
handleComplexFloatConversion()
llvm-svn: 139151
2011-09-06 18:25:09 +00:00
Francois Pichet
4391c7529a
Pass 0 instead of a empty TemplateArgumentListInfo when creating a CXXDependentScopeMemberExpr to handle a "this->" fixit (lookup into dependent bases of class template)
...
Otherwise the fixit doesn't really work for subsequent lookup.
llvm-svn: 139105
2011-09-04 23:00:48 +00:00
Benjamin Kramer
a66aaa93ee
More unused variable removal.
...
llvm-svn: 139080
2011-09-03 08:46:20 +00:00
Benjamin Kramer
2667afa980
Make helpers static, remove unused variables.
...
llvm-svn: 139078
2011-09-03 03:30:59 +00:00
Richard Trieu
48277e5710
Fix some indenting issues in SemaExpr.cpp
...
llvm-svn: 139042
2011-09-02 21:44:27 +00:00
Richard Trieu
7aa58f1eea
Refactor UsualArithmeticConversions() in SemaExpr.cpp into several functions.
...
llvm-svn: 139033
2011-09-02 20:58:51 +00:00
Richard Trieu
eea56f785e
Move the warning for different enum comparisons and the warning for using NULL as a non-pointer in a binary operation into separate functions.
...
llvm-svn: 138995
2011-09-02 03:48:46 +00:00
Richard Trieu
dd82a5c5d7
Reduce code duplication for pointer comparisons in CheckCompareOperands().
...
llvm-svn: 138994
2011-09-02 02:55:45 +00:00
Richard Trieu
aba2280573
Pull out incomplete pointer type checking code, used from arithmetic checking functions, into its own function.
...
llvm-svn: 138993
2011-09-02 02:15:37 +00:00
Richard Trieu
27ae4cb7c4
Refactor CheckConditionalOperands() by moving chunks of code to helper functions making a slimmer function.
...
llvm-svn: 138992
2011-09-02 01:51:02 +00:00
Richard Trieu
3fd7bb8224
Refactor CheckAddressOfOperand() by pulling out redundant code and moving hard coding strings from SemaExpr.cpp to DiagnosticSemaKinds.td.
...
llvm-svn: 138987
2011-09-02 00:47:55 +00:00
Douglas Gregor
e8bbc12152
Extend the ASTContext constructor to delay the initialization of
...
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).
llvm-svn: 138985
2011-09-02 00:18:52 +00:00
Richard Trieu
b10c631f53
Refactor CheckAdditionOperands(), CheckSubtractionOperands(), and CheckIncrementDecrementOperand() in SemaExpr.cpp to move reused code to separate functions.
...
llvm-svn: 138975
2011-09-01 22:53:23 +00:00
Fariborz Jahanian
97d744bea4
objective-c: this patch (re)introduces objective-c's default property
...
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
llvm-svn: 138913
2011-08-31 22:24:06 +00:00
John McCall
fa6f5d6ab8
Don't assert when diagnosing a missing cast of an unknown-anytype
...
message send to an unknown method.
rdar://problem/9416370, redux.
llvm-svn: 138893
2011-08-31 20:57:36 +00:00
Sebastian Redl
22653bac1a
Declare and define implicit move constructor and assignment operator.
...
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.
llvm-svn: 138821
2011-08-30 19:58:05 +00:00
John McCall
0562caaad6
Update the comment on the default-argument conversion fix; thanks to
...
Johannes Schaub for talking me around to sense.
llvm-svn: 138784
2011-08-29 23:55:37 +00:00
John McCall
4bb057d321
Disable the l-value to r-value conversion on C++ class types passed
...
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.
llvm-svn: 138715
2011-08-27 22:06:17 +00:00
John McCall
29ad95b232
The lvalue-to-rvalue on structs in C++ is actually part
...
of default argument promotion and needs to happen unconditionally.
This is particularly semantically important in C++0x.
llvm-svn: 138691
2011-08-27 01:09:30 +00:00
Eli Friedman
755c0c996a
Don't assert on taking the address of a non-type template parameter. Fixes PR10766.
...
llvm-svn: 138648
2011-08-26 20:28:17 +00:00
John McCall
1cd60a2670
In -Wno-error=non-pod-varargs, initialize a temporary with
...
the crazy comma expression so that we get an r-value in the
varargs position.
llvm-svn: 138638
2011-08-26 18:41:18 +00:00
Chandler Carruth
f87d6c00e7
Switch this code to use the more idiomatic 'dyn_cast' pattern.
...
llvm-svn: 137780
2011-08-16 22:30:10 +00:00