summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Use CheckAssignmentConstraints for checking the cleanup attr function. Fixes ↵Anders Carlsson2009-02-251-1/+1
| | | | | | PR3656. llvm-svn: 65461
* C99 DR #316 implies that the function parameter types that are knownDouglas Gregor2009-02-253-2/+21
| | | | | | | | | | only from a function definition (that does not have a prototype) are only used to determine the compatible with other declarations of that same function. In particular, when referencing the function we pretend as if it does not have a prototype. Implement this behavior, which fixes PR3626. llvm-svn: 65460
* Minor cleanup for IntToBlockPointer so it applies to all callers of Eli Friedman2009-02-251-5/+1
| | | | | | | Sema::CheckAssignmentConstraints; not really visible, but the right thing to do. llvm-svn: 65428
* handle @encode interactions with array initializers.Chris Lattner2009-02-241-17/+21
| | | | llvm-svn: 65401
* rename CheckStringLiteralInit to CheckStringInit and pass in the Chris Lattner2009-02-241-19/+26
| | | | | | string size as an argument. llvm-svn: 65400
* make SemaRef be a reference to sema, not a pointer.Chris Lattner2009-02-241-78/+78
| | | | llvm-svn: 65399
* move InitListChecker to be private to SemaInit.cppChris Lattner2009-02-242-5/+3
| | | | llvm-svn: 65398
* Make CheckSingleInitializer a static function in SemaInit.cppChris Lattner2009-02-242-15/+13
| | | | llvm-svn: 65397
* make CheckStringLiteralInit a static function in SemaInit.cppChris Lattner2009-02-242-19/+19
| | | | llvm-svn: 65396
* change IsStringLiteralInit into a static function in SemaInit.cppChris Lattner2009-02-242-8/+8
| | | | llvm-svn: 65395
* move some initialization checking code from SemaDecl.cppChris Lattner2009-02-242-144/+156
| | | | | | to SemaInit.cpp, no functionality change. llvm-svn: 65394
* first wave of fixes for @encode sema support. This is part of PR3648.Chris Lattner2009-02-242-4/+15
| | | | | | | The big difference here is that (like string literal) @encode has array type, not pointer type. llvm-svn: 65391
* some minor cleanups, handle ObjCEncodeExpr in a couple places.Chris Lattner2009-02-241-6/+6
| | | | llvm-svn: 65389
* When we're declaring an object or function with linkage, teach nameDouglas Gregor2009-02-243-25/+62
| | | | | | | lookup to skip over names without linkage. This finishes <rdar://problem/6127293>. llvm-svn: 65386
* Extend the implicit declaration and checking against out-of-scopeDouglas Gregor2009-02-242-104/+163
| | | | | | | | | | | | | external declarations to also support external variable declarations. Unified the code for these two cases into two new subroutines. Note that we fail to diagnose cases like the one Neil pointed out, where a visible non-external declaration hides an external declaration by the same name. That will require some reshuffling of name lookup. llvm-svn: 65385
* In C, when we see a function declaration within a local scope, exportDouglas Gregor2009-02-242-1/+76
| | | | | | | | | | that declaration to global scope so that it can be found from other scopes. This allows us to diagnose redeclaration errors for external declarations across scopes. We also warn when name lookup finds such an out-of-scope declaration. This is part of <rdar://problem/6127293>; we'll also need to do the same thing for variables. llvm-svn: 65373
* Improve merging of function declarations. Specifically:Douglas Gregor2009-02-242-26/+118
| | | | | | | | | | | | | | | | - When we are declaring a function in local scope, we can merge with a visible declaration from an outer scope if that declaration refers to an entity with linkage. This behavior now works in C++ and properly ignores entities without linkage. - Diagnose the use of "static" on a function declaration in local scope. - Diagnose the declaration of a static function after a non-static declaration of the same function. - Propagate the storage specifier to a function declaration from a prior declaration (PR3425) - Don't name-mangle "main" llvm-svn: 65360
* fix rdar://6611778, a redefinition of an interface was causing anChris Lattner2009-02-232-6/+14
| | | | | | | | assertion when the ivars and method list was reset into the existing interface. To fix this, mark decls as invalid when they are redefined, and don't insert ivars/methods into invalid decls. llvm-svn: 65340
* - Generate error for protocol qualifiers on 'Class'.Steve Naroff2009-02-231-2/+6
| | | | | | - Generate error for protocol qualifiers on non-ObjC types. llvm-svn: 65333
* Revert http://llvm.org/viewvc/llvm-project?view=rev&revision=65244.Steve Naroff2009-02-232-5/+0
| | | | | | Remove support for "Class<P>". Will be making this an error. llvm-svn: 65332
* Remove isSuperExpr(), which ignores any casts on 'super'.Steve Naroff2009-02-231-22/+6
| | | | | | | I don't think casting super makes any sense (since it won't effect method lookup). Will discuss with other offline and decide what to do. llvm-svn: 65317
* Sema::ActOnInstanceMessage(): Tighen up the lookup rules for handling ↵Steve Naroff2009-02-231-9/+31
| | | | | | messages to 'Class'. Also improve "super" handling. llvm-svn: 65300
* Minor cleanup, replace bool with qual_empty().Steve Naroff2009-02-221-3/+1
| | | | llvm-svn: 65293
* Contains the following (related to problems found while investigting ↵Steve Naroff2009-02-221-24/+15
| | | | | | | | | | <rdar://problem/6497631> Message lookup is sometimes different than gcc's). - Implement instance/class overloading in ObjCContainerDecl (removing a FIXME). This involved hacking NamedDecl::declarationReplaces(), which took awhile to figure out (didn't realize replace was the default). - Changed Sema::ActOnInstanceMessage() to remove redundant warnings when dealing with protocols. For now, I've omitted the "protocol" term in the diagnostic. It simplifies the code flow and wan't always 100% accurate (e.g. "Foo<Prot>" looks in the class interface, not just the protocol). - Changed several test cases to jive with the above changes. llvm-svn: 65292
* Throw the switch to exclusively use Evaluate (along with the small Eli Friedman2009-02-221-0/+6
| | | | | | | | | | | | | | | | helper isConstantInitializer) to check whether an initializer is constant. This passes tests, but it's possible that it'll cause regressions with real-world code. Future work: 1. The diagnostics obtained this way are lower quality at the moment; some work both here and in Evaluate is needed for accurate diagnostics. 2. We probably need some extra code when we're in -pedantic mode so we can strictly enforce the rules in C99 6.6p7. 3. Dead code cleanup (this should wait until after 2, because we might want to re-use some of the code). llvm-svn: 65265
* Remove debugging statement.Steve Naroff2009-02-221-1/+0
| | | | llvm-svn: 65257
* Match gcc and always perform array/function conversion for asm input exprs. ↵Anders Carlsson2009-02-221-2/+2
| | | | | | Fixes PR3641. llvm-svn: 65256
* More work to integrate newly added ObjCQualifiedClassType into the type system.Steve Naroff2009-02-212-2/+17
| | | | | | This is necessary 'plumbing' to fix <rdar://problem/6497631> Message lookup is sometimes different than gcc's. llvm-svn: 65248
* Add support for GCC ObjC extension "Class<protocol>". Sigh.Steve Naroff2009-02-211-0/+4
| | | | | | | | Found while researching <rdar://problem/6497631> Message lookup is sometimes different than gcc's. Will never be seen in user code. Needed to pass dejagnu testsuite. llvm-svn: 65244
* Warn about bogus protocol qualifiers.Steve Naroff2009-02-211-0/+3
| | | | llvm-svn: 65241
* Warn on use of __weak attribute on localFariborz Jahanian2009-02-211-0/+5
| | | | | | variable (objc2 gc specific). llvm-svn: 65240
* This fixes <rdar://problem/6497650> More type mismatches issues with clang.Steve Naroff2009-02-211-14/+0
| | | | | | | | | | Move two key ObjC typechecks from Sema::CheckPointerTypesForAssignment() to ASTContext::mergeTypes(). This allows us to take advantage of the recursion in ASTContext::mergeTypes(), removing some bogus warnings. This test case I've added includes an example where we still warn (and GCC doesn't). Need to talk with folks and decide what to do. At this point, the major bogosities should be fixed. llvm-svn: 65231
* Slight tweak to last commit: make sure to copy CVR qualifiers for fixed Eli Friedman2009-02-211-1/+3
| | | | | | pointer types. llvm-svn: 65210
* Re-fix r65140 correctly.Eli Friedman2009-02-212-23/+72
| | | | llvm-svn: 65208
* Fix <rdar://problem/6500554> missing objc error message.Steve Naroff2009-02-202-7/+22
| | | | llvm-svn: 65198
* fix indentationChris Lattner2009-02-201-3/+3
| | | | llvm-svn: 65170
* silence some warnings in no asserts mode.Chris Lattner2009-02-201-5/+4
| | | | llvm-svn: 65169
* add plumbing to get ASTContext& down to allocation/deallocation points in ↵Chris Lattner2009-02-202-14/+15
| | | | | | | | ObjCList, but don't start using it yet. Renamed some methods to be more consistent. llvm-svn: 65168
* move the @implementation ivar list to being an ObjCList, which preventsChris Lattner2009-02-201-8/+5
| | | | | | it from being leaked, among other things. llvm-svn: 65150
* Always try to fold array sizes, and warn if we could fold something that ↵Anders Carlsson2009-02-202-47/+16
| | | | | | isn't an ICE. This makes us compatible with GCC. llvm-svn: 65140
* remove some more methods from objc decls, using the iteratorChris Lattner2009-02-204-29/+28
| | | | | | interfaces more consistently. llvm-svn: 65138
* Fix <rdar://problem/6586239> bitfield constraints not enforced (for ObjC)Steve Naroff2009-02-201-6/+3
| | | | llvm-svn: 65128
* Suppress constant initializer checking when the declaration isn't valid. Eli Friedman2009-02-201-2/+4
| | | | | | | | This prevents emitting diagnostics which are almost certainly useless. (Note that the test is checking that we emit only one diagnostic.) llvm-svn: 65101
* replace a dirty hack with a clean solution. Too bad we can't Chris Lattner2009-02-191-4/+12
| | | | | | use Blocks for our callbacks ;-) llvm-svn: 65083
* Fix a long standard problem with clang retaining "too much" sugar Chris Lattner2009-02-191-6/+29
| | | | | | | | | | | | | | | | | | | | | | | | | information about types. We often print diagnostics where we say "foo_t" is bad, but the user doesn't know how foo_t is declared (because it is a typedef). Fix this by expanding sugar when present in a diagnostic (and not one of a few special cases, like vectors). Before: t.m:5:2: error: invalid operands to binary expression ('typeof(P)' and 'typeof(F)') MAX(P, F); ^~~~~~~~~ t.m:1:78: note: instantiated from: #define MAX(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; }) ^ After: t.m:5:2: error: invalid operands to binary expression ('typeof(P)' (aka 'struct mystruct') and 'typeof(F)' (aka 'float')) MAX(P, F); ^~~~~~~~~ t.m:1:78: note: instantiated from: #define MAX(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; }) ^ llvm-svn: 65081
* GetTypeForDeclarator can return null on error now, handle this.Chris Lattner2009-02-191-1/+4
| | | | llvm-svn: 65076
* Add enough checking to ensure that non-constant block literals don'tMike Stump2009-02-192-2/+7
| | | | | | | appear to be constant. I'll probably redo this and throw it all away later once we have codegen for BlockDeclRefExprs. llvm-svn: 65070
* Arguments to unordered comparison builtins may need implicit casts.Daniel Dunbar2009-02-191-0/+6
| | | | | | - <rdar://problem/6094103> sema fails to promote type arguments to __builtin_isgreater (and friends) llvm-svn: 65059
* Add sema support for the noinline attribute.Anders Carlsson2009-02-191-1/+24
| | | | llvm-svn: 65055
* Emit the correct diagnostics when we constant fold an array size to a ↵Anders Carlsson2009-02-191-3/+13
| | | | | | negative value. llvm-svn: 65023
OpenPOWER on IntegriCloud