summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Issue the 2nd fixit even if fix-it hint is supressed.Fariborz Jahanian2011-04-131-6/+5
| | | | | | // rdar://9091893 llvm-svn: 129481
* No fixit hint for builtin expressions which areFariborz Jahanian2011-04-131-6/+8
| | | | | | defined in a macro. // rdar://9091893 llvm-svn: 129465
* From Vassil Vassilev: Give external source's last resort lookup a chance, ↵Axel Naumann2011-04-131-2/+2
| | | | | | even if an identifier could resolve to a builtin. llvm-svn: 129438
* Still not used to put the * next to the variable name.Francois Pichet2011-04-131-1/+1
| | | | llvm-svn: 129426
* In Microsoft mode, within class scope, if a CXXScopeSpec's type is equal to ↵Francois Pichet2011-04-131-1/+32
| | | | | | | | | | | | | | | | | | the type of one of the base classes then downgrade the missing typename error to a warning. Up to now this is the only case I found where MSVC doesn't require "typename" at class scope. Really strange! This fixes 1 error when parsing the MSVC 2008 header files. Example: template<class T> class A { public: typedef int TYPE; }; template<class T> class B : public A<T> { public: A<T>::TYPE a; // no typename required because A<T> is a base class. }; llvm-svn: 129425
* Redeclaration of 'self' should be flagged inFariborz Jahanian2011-04-121-0/+11
| | | | | | | objective-c instead of crashing in IRgen. // rdar://9154582. llvm-svn: 129412
* Don't suggest dynamic_cast or typeid as code completion results whenDouglas Gregor2011-04-121-22/+29
| | | | | | | | RTTI is disabled. Similarly, don't suggest throw or try as code completion results when C++ exceptions are disabled. Fixes <rdar://problem/9193560>. llvm-svn: 129346
* Objective-C++: The global namespace is an associated namespace of anDouglas Gregor2011-04-121-1/+4
| | | | | | Objective-C pointer type. Fixes <rdar://problem/9142559>. llvm-svn: 129339
* After some discussion with Doug, we decided that it made a lot more senseJohn McCall2011-04-121-179/+200
| | | | | | | | | for __unknown_anytype resolution to destructively modify the AST. So that's what it does now, which significantly simplifies some of the implementation. Normal member calls work pretty cleanly now, and I added support for propagating unknown-ness through &. llvm-svn: 129331
* More __unknown_anytype work.John McCall2011-04-111-93/+283
| | | | llvm-svn: 129269
* Remove CK_DynamicToNull.Anders Carlsson2011-04-111-8/+0
| | | | llvm-svn: 129265
* PR9669: implement correct checking for [dcl.init.string]p2.Eli Friedman2011-04-111-5/+14
| | | | llvm-svn: 129260
* As a first step towards fixing PR9641, add a CK_DynamicToNull cast kind whichAnders Carlsson2011-04-101-0/+8
| | | | | | | | | | | | | | | | | | represents a dynamic cast where we know that the result is always null. For example: struct A { virtual ~A(); }; struct B final : A { }; struct C { }; bool f(B* b) { return dynamic_cast<C*>(b); } llvm-svn: 129256
* Simplify calling CheckPlaceholderExpr, converge on it in a few places,John McCall2011-04-104-62/+41
| | | | | | and move a vector-splat check to follow l-value conversion. llvm-svn: 129254
* Enhance the diagnostic for literal float -> int conversions to suggestChandler Carruth2011-04-101-4/+35
| | | | | | | | | | | | rewriting the literal when the value is integral. It is not uncommon to see code written as: const int kBigNumber = 42e5; Without any real awareness that this is no longer an ICE. The note helps automate and ease the process of fixing code that violates the warning. llvm-svn: 129243
* Refactor 129240 to merge the old default argument into the new parameter.Francois Pichet2011-04-101-5/+13
| | | | llvm-svn: 129242
* MSVC accepts that default parameters be redefined for member functionsFrancois Pichet2011-04-101-3/+14
| | | | | | | | of template class. The new value is ignored. This fixes 1 error when parsing MSVC 2010 header files with clang. llvm-svn: 129240
* Fix a bunch of major problems with __unknown_anytype and properly testJohn McCall2011-04-094-39/+120
| | | | | | for them. The only major missing feature is references. llvm-svn: 129234
* PR8369: make __attribute((regparm(0))) work correctly. Original patch byEli Friedman2011-04-093-4/+5
| | | | | | pageexec@freemail.hu, tweaks by me. llvm-svn: 129206
* Clean up the bool conversion warning. Group it with other conversionChandler Carruth2011-04-091-1/+2
| | | | | | | warnings, and make its text appropriate for constant bool expressions other than 'false'. This should finish off PR9612. llvm-svn: 129205
* Add support for warning on general null pointer expressions of booleanChandler Carruth2011-04-091-5/+5
| | | | | | | type rather than just the literal 'false'. This begins fixing PR9612, but the message is now wrong. WIP, the cleanup of the messaging is next. llvm-svn: 129204
* add a __sync_swap builtin to fill out the rest of the __sync builtins. Chris Lattner2011-04-091-1/+4
| | | | | | Patch by Dave Zarzycki! llvm-svn: 129189
* Use ExprResult& instead of Expr *& in SemaJohn Wiegley2011-04-0815-1328/+1768
| | | | | | | | | | | | | | | | | | | | | | | | | This patch authored by Eric Niebler. Many methods on the Sema class (e.g. ConvertPropertyForRValue) take Expr pointers as in/out parameters (Expr *&). This is especially true for the routines that apply implicit conversions to nodes in-place. This design is workable only as long as those conversions cannot fail. If they are allowed to fail, they need a way to report their failures. The typical way of doing this in clang is to use an ExprResult, which has an extra bit to signal a valid/invalid state. Returning ExprResult is de riguour elsewhere in the Sema interface. We suggest changing the Expr *& parameters in the Sema interface to ExprResult &. This increases interface consistency and maintainability. This interface change is important for work supporting MS-style C++ properties. For reasons explained here <http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-February/013180.html>, seemingly trivial operations like rvalue/lvalue conversions that formerly could not fail now can. (The reason is that given the semantics of the feature, getter/setter method lookup cannot happen until the point of use, at which point it may be found that the method does not exist, or it may have the wrong type, or overload resolution may fail, or it may be inaccessible.) llvm-svn: 129143
* In C++ the argument of logical not should always be bool. Added missing ↵Abramo Bagnara2011-04-073-15/+26
| | | | | | implicit cast for scalars. llvm-svn: 129066
* Basic, untested implementation for an "unknown any" type requested by LLDB.John McCall2011-04-072-35/+186
| | | | | | | | | | | | The idea is that you can create a VarDecl with an unknown type, or a FunctionDecl with an unknown return type, and it will still be valid to access that object as long as you explicitly cast it at every use. I'm still going back and forth about how I want to test this effectively, but I wanted to go ahead and provide a skeletal implementation for the LLDB folks' benefit and because it also improves some diagnostic goodness for placeholder expressions. llvm-svn: 129065
* Wide Pascal strings should be of type wchar_t[] and not unsigned char[].Anders Carlsson2011-04-061-2/+4
| | | | llvm-svn: 129017
* Fix lookup for class messages sent to qualified-classFariborz Jahanian2011-04-061-30/+44
| | | | | | | types such that protocols are seached first. Fixes // rdar://9224670 llvm-svn: 129016
* Simplify the tracking of when to issue a fixit hint, making the helperChandler Carruth2011-04-051-13/+18
| | | | | | | | function more clear and obvious in behavior. Add some comments documenting the behavior of the primary diagnostic helper. llvm-svn: 128901
* Separate the logic for issuing the initialization fixit hint from theChandler Carruth2011-04-051-4/+10
| | | | | | | diagnostic emission. The fixit hint, when suggested, typically has nothing to do with the nature or form of the reference. llvm-svn: 128899
* Begin refactoring the uninitialized warning code that I uglied up. ThisChandler Carruth2011-04-051-91/+94
| | | | | | | | | | | | | extracts a function to handle the emission of the diagnostic separately from the walking over the set of uninitialized uses. Also updates the naming used within this extracted function to be a bit more consistent with the rest of Clang's naming patterns. The next step will be breaking this apart so that we can go through different functions rather than tracking so many boolean variables. llvm-svn: 128898
* Fix PR9624 by explicitly disabling uninitialized warnings for direct self-init:Chandler Carruth2011-04-051-17/+28
| | | | | | | | | | | | | | | int x = x; GCC disables its warnings on this construct as a way of indicating that the programmer intentionally wants the variable to be uninitialized. Only the warning on the initializer is turned off in this iteration. This makes the code a lot more ugly, but starts commenting the surprising behavior here. This is a WIP, I want to refactor it substantially for clarity, and to determine whether subsequent warnings should be suppressed or not. llvm-svn: 128894
* Cleanup the style of some of this code prior to functional changes.Chandler Carruth2011-04-051-25/+28
| | | | | | | | | I think this moves the code in the desired direction of the new style recommendations (and style conventional in Clang), but if anyone prefers the previous style, or has other suggestions just chime in and I'll follow up. llvm-svn: 128878
* Refactor one helper function to merely forward to another so that thereChandler Carruth2011-04-051-7/+6
| | | | | | is a single implementation. No functionality change intended. llvm-svn: 128877
* Fix PR 9626 (duplicated self-init warnings under -Wuninitialized) with ↵Ted Kremenek2011-04-042-10/+31
| | | | | | | | | | | | | | numerous CFG and UninitializedValues analysis changes: 1) Change the CFG to include the DeclStmt for conditional variables, instead of using the condition itself as a faux DeclStmt. 2) Update ExprEngine (the static analyzer) to understand (1), so not to regress. 3) Update UninitializedValues.cpp to initialize all tracked variables to Uninitialized at the start of the function/method. 4) Only use the SelfReferenceChecker (SemaDecl.cpp) on global variables, leaving the dataflow analysis to handle other cases. The combination of (1) and (3) allows the dataflow-based -Wuninitialized to find self-init problems when the initializer contained control-flow. llvm-svn: 128858
* -Wuninitialized: use "self-init" warning when issue uninitialized values ↵Ted Kremenek2011-04-041-2/+45
| | | | | | warnings from the dataflow analysis that include within the initializer of a variable. llvm-svn: 128843
* -Wuninitialized: don't issue fixit for initializer if a variable declaration ↵Ted Kremenek2011-04-041-0/+4
| | | | | | already has an initializer. llvm-svn: 128838
* When emitting a "too many arguments to function call..." error, also include ↵Ted Kremenek2011-04-041-0/+7
| | | | | | a note with a location for the function prototype. llvm-svn: 128833
* PR9615: make sure we destroy any temporaries returned by operator->.Eli Friedman2011-04-041-1/+2
| | | | | | | I'm pretty sure this is the right fix, but I would appreciate it if someone else would double-check. llvm-svn: 128806
* Make -Wheader-hygiene not complain about USING_NAMESPACE_THROUGH_MACRO in a ↵Nico Weber2011-04-021-1/+1
| | | | | | non-header file. llvm-svn: 128780
* Fix an error in TreeTransform where we failed to copy the TemplateName'sChandler Carruth2011-04-011-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | location into a TemplateSpecializationTypeLoc. These were found using a hand-written program to inspect every source location in TemplateSpecializationTypeLocs and Valgrind. I don't know of any way to test them in Clang's existing test suite sadly. Example code that triggers the ElaboratedType case: template <typename T> struct X1 { template <typename U> struct X1_1 { int x; }; }; template <typename T, typename U> struct X2 { typename X1<T>::template X1_1<U> B; }; X2<char, int> x2; The other fix was simply spotted by inspection. I audited all constructions of [Dependent]TemplateSpecializationTypeLocs in TreeTransform.h, and the rest set the TemplateNameLoc properly. llvm-svn: 128702
* Make ChainedIncludesSource an ExternalSemaSource, otherwise initialization ↵Sebastian Redl2011-03-311-1/+1
| | | | | | of the ASTReader is incomplete, leading to errors like not realizing std::type_info is already defined. llvm-svn: 128664
* de-sugared when accessing property reference type.Fariborz Jahanian2011-03-302-2/+2
| | | | | | Add a test case for synthesize ivar. // rdar://9070460 llvm-svn: 128554
* Fix an unused variable warning in release builds and make theChandler Carruth2011-03-291-3/+3
| | | | | | assert-less codepath marginally more efficient. llvm-svn: 128472
* Accept __declspec(dllimport) for function defined at class scope in ↵Francois Pichet2011-03-291-1/+3
| | | | | | | | Microsoft mode. This fixes a bunch of errors when compiling MSVC header files with the -DDLL flag. llvm-svn: 128457
* Fix a bug in how we were resolving the address of overloaded functionsChandler Carruth2011-03-291-17/+38
| | | | | | | | | | | | | | | | | | | | | | | | when the resolution took place due to a single template specialization being named with an explicit template argument list. In this case, the "resolution" doesn't take into account the target type at all, and therefore can take place for functions, static member functions, and *non-static* member functions. The latter weren't being properly checked and their proper form enforced in this scenario. We now do so. The result of this last form slipping through was some confusing logic in IsStandardConversion handling of these resolved address-of expressions which eventually exploded in an assert. Simplify this logic a bit and add some more aggressive asserts to catch improperly formed expressions getting into this routine. Finally add systematic testing of member functions, both static and non-static, in the various forms they can take. One of these is essentially PR9563, and this commit fixes the crash in that PR. However, the diagnostics for this are still pretty terrible. We at least are now accepting the correct constructs and rejecting the invalid ones rather than accepting invalid or crashing as before. llvm-svn: 128456
* Don't do the checks of Sema::DiagnoseEqualityWithExtraParens() on ↵Argyrios Kyrtzidis2011-03-281-0/+3
| | | | | | type-dependent expressions. Fixes rdar://9027658. llvm-svn: 128437
* Implements property of reference types. AddingFariborz Jahanian2011-03-283-12/+32
| | | | | | | an executable test to llvm test suite. // rdar://9070460. llvm-svn: 128435
* refactoringAnton Yartsev2011-03-281-3/+1
| | | | llvm-svn: 128427
* Also 'self' in blocks need be handled specially.Fariborz Jahanian2011-03-281-1/+4
| | | | | | // rdar://9181463 llvm-svn: 128410
* Fix PR9572 and neighboring lurking crashers.Matt Beaumont-Gay2011-03-281-2/+13
| | | | llvm-svn: 128401
OpenPOWER on IntegriCloud