summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add an unreachable code checker.Mike Stump2010-01-131-1/+4
| | | | llvm-svn: 93287
* When in objective-c methods, do the built-in name lookup afterFariborz Jahanian2010-01-121-5/+18
| | | | | | ivar name lookup. Fixes pr5986. llvm-svn: 93271
* Don't emit string-comparison or self-comparison warnings inDouglas Gregor2010-01-121-11/+13
| | | | | | | | | | unevaluated contexts, because they only matter for code that will actually be evaluated at runtime. As part of this, I had to extend PartialDiagnostic to support fix-it hints. llvm-svn: 93266
* use DiagRuntimeBehavior to silence the div/rem by zero warning whenChris Lattner2010-01-121-2/+4
| | | | | | not in an evaluated context. This removes some bogus warnings. llvm-svn: 93258
* implement PR6004, warning about divide and remainder by zero.Chris Lattner2010-01-121-14/+27
| | | | llvm-svn: 93256
* Implement name lookup for conversion function template specializationsDouglas Gregor2010-01-111-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | (C++ [temp.mem]p5-6), which involves template argument deduction based on the type named, e.g., given struct X { template<typename T> operator T*(); } x; when we call x.operator int*(); we perform template argument deduction to determine that T=int. This template argument deduction is needed for template specialization and explicit instantiation, e.g., template<> X::operator float*() { /* ... */ } and when calling or otherwise naming a conversion function (as in the first example). This fixes PR5742 and PR5762, although there's some remaining ugliness that's causing out-of-line definitions of conversion function templates to fail. I'll look into that separately. llvm-svn: 93162
* Make Clang complain about taking the address of an unqualified member ↵Sebastian Redl2010-01-111-1/+16
| | | | | | function. Fixes PR5985. llvm-svn: 93150
* Improve the fix-its for -Wparentheses to ensure that the fix-itDouglas Gregor2010-01-081-2/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | suggestions follow recovery. Additionally, add a note to these diagnostics which suggests a fix-it for changing the behavior to what the user probably meant. Examples: t.cpp:2:9: warning: & has lower precedence than ==; == will be evaluated first [-Wparentheses] if (i & j == k) { ^~~~~~~~ ( ) t.cpp:2:9: note: place parentheses around the & expression to evaluate it first if (i & j == k) { ^ ( ) t.cpp:14:9: warning: using the result of an assignment as a condition without parentheses [-Wparentheses] if (i = f()) { ~~^~~~~ ( ) t.cpp:14:9: note: use '==' to turn this assignment into an equality comparison if (i = f()) { ^ == llvm-svn: 92975
* Add an "implicit" bit to CXXThisExpr, so that we can trackDouglas Gregor2010-01-071-3/+10
| | | | | | | implicitness without losing track of the (logical or actual) location where "this" would occur in the source. llvm-svn: 92958
* Whenever we emit a typo-correction diagnostic, also emit a noteDouglas Gregor2010-01-071-1/+13
| | | | | | | pointing to the declaration that we found that has that name (if it is unique). llvm-svn: 92877
* Disallow captured arrays in blocks as well. Radar 7438948.Mike Stump2010-01-051-0/+6
| | | | llvm-svn: 92677
* Disallow capturing vlas inside blocks.Mike Stump2010-01-051-0/+6
| | | | llvm-svn: 92676
* Move the -Wsign-compare logic into SemaChecking.cpp.John McCall2010-01-041-78/+0
| | | | llvm-svn: 92541
* -Wsign-compare shouldn't warn when the signed operand is a conditional operatorJohn McCall2010-01-041-20/+24
| | | | | | | whose operands are non-negative integer constant expressions. This comes up in LLVM in a few places. llvm-svn: 92525
* Implement typo correction for a variety of Objective-C-specificDouglas Gregor2010-01-031-0/+38
| | | | | | | | | | | | | | constructs: - Instance variable lookup ("foo->ivar" and, in instance methods, "ivar") - Property name lookup ("foo.prop") - Superclasses - Various places where a class name is required - Protocol names (e.g., id<proto>) This seems to cover many of the common places where typos could occur. llvm-svn: 92449
* Fix minor oversight for increment/decrement of complex int. Add tests forEli Friedman2010-01-031-1/+1
| | | | | | coverage. llvm-svn: 92433
* When typo correction for an id-expression finds a type (or Objective-CDouglas Gregor2010-01-011-12/+32
| | | | | | | | | | | | | | | | class), provide a suggestion for the type or class found. However, since we can't recover properly in this case, don't provide a fix-it hint. Example: test/FixIt/typo.m:8:3: error: use of undeclared identifier 'NSstring'; did you mean 'NSString'? NSstring *str = @"A string"; ... ^ 1 diagnostic generated. llvm-svn: 92379
* Typo correction for member access into classes/structs/unions, e.g.,Douglas Gregor2009-12-311-1/+18
| | | | | | s.fnd("hello") llvm-svn: 92345
* Implement typo correction for id-expressions, e.g.,Douglas Gregor2009-12-311-15/+39
| | | | | | | | | | | | | typo.cpp:22:10: error: use of undeclared identifier 'radious'; did you mean 'radius'? return radious * pi; ^~~~~~~ radius This was super-easy, since we already had decent recovery by looking for names in dependent base classes. llvm-svn: 92341
* fix PR5917, L'x' was getting the wrong type in c++ mode. PerChris Lattner2009-12-301-2/+8
| | | | | | C++2.13.2p2: "A wide-character literal has type wchar_t" llvm-svn: 92313
* Don't look through casts when looking for the underlying decl for a functionEli Friedman2009-12-261-1/+1
| | | | | | | call; the standard doesn't expect us to, and the program could be doing something crazy. Fixes PR5882. llvm-svn: 92166
* Remove some dead variables clang-analyzer found.Benjamin Kramer2009-12-251-1/+0
| | | | llvm-svn: 92162
* Add test case for PR5868, and improve location information slightly for ↵Douglas Gregor2009-12-241-1/+1
| | | | | | implicit "this" expressions llvm-svn: 92141
* InitializationSequence handles binding to temporaries, so thatDouglas Gregor2009-12-241-3/+0
| | | | | | | | argument-passing doesn't have to. Fixes PR5867, where we were binding a temporary twice in the AST and, therefore, calling its destructor twice. llvm-svn: 92131
* Fix the clang-on-clang build: APFloat reports underflow whenever we get aJohn McCall2009-12-241-1/+5
| | | | | | | denormal, but we only want to diagnose if we underflowed to zero. This allows people to write constants in the denormal range. llvm-svn: 92129
* Diagnose out-of-bounds floating-point constants. Fixes rdar://problem/6974641John McCall2009-12-241-3/+21
| | | | llvm-svn: 92127
* When we see a CXXDefaultArgExpr during template instantiation, rebuildDouglas Gregor2009-12-231-2/+2
| | | | | | | | the default argument so that we're sure to mark any referenced declarations. This gets us another little step closer to fixing PR5810. llvm-svn: 92078
* When using a default function argument for a function template (orDouglas Gregor2009-12-231-3/+18
| | | | | | | | | | | | | | | | | member function thereof), perform the template instantiation each time the default argument is needed. This ensures that (1) We get different CXXTemporary objects for each instantiation, and (2) Any other instantiations or definitions triggered by the instantiation of the default argument expression are guaranteed to happen; previously, they might have been suppressed, e.g., because they happened in an unevaluated context. This fixes the majority of PR5810. However, it does not address the problem where we may have multiple uses of the same CXXTemporary within an expression when the temporary came from a non-instantiated default argument expression. llvm-svn: 92015
* Switch parameter-passing for calls via function pointers (where weDouglas Gregor2009-12-221-15/+16
| | | | | | don't have a FunctionDecl) over to InitializationSequence. llvm-svn: 91906
* Switch InitializedEntity from TypeLoc down to just QualTypes, since we don't ↵Douglas Gregor2009-12-221-5/+2
| | | | | | use the location information but we did spend a bunch of time building faked-up TypeLocs llvm-svn: 91905
* Switch initialization of parameters in a call over toDouglas Gregor2009-12-221-2/+14
| | | | | | | | | | | InitializationSequence (when a FunctionDecl is present). This required a few small fixes to initialization sequences: - Make sure to use the adjusted parameter type for initialization of function parameters. - Implement transparent union calling semantics in C llvm-svn: 91902
* Switch compound literals over to InitializationSequence.Eli Friedman2009-12-221-2/+9
| | | | llvm-svn: 91882
* Centralize the emission/suppression/delay of diagnostics describing runtime ↵Douglas Gregor2009-12-221-59/+51
| | | | | | before in the new function Sema::DiagRuntimeBehavior, addressing one of Chris' comments. llvm-svn: 91870
* Eliminate the ASTContext argument to CXXConstructorDecl::isCopyConstructor, ↵Douglas Gregor2009-12-221-1/+1
| | | | | | since the context is available in the Decl llvm-svn: 91862
* Allow comparison of 'void *' with function pointer Fariborz Jahanian2009-12-211-1/+12
| | | | | | as a g++ extension (fixes radar 7481987). llvm-svn: 91827
* Unresolved implicit member accesses are dependent if the object type is ↵John McCall2009-12-191-0/+1
| | | | | | | | | | dependent. Avoids an assertion arising during object-argument initialization in overload resolution. In theory we can resolve this at definition time if the class hierarchy for the member is fully known. llvm-svn: 91747
* When diagnosing that a decl ref expr is not a value, note the declarationJohn McCall2009-12-181-1/+1
| | | | | | with "declared at" rather than "previous declaration is here". llvm-svn: 91699
* Shift things around so that it's easier to recover from a missingJohn McCall2009-12-161-163/+53
| | | | | | | | | function in a C++ call using an arbitrary call-expression type. Actually exploit this to fix the recovery implemented earlier. The diagnostic is still iffy, though. llvm-svn: 91538
* Introduce a centralized routine in Sema for diagnosing failed lookups (whenJohn McCall2009-12-161-11/+67
| | | | | | | | | used as expressions). In dependent contexts, try to recover by doing a lookup in previously-dependent base classes. We get better diagnostics out, but unfortunately the recovery fails: we need to turn it into a method call expression, not a bare call expression. Thus this is still a WIP. llvm-svn: 91525
* Fix semantic diagnostics that embed English works, from Nicola Gigante!Douglas Gregor2009-12-161-7/+7
| | | | llvm-svn: 91503
* Switch the C++ new expression over to InitializationSequence, ratherDouglas Gregor2009-12-161-4/+15
| | | | | | | | | | | | | | | | | | | | | than using its own partial implementation of initialization. Switched CheckInitializerTypes over to InitializedEntity/InitializationKind, to help move us closer to InitializationSequence. Added InitializedEntity::getName() to retrieve the name of the entity, for diagnostics that care about such things. Implemented support for default initialization in InitializationSequence. Clean up the determination of the "source expressions" for an initialization sequence in InitializationSequence::Perform. Taught CXXConstructExpr to store more location information. llvm-svn: 91492
* Diagnose attempting to assign to a sub-structure of an ivarFariborz Jahanian2009-12-151-0/+3
| | | | | | using objective-c property. (fixes radar 7449707) llvm-svn: 91474
* Fixes a code gen bug related to accessing a nowFariborz Jahanian2009-12-151-1/+3
| | | | | | | | | non-existing 'isa' field of a non-existing struct type all related to legacy type definition for 'id' which we have dropped in clang in favor of a built-in type. (fixes radar 7470820). llvm-svn: 91455
* If a ParmVarDecl's default argument is a CXXExprWithTemporaries, return the ↵Anders Carlsson2009-12-151-9/+2
| | | | | | underlying expr instead. Add getNumDefaultArgTemporaries and getDefaultArgTemporary which returns the temporaries a default arg creates. llvm-svn: 91439
* Support OpenCL 1.1 odd-length vector component accessors.Nate Begeman2009-12-151-9/+1
| | | | | | | For hi/odd of an odd-length vector, the last component is undefined. Since we shuffle with an undef vector, no CodeGen needs to change to support this. llvm-svn: 91437
* Fix some diagnostic-related FIXMEs, from Nicola GiganteDouglas Gregor2009-12-151-4/+3
| | | | llvm-svn: 91433
* Fix a COVTCTII (crash-on-valid-that-clang-thinks-is-invalid, duh),Daniel Dunbar2009-12-151-1/+1
| | | | | | | note_previous_decl was used where note_previous_declaration was intended. Better names or PR5785 might be nice. llvm-svn: 91413
* When certain diagnostics involving run-time behavior would be emittedDouglas Gregor2009-12-121-13/+30
| | | | | | | | in a potentially potentially evaluated context, queue those diagnostics and only emit them if the context ends up being potentially evaluated. This completes the fix for PR5761. llvm-svn: 91213
* Suppress warnings and errors about certain uses of non-POD types (inDouglas Gregor2009-12-121-11/+48
| | | | | | | | __builtin_offsetof, passing through an ellipsis) when we're in an unevaluated context. This is the first part of the fix to PR5761, which deals with the simple case of an unevaluated context. llvm-svn: 91210
* Move composite type finding of two objective-c expressions Fariborz Jahanian2009-12-101-118/+137
| | | | | | into its own helper method. No change in functionality. llvm-svn: 91056
OpenPOWER on IntegriCloud