summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Make helpers static, remove unused variables.Benjamin Kramer2011-09-032-8/+4
| | | | llvm-svn: 139078
* Teach -Wdangling-field to warn about temporaries bound to references asChandler Carruth2011-09-031-9/+17
| | | | | | | | | | | | | well. Also, clean up the flow of the code a bit, and factor things more nicely. Finally, add the test case that was missing from my previous commit (sorry), with new tests added to cover temporaries and other fun cases. llvm-svn: 139077
* Add a simple new warning to catch blatantly dangling pointer andChandler Carruth2011-09-031-2/+51
| | | | | | | | | | | | | | | | | reference members of classes. We've had several bugs reported because of this, and there's no reason not to flag it right away in the compiler. Comments especially welcome on the strategy for implementing this warning (IE, what should trigger this?) and on the text of the warning itself. I'm going to extend this to cover obvious cases with temporaries and beef up the test cases some in subsequent patches. I'll then run it over a large codebase and make sure its not misbehaving before I add it to -Wall or turn it on by default. I think this one might be a good candidate for on by default. llvm-svn: 139075
* Fix some indenting issues in SemaExpr.cppRichard Trieu2011-09-021-4/+3
| | | | llvm-svn: 139042
* Refactor UsualArithmeticConversions() in SemaExpr.cpp into several functions.Richard Trieu2011-09-021-251/+291
| | | | llvm-svn: 139033
* Make StmtDumper::VisitCXXFunctionalCastExpr dump the attached cast kind. ↵Eli Friedman2011-09-021-3/+4
| | | | | | Fix the cast kind for a cast from floating-point to enum type. (The difference isn't actually visible, but that's just because IRGen is overly forgiving.) Per report by Enea Zaffanella on cfe-dev. llvm-svn: 139011
* Move the warning for different enum comparisons and the warning for using ↵Richard Trieu2011-09-021-61/+88
| | | | | | NULL as a non-pointer in a binary operation into separate functions. llvm-svn: 138995
* Reduce code duplication for pointer comparisons in CheckCompareOperands().Richard Trieu2011-09-021-72/+84
| | | | llvm-svn: 138994
* Pull out incomplete pointer type checking code, used from arithmetic ↵Richard Trieu2011-09-021-24/+22
| | | | | | checking functions, into its own function. llvm-svn: 138993
* Refactor CheckConditionalOperands() by moving chunks of code to helper ↵Richard Trieu2011-09-021-163/+227
| | | | | | functions making a slimmer function. llvm-svn: 138992
* Refactor CheckAddressOfOperand() by pulling out redundant code and moving ↵Richard Trieu2011-09-021-9/+14
| | | | | | hard coding strings from SemaExpr.cpp to DiagnosticSemaKinds.td. llvm-svn: 138987
* Extend the ASTContext constructor to delay the initialization ofDouglas Gregor2011-09-028-40/+40
| | | | | | | | 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
* Refactor CheckAdditionOperands(), CheckSubtractionOperands(), and ↵Richard Trieu2011-09-011-21/+29
| | | | | | CheckIncrementDecrementOperand() in SemaExpr.cpp to move reused code to separate functions. llvm-svn: 138975
* Don't try keeping a 'LeadingEmptyMacroLoc' in NullStmt. This failsArgyrios Kyrtzidis2011-09-011-2/+2
| | | | | | in the face of buffering C++/ObjC method bodies. llvm-svn: 138972
* Extend the self-reference warning to catch when a constructor references ↵Richard Trieu2011-09-012-13/+68
| | | | | | | | | itself upon initialization, such as using itself within its own copy constructor. struct S {}; S s(s); llvm-svn: 138969
* When defining the implicit move assignment operator, don't performDouglas Gregor2011-09-011-3/+9
| | | | | | | | semantic analysis when taking the address of an xvalue. Instead, just build the unary operator directly, since it's safe to do so (from the IRgen and AST perspectives) for any glvalue. Fixes PR10822. llvm-svn: 138935
* objective-c: this patch (re)introduces objective-c's default propertyFariborz Jahanian2011-08-316-143/+11
| | | | | | | | | | 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
* Don't assert when diagnosing a missing cast of an unknown-anytypeJohn McCall2011-08-312-3/+9
| | | | | | | | message send to an unknown method. rdar://problem/9416370, redux. llvm-svn: 138893
* objective-c - This patch buffers method implementations Fariborz Jahanian2011-08-311-6/+14
| | | | | | | | | | | | | and does the Sema on their body after the entire class/category @implementation is seen. This change allows messaging of forward private methods, as well as, access to synthesized ivars of properties with foward synthesize declarations; among others. In effect, this patch removes several restrictions placed on objective-c due to in-place semantics processing of methods. This is part of // rdar://8843851. llvm-svn: 138865
* Improve the diagnostic text for -Wmissing-noreturn to include the nameChandler Carruth2011-08-311-3/+8
| | | | | | | | | | | | | | of the function in question when applicable (that is, not for blocks). Patch by Joerg Sonnenberger with some stylistic tweaks by me. When discussing this weth Joerg, streaming the decl directly into the diagnostic didn't work because we have a pointer-to-const, and the overload doesn't accept such. In order to make my style tweaks to the patch, I first changed the overload to accept a pointer-to-const, and then changed the diagnostic printing layer to also use a pointer-to-const, cleaning up a gross line of code along the way. llvm-svn: 138854
* Allow C99 hexfloats in C++0x mode. This change resolves the standardsDouglas Gregor2011-08-301-0/+24
| | | | | | | | | collision between C99 hexfloats and C++0x user-defined literals by giving C99 hexfloats precedence. Also, warning about user-defined literals that conflict with hexfloats and those that have names that are reserved by the implementation. Fixes <rdar://problem/9940194>. llvm-svn: 138839
* Fix PR10694: Boolean conversions can be from pointers, and those conversionsJeffrey Yasskin2011-08-301-0/+5
| | | | | | aren't considered narrowing conversions. llvm-svn: 138838
* Declare and define implicit move constructor and assignment operator.Sebastian Redl2011-08-303-71/+1205
| | | | | | | | | 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
* Remove a few mutating ObjCCategoryDecl methods.Argyrios Kyrtzidis2011-08-301-19/+10
| | | | | | | | | | | Remove -setClassInterface -setNextClassCategory -insertNextClassCategory and combine them in the Create function. llvm-svn: 138817
* Remove a couple of unnecessary objc method lookups.Argyrios Kyrtzidis2011-08-301-7/+7
| | | | llvm-svn: 138815
* Be sure to emit lvalue-to-rvalue casts for loads from x-values.John McCall2011-08-301-4/+4
| | | | | | | Doing this happens to disrupt the pattern that ARC was looking for for move optimizations, so we need to fix that simultaneously. llvm-svn: 138789
* Fix a typo when determining whether to strip cv-qualifiers during template ↵Douglas Gregor2011-08-301-1/+1
| | | | | | argument deduction llvm-svn: 138787
* Update the comment on the default-argument conversion fix; thanks toJohn McCall2011-08-291-6/+10
| | | | | | Johannes Schaub for talking me around to sense. llvm-svn: 138784
* Do not warn about [super finalize] in arc mode.Nico Weber2011-08-291-1/+3
| | | | llvm-svn: 138776
* Thread safety: added basic handling for pt_guarded_by/var and guarded_by/var ↵Caitlin Sadowski2011-08-291-4/+120
| | | | | | annotations. We identify situations where we are accessing (reading or writing) guarded variables, and report an error if the appropriate locks are not held. llvm-svn: 138774
* Minor clean up of objc's decl context stuff.Fariborz Jahanian2011-08-292-1/+2
| | | | | | No change in functionality. llvm-svn: 138742
* Thread safety: various minor bugfixes, with test casesCaitlin Sadowski2011-08-291-13/+34
| | | | | | This patch is by DeLesley Hutchins. llvm-svn: 138738
* Print 'int' instead of 'const int' in the narrowing conversion error, since theJeffrey Yasskin2011-08-291-3/+3
| | | | | | | | | qualification of a type doesn't affect whether a conversion is a narrowing conversion. This doesn't work in template cases because SubstTemplateTypeParmType gets in the way. llvm-svn: 138735
* Warn on missing [super finalize] calls.Nico Weber2011-08-284-2/+19
| | | | | | This matches gcc's logic. Second half of PR10661. llvm-svn: 138730
* Disable the l-value to r-value conversion on C++ class types passedJohn McCall2011-08-271-3/+9
| | | | | | | | | | | 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
* objective-c - Make warning on unimplemented protocols pointFariborz Jahanian2011-08-271-6/+6
| | | | | | | to class implementation where it is supposed to be implemented. // rdar://10009982. llvm-svn: 138714
* objective-c: Treat top-level objective-c declarationsFariborz Jahanian2011-08-273-23/+15
| | | | | | | | | | , such as list of forward @class decls, in a DeclGroup node. Deal with its consequence throught clang. This is in preparation for more Sema work ahead. // rdar://8843851. Feel free to reverse if it breaks something important and I am unavailable. llvm-svn: 138709
* The lvalue-to-rvalue on structs in C++ is actually partJohn McCall2011-08-272-17/+42
| | | | | | | of default argument promotion and needs to happen unconditionally. This is particularly semantically important in C++0x. llvm-svn: 138691
* In C++0x mode, suggest nullptr as the initializer for an uninitializedDouglas Gregor2011-08-271-1/+3
| | | | | | pointer variable. Patch by David Blaikie! llvm-svn: 138687
* Introduce support for a simple module import declaration, whichDouglas Gregor2011-08-261-0/+14
| | | | | | | | | | | | | | | | | | | | | | loads the named module. The syntax itself is intentionally hideous and will be replaced at some later point with something more palatable. For now, we're focusing on the semantics: - Module imports are handled first by the preprocessor (to get macro definitions) and then the same tokens are also handled by the parser (to get declarations). If both happen (as in normal compilation), the second one is redundant, because we currently have no way to hide macros or declarations when loading a module. Chris gets credit for this mad-but-workable scheme. - The Preprocessor now holds on to a reference to a module loader, which is responsible for loading named modules. CompilerInstance is the only important module loader: it now knows how to create and wire up an AST reader on demand to actually perform the module load. - We search for modules in the include path, using the module name with the suffix ".pcm" (precompiled module) for the file name. This is a temporary hack; we hope to improve the situation in the future. llvm-svn: 138679
* objc-arc: Mention property's attribute by name whenFariborz Jahanian2011-08-261-1/+3
| | | | | | | finding life-time conflict with its declared ivar. // rdar://10007230 llvm-svn: 138659
* Don't assert on taking the address of a non-type template parameter. Fixes ↵Eli Friedman2011-08-261-1/+1
| | | | | | PR10766. llvm-svn: 138648
* Make sure we don't crash printing builtin candidates for overloads of ↵Eli Friedman2011-08-261-4/+5
| | | | | | deleted operators. Fixes PR10757. llvm-svn: 138645
* In -Wno-error=non-pod-varargs, initialize a temporary withJohn McCall2011-08-261-2/+11
| | | | | | | the crazy comma expression so that we get an r-value in the varargs position. llvm-svn: 138638
* Be sure to do unary conversions on the operand to an ARCJohn McCall2011-08-261-0/+4
| | | | | | bridged cast. Noticed by AST inspection by Ted Kremenek! llvm-svn: 138616
* Fix a crash-on-invalid.Matt Beaumont-Gay2011-08-251-1/+1
| | | | | | | | Much to everyone's surprise, the default constructor for TypeResult produces an instance with Invalid == false. This seems like a decision we may want to revisit. llvm-svn: 138601
* Don't warn on category implementing a method, if Fariborz Jahanian2011-08-251-1/+1
| | | | | | | declated method in the class belongs to a synthesized property getter/setter. // rdar://10014946 llvm-svn: 138598
* Introduce a -cc1 option "-emit-module", that creates a binary moduleDouglas Gregor2011-08-251-6/+13
| | | | | | | | | from the given source. -emit-module behaves similarly to -emit-pch, except that Sema is somewhat more strict about the contents of -emit-module. In the future, there are likely to be more interesting differences. llvm-svn: 138595
* objc - fix a bug exposed by my recent decl contextFariborz Jahanian2011-08-251-0/+3
| | | | | | changes. // rdar://10015110 llvm-svn: 138594
* Reverse r138567 until a buildbot failure is investigated.Fariborz Jahanian2011-08-251-11/+11
| | | | llvm-svn: 138584
OpenPOWER on IntegriCloud