summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Improve code completion by introducing patterns for the various C andDouglas Gregor2010-01-103-21/+571
| | | | | | | | | | | | | | | | | | | | | | C++ grammatical constructs that show up in top-level (namespace-level) declarations, member declarations, template declarations, statements, expressions, conditions, etc. For example, we now provide a pattern for static_cast<type>(expr) when we can have an expression, or using namespace identifier; when we can have a using directive. Also, improves the results of code completion at the beginning of a top-level declaration. Previously, we would see value names (function names, global variables, etc.); now we see types, namespace names, etc., but no values. llvm-svn: 93134
* Try to make cmake happyAnton Korobeynikov2010-01-101-0/+1
| | | | llvm-svn: 93119
* Generalize target weirdness handling having proper layering in mind:Anton Korobeynikov2010-01-105-5/+130
| | | | | | | | | 1. Add helper class for sema checks for target attributes 2. Add helper class for codegen of target attributes As a proof-of-concept - implement msp430's 'interrupt' attribute. llvm-svn: 93118
* Change the printing of OR_Deleted overload results to print all the candidates,John McCall2010-01-085-53/+108
| | | | | | | | | | | | | | | not just the viable ones. This is reasonable because the most common use of deleted functions is to exclude some implicit conversion during calls; users therefore will want to figure out why some other options were excluded. Started sorting overload results. Right now it just sorts by location in the translation unit (after putting viable functions first), but we can do better than that. Changed bool OnlyViable parameter to PrintOverloadCandidates to an enum for better self-documentation. llvm-svn: 92990
* Reorganize PrintOverloadCandidates. No functionality change.John McCall2010-01-081-113/+144
| | | | llvm-svn: 92979
* 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-074-10/+25
| | | | | | | implicitness without losing track of the (logical or actual) location where "this" would occur in the source. llvm-svn: 92958
* Improve the lead diagnostic for C++ object subscript expressions withJohn McCall2010-01-071-13/+19
| | | | | | | | | no viable overloads. Use a different message when the class provides no operator[] overloads at all; use it for operator(), too. Partially addresses PR 5900. llvm-svn: 92894
* Change ObjCContainerDecl to contain the entire range for the '@end'Ted Kremenek2010-01-072-11/+17
| | | | | | | | | | | piece of the declaration. The '@' and the 'end' are separate tokens, and require two SourceLocations to accurately track. This change was motivated because ObjCContainerDecl::getSourceRange() would previously not return the entire range of the declaration (the 'end' would be left off). llvm-svn: 92891
* Fix the search for visible declarations within a Scope to ensure thatDouglas Gregor2010-01-071-13/+15
| | | | | | | | we look into a Scope that corresponds to a compound statement whose scope was combined with the scope of the function that owns it. This improves typo correction in many common cases. llvm-svn: 92879
* When we typo-correct a base class initializer, point to the base classDouglas Gregor2010-01-071-1/+8
| | | | | | specifier that we corrected to. llvm-svn: 92878
* Whenever we emit a typo-correction diagnostic, also emit a noteDouglas Gregor2010-01-077-1/+35
| | | | | | | pointing to the declaration that we found that has that name (if it is unique). llvm-svn: 92877
* When suggesting a typo correction for an @implementation without aDouglas Gregor2010-01-061-1/+7
| | | | | | | | | | corresponding @interface, provide a note showing which interface we're referring to. This note has the fix-it hint on it. Also, don't automatically apply fix-it hints for notes. They're meant to express fix-its that would change semantics. llvm-svn: 92870
* Move the allocation of designators in DesignatedInitExpr to theDouglas Gregor2010-01-061-1/+1
| | | | | | ASTContext. Fixes <rdar://problem/7495428>. llvm-svn: 92867
* Don't assert when dealing with unsigned casts of lvalues. Fixes PR5961.John McCall2010-01-061-6/+11
| | | | llvm-svn: 92866
* Derive tighter ranges for & and >> in the conversion-checking code.John McCall2010-01-061-6/+38
| | | | llvm-svn: 92862
* Fix a bug when property is redeclared in multipleFariborz Jahanian2010-01-061-0/+26
| | | | | | | continuation classes and its original declaration is imported from a protocol. This fixes radar 7509234. llvm-svn: 92856
* Fix marking of virtual members for nested classes whose first non-pure ↵Douglas Gregor2010-01-061-5/+31
| | | | | | virtual function has a body inlined in the class llvm-svn: 92855
* Make sure that the key-function computation produces the correctDouglas Gregor2010-01-061-10/+27
| | | | | | | | result for a nested class whose first non-pure virtual member function has an inline body. Previously, we were checking for the key function before we had seen the (delayed) inline body. llvm-svn: 92839
* Improve the diagnostics used to report implicitly-generated class membersJohn McCall2010-01-064-13/+52
| | | | | | | | | as parts of overload sets. Also, refer to constructors as 'constructors' rather than functions. Adjust a lot of tests. llvm-svn: 92832
* Significantly rework the calculation of effective integer-expression rangesJohn McCall2010-01-061-176/+221
| | | | | | | | | | | | for -Wsign-compare and -Wconversion, and use that coordinated logic to drive both diagnostics. The new logic works more transparently with implicit conversions, conditional operators, etc., as well as bringing -Wconversion's ability to deal with pseudo-closed operations (e.g. arithmetic on shorts) to -Wsign-compare. Fixes PRs 5887, 5937, 5938, and 5939. llvm-svn: 92823
* Make our marking of virtual members functions in a class beDouglas Gregor2010-01-064-56/+36
| | | | | | | | | | | | | | | | | | | | | deterministic and work properly with templates. Once a class that needs a vtable has been defined, we now do one if two things: - If the class has no key function, we place the class on a list of classes whose virtual functions will need to be "marked" at the end of the translation unit. The delay until the end of the translation unit is needed because we might see template specializations of these virtual functions. - If the class has a key function, we do nothing; when the key function is defined, the class will be placed on the aforementioned list. At the end of the translation unit, we "mark" all of the virtual functions of the classes on the list as used, possibly causing template instantiation and other classes to be added to the list. This gets LLVM's lib/Support/CommandLine.cpp compiling again. llvm-svn: 92821
* Per offline discussion with Doug, don't perform typo correction when we have ↵Ted Kremenek2010-01-061-0/+4
| | | | | | encountered a fatal error. On some files that are woefully wrong (missing headers) this can cause a 3x slowdown in some cases when parsing the file. It makes sense not to perform typo correction in this case because after a fatal error diagnostics will either be suppressed or not really make any sense. llvm-svn: 92809
* Do not diagnose method disguised as property setterFariborz Jahanian2010-01-061-2/+5
| | | | | | for a 'readonly' property. Fixes radar 7427072. llvm-svn: 92808
* Improve key-function computation for templates. In particular:Douglas Gregor2010-01-052-11/+23
| | | | | | | | | | | | | | | | - All classes can have a key function; templates don't change that. non-template classes when computing the key function. - We always mark all of the virtual member functions of class template instantiations. - The vtable for an instantiation of a class template has weak linkage. We could probably use available_externally linkage for vtables of classes instantiated by explicit instantiation declarations (extern templates), but GCC doesn't do this and I'm not 100% that the ABI permits it. llvm-svn: 92753
* 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
* Remove stale comment. We already do format string checking for functions ↵Ted Kremenek2010-01-051-3/+0
| | | | | | with the format attribute. llvm-svn: 92553
* Move the -Wconversion logic into SemaChecking.cpp. There's a fair amount ofJohn McCall2010-01-043-314/+315
| | | | | | | overlap between this and -Wsign-compare, which is why I want them in the same place. llvm-svn: 92543
* Move the -Wsign-compare logic into SemaChecking.cpp.John McCall2010-01-042-78/+81
| | | | llvm-svn: 92541
* Avoid warnings for functions that return a value using MS-style inlineMike Stump2010-01-041-0/+8
| | | | | | | | | | | | | assembly code. This avoids changing the bahvior when normal asm("") statements are used. The type of code affected would be: void* t4(void) { __asm mov eax, fs:[0x10] } I hope people like this version, if not, let me know. llvm-svn: 92531
* Remember if the AsmStmt came from Microsoft-style inline assembly code.Mike Stump2010-01-042-5/+7
| | | | llvm-svn: 92526
* -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
* Make sure to use ASTContext::getAs*ArrayType() when decomposing arrayDouglas Gregor2010-01-041-2/+2
| | | | | | types. Fixes APFloat.cpp compilation failure. llvm-svn: 92523
* When declaring an Objective-C implementation without a correspondingDouglas Gregor2010-01-041-4/+18
| | | | | | | | | | | | | | | | | | | | | | interface, suggest correction of typos. For example, given: @interface NSString @end @implementation NSstring @end we'll warn with: t.m:4:19: warning: cannot find interface declaration for 'NSstring'; did you mean 'NSString'? @implementation NSstring ^ However, since this is just a warning, we don't provide a fix-it hint. Good idea, Ted! llvm-svn: 92488
* Implement typo correction for a variety of Objective-C-specificDouglas Gregor2010-01-036-13/+183
| | | | | | | | | | | | | | 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
* Get rid of more unnecessary code.Eli Friedman2010-01-021-77/+6
| | | | llvm-svn: 92429
* Get rid of some unnecessary code.Eli Friedman2010-01-022-120/+0
| | | | llvm-svn: 92428
* Eliminate dead code.Eli Friedman2010-01-024-83/+0
| | | | llvm-svn: 92424
* Make sure that the search for visible declarations looks into the semantic ↵Douglas Gregor2010-01-011-2/+1
| | | | | | parents of out-of-line function contexts llvm-svn: 92397
* 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 C99 designated field initializers, e.g.,Douglas Gregor2010-01-011-15/+53
| | | | | | | | | | test/FixIt/typo.c:19:4: error: field designator 'bunds' does not refer to any field in type 'struct Window'; did you mean 'bounds'? .bunds. ^~~~~ bounds llvm-svn: 92376
* It's OK for a return type to be incomplete if it's being defined.Anders Carlsson2009-12-311-3/+6
| | | | llvm-svn: 92367
* Make sure that an overriding return type is complete before checking if it's ↵Anders Carlsson2009-12-311-0/+9
| | | | | | covariant. Fixes PR5920. llvm-svn: 92365
* Typo correction for C++ base and member initializers, e.g.,Douglas Gregor2009-12-311-32/+88
| | | | | | | | | | | | | | | test/FixIt/typo.cpp:41:15: error: initializer 'base' does not name a non-static data member or base class; did you mean the base class 'Base'? Derived() : base(), ^~~~ Base test/FixIt/typo.cpp:42:15: error: initializer 'ember' does not name a non-static data member or base class; did you mean the member 'member'? ember() { } ^~~~~ member llvm-svn: 92355
* Typo correction for identifiers within nested name specifiers, e.g.,Douglas Gregor2009-12-311-0/+22
| | | | | | | | | | typo.cpp:18:1: error: use of undeclared identifier 'other_std'; did you mean 'otherstd'? other_std::strng str1; ^~~~~~~~~ otherstd llvm-svn: 92350
* Typo correction for template names, e.g.,Douglas Gregor2009-12-311-1/+25
| | | | | | | | | | typo.cpp:27:8: error: no template named 'basic_sting' in namespace 'std'; did you mean 'basic_string'? std::basic_sting<char> b2; ~~~~~^~~~~~~~~~~ basic_string llvm-svn: 92348
* Typo correction for member access into classes/structs/unions, e.g.,Douglas Gregor2009-12-313-4/+31
| | | | | | s.fnd("hello") llvm-svn: 92345
* Implement typo correction for id-expressions, e.g.,Douglas Gregor2009-12-314-22/+54
| | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud