summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Call ActOnStartOfFunctionDecl/ActOnFinishFunctionBody whenDouglas Gregor2009-05-151-4/+11
| | | | | | instantiating the definition of a function from a template. llvm-svn: 71869
* Check that the function being overridden is virtual.Anders Carlsson2009-05-141-2/+4
| | | | llvm-svn: 71802
* Improvements to the FunctionDecl getters/setters.Anders Carlsson2009-05-141-1/+1
| | | | llvm-svn: 71800
* In C++, warn when something previously declared as a "struct" is laterDouglas Gregor2009-05-141-1/+46
| | | | | | | declared as a "class", or vice-versa. This warning is under the control of -Wmismatched-tags, which is off by default. llvm-svn: 71773
* Add return type checking for overriding virtual functions. We currently ↵Anders Carlsson2009-05-141-4/+31
| | | | | | don't check covariance but that's next. llvm-svn: 71759
* Implement explicit instantiations of member classes of class templates, e.g.,Douglas Gregor2009-05-141-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | template<typename T> struct X { struct Inner; }; template struct X<int>::Inner; This change is larger than it looks because it also fixes some a problem with nested-name-specifiers and tags. We weren't requiring the DeclContext associated with the scope specifier of a tag to be complete. Therefore, when looking for something like "struct X<int>::Inner", we weren't instantiating X<int>. This, naturally, uncovered a problem with member pointers, where we were requiring the left-hand side of a member pointer access expression (e.g., x->*) to be a complete type. However, this is wrong: the semantics of this expression does not require a complete type (EDG agrees). Stuart vouched for me. Blame him. llvm-svn: 71756
* eli correctly points out that this code is dead, just rip it out forChris Lattner2009-05-131-7/+0
| | | | | | now until someone does it right llvm-svn: 71638
* Implement parsing for explicit instantiations of class templates, e.g.,Douglas Gregor2009-05-121-2/+5
| | | | | | | | | template class X<int>; This also cleans up the propagation of template information through declaration parsing, which is used to improve some diagnostics. llvm-svn: 71608
* improve the diagnostic for uses of the GCC "global variable in a register" ↵Chris Lattner2009-05-121-1/+7
| | | | | | | | extension. This implements rdar://6880449 - improve diagnostic for usage of "global register variable" GCC extension llvm-svn: 71599
* Method who have definitions in structs/classes are semantically inline.Chris Lattner2009-05-121-0/+7
| | | | | | | Per the FIXME, it might be interesting to track whether the inline keyword was also used on the method, but for now we don't do this. Testcase pending. llvm-svn: 71589
* Implement the notions of the "current instantiation" and "unknownDouglas Gregor2009-05-111-8/+7
| | | | | | | | | | | | | | | | | | specialization" within a C++ template, and permit name lookup into the current instantiation. For example, given: template<typename T, typename U> struct X { typedef T type; X* x1; // current instantiation X<T, U> *x2; // current instantiation X<U, T> *x3; // not current instantiation ::X<type, U> *x4; // current instantiation X<typename X<type, U>::type, U>: *x5; // current instantiation }; llvm-svn: 71471
* Implement the semantics of the injected-class-name within a classDouglas Gregor2009-05-101-2/+17
| | | | | | | | | | | | | | | | | | template. The injected-class-name is either a type or a template, depending on whether a '<' follows it. As a type, the injected-class-name's template argument list contains its template parameters in declaration order. As part of this, add logic for canonicalizing declarations, and be sure to canonicalize declarations used in template names and template arguments. A TagType is dependent if the declaration it references is dependent. I'm not happy about the rather complicated protocol needed to use ASTContext::getTemplateSpecializationType. llvm-svn: 71408
* Back out r70506 (exception spec in AST) again. We won't have exception specs ↵Sebastian Redl2009-05-061-1/+0
| | | | | | until we've had a lot more discussion. llvm-svn: 71125
* One can use "class" and "struct" interchangeably to refer to a classDouglas Gregor2009-05-031-1/+1
| | | | | | in C++. Fixes <rdar://problem/6815995>. llvm-svn: 70784
* Fix invalid error about duplicate declaration of padding bit field inDaniel Dunbar2009-05-031-6/+8
| | | | | | an interface. llvm-svn: 70652
* Add Sema checking for __block on vm declarations. Radar 6441502Mike Stump2009-05-011-0/+5
| | | | llvm-svn: 70601
* Replace a bunch of static_cast + release with takeAs.Anders Carlsson2009-05-011-2/+2
| | | | llvm-svn: 70566
* Finish a thought in CheckVariableDeclaration's comment. No functionality changeDouglas Gregor2009-05-011-2/+3
| | | | llvm-svn: 70544
* Rework the way we handle constructor decls to be less hacky and fix PR3948 ↵Anders Carlsson2009-04-301-0/+12
| | | | | | completely. llvm-svn: 70516
* Make a home for exception specs in the AST. Now Sema can hook them up.Sebastian Redl2009-04-301-0/+1
| | | | llvm-svn: 70506
* Sema checking for incorrect placement of __block. Radar 6441502Mike Stump2009-04-301-1/+9
| | | | llvm-svn: 70452
* Have the parser communicate the exception specification to the action.Sebastian Redl2009-04-291-2/+2
| | | | llvm-svn: 70389
* Fix PR4092 by improving error recovery in two ways:Chris Lattner2009-04-291-1/+1
| | | | | | | | | | | 1. In a struct field redefinition, don't mark the struct erroneous. The field is erroneous, but the struct is otherwise well formed. 2. Don't emit diagnostics about functions that are known to be broken already. Either fix is sufficient to silence the second diagnostic in the example, but the combination is better :) llvm-svn: 70371
* Improve compatibility with GCC regarding inline semantics in GNU89Douglas Gregor2009-04-281-40/+11
| | | | | | | | | | | mode and in the presence of __gnu_inline__ attributes. This should fix both PR3989 and PR4069. As part of this, we now keep track of all of the attributes attached to each declaration even after we've performed declaration merging. This fixes PR3264. llvm-svn: 70292
* Get rid of some useless uses of NoExtensions. The philosophy here is Eli Friedman2009-04-281-1/+0
| | | | | | | | | | | | that if we're going to print an extension warning anyway, there's no point to changing behavior based on NoExtensions: it will only make error recovery worse. Note that this doesn't cause any behavior change because NoExtensions isn't used by the current front-end. I'm still considering what to do about the remaining use of NoExtensions in IdentifierTable.cpp. llvm-svn: 70273
* Track down return statements in the handlers of a function-try-block of ↵Sebastian Redl2009-04-271-0/+5
| | | | | | constructors. Meh ... llvm-svn: 70256
* Change our silencing of C typedef redefinition handling to what we hadChris Lattner2009-04-271-1/+6
| | | | | | | | before r69391: typedef redefinition is an error by default, but if *either* the old or new definition are from a system header, we silence it. llvm-svn: 70177
* Implement function-try-blocks. However, there's a very subtle bug that I ↵Sebastian Redl2009-04-261-5/+9
| | | | | | can't track down. llvm-svn: 70155
* improve a diagnostic to make more sense.Chris Lattner2009-04-251-1/+1
| | | | llvm-svn: 70062
* with the fixes for better invalid decl/type propagation, this codeChris Lattner2009-04-251-21/+4
| | | | | | | is no longer needed: a function type and a function declarator are always known to line up. llvm-svn: 70060
* Change SemaType's "GetTypeForDeclarator" and "ConvertDeclSpecToType" to Chris Lattner2009-04-251-15/+0
| | | | | | | | | | | | | | | | | | | | | | | | | always return a non-null QualType + error bit. This fixes a bunch of cases that didn't check for null result (and could thus crash) and eliminates some crappy code scattered throughout sema. This also improves the diagnostics in the recursive struct case to eliminate a bogus second error. It also cleans up the case added to function.c by forming a proper function type even though the declarator is erroneous, allowing the parameter to be added to the function. Before: t.c:2:1: error: unknown type name 'unknown_type' unknown_type f(void*P) ^ t.c:4:3: error: use of undeclared identifier 'P' P+1; ^ After: t.c:2:1: error: unknown type name 'unknown_type' unknown_type f(void*P) ^ llvm-svn: 70023
* change a couple more c++ sema methods to be based on isinvalid bits.Chris Lattner2009-04-251-11/+8
| | | | llvm-svn: 70022
* various "is invalid" cleanups for C++ ctors/dtors.Chris Lattner2009-04-251-4/+2
| | | | llvm-svn: 70021
* This is a pretty big cleanup for how invalid decl/type are handle.Chris Lattner2009-04-251-136/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This gets rid of a bunch of random InvalidDecl bools in sema, changing us to use the following approach: 1. When analyzing a declspec or declarator, if an error is found, we set a bit in Declarator saying that it is invalid. 2. Once the Decl is created by sema, we immediately set the isInvalid bit on it from what is in the declarator. From this point on, sema consistently looks at and sets the bit on the decl. This gives a very clear separation of concerns and simplifies a bunch of code. In addition to this, this patch makes these changes: 1. it renames DeclSpec::getInvalidType() -> isInvalidType(). 2. various "merge" functions no longer return bools: they just set the invalid bit on the dest decl if invalid. 3. The ActOnTypedefDeclarator/ActOnFunctionDeclarator/ActOnVariableDeclarator methods now set invalid on the decl returned instead of returning an invalid bit byref. 4. In SemaType, refering to a typedef that was invalid now propagates the bit into the resultant type. Stuff declared with the invalid typedef will now be marked invalid. 5. Various methods like CheckVariableDeclaration now return void and set the invalid bit on the decl they check. There are a few minor changes to tests with this, but the only major bad result is test/SemaCXX/constructor-recovery.cpp. I'll take a look at this next. llvm-svn: 70020
* fix PR4049, a crash on invalid, by making sema install the right number of Chris Lattner2009-04-251-11/+29
| | | | | | | | | | | | | | | | | | | | | parameters in a functiondecl, even if the decl is invalid and has a confusing Declarator. On the testcase, we now emit one beautiful diagnostic: t.c:2:1: error: unknown type name 'unknown_type' unknown_type f(void*) ^ GCC 4.0 produces: t.c:2: error: syntax error before ‘f’ t.c: In function ‘f’: t.c:2: error: parameter name omitted and GCC 4.2: t.c:2: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘f’ llvm-svn: 70016
* rename getNumParmVarDeclsFromType back to getNumParams(),Chris Lattner2009-04-251-15/+14
| | | | | | | | | remove a special case that was apparently for typeof() and generalize the code in SemaDecl that handles typedefs to handle any sugar type (including typedef, typeof, etc). Improve comment to make it more clear what is going on. llvm-svn: 70015
* in:Chris Lattner2009-04-251-10/+2
| | | | | | | | | | typedef void foo(void); We get a typedef for a functiontypeproto with no arguments, not one with one argument and type void. This means the code being removed in SemaDecl is dead. llvm-svn: 70013
* set NewFD->setInvalidDecl() in one place, sharing code and ensuring thatChris Lattner2009-04-251-15/+6
| | | | | | functions with prototypes get the bit. llvm-svn: 70011
* fix the sizeof error recovery issue (sizeof-interface.m:attributeRuns)Chris Lattner2009-04-241-1/+1
| | | | | | | | by correctly propagating the fact that the type was invalid up to the attributeRuns decl, then returning an ExprError when attributeRuns is formed (like we do for normal declrefexprs). llvm-svn: 69998
* Eliminate Sema::ObjCAliasDecls. This is based on Steve's fix, but alsoDouglas Gregor2009-04-241-0/+12
| | | | | | | updates name lookup so that we see through @compatibility_alias declarations to their underlying interfaces. llvm-svn: 69950
* PCH support for all of the predefined Objective-C types, such as id,Douglas Gregor2009-04-231-3/+3
| | | | | | | | SEL, Class, Protocol, CFConstantString, and __objcFastEnumerationState. With this, we can now run the Objective-C methods and properties PCH tests. llvm-svn: 69932
* Fix handling of C99 "extern inline" semantics when dealing withDouglas Gregor2009-04-231-1/+54
| | | | | | | multiple declarations of the function. Should fix PR3989 and <rdar://problem/6818429>. llvm-svn: 69905
* The ivars in an ObjCImplementationDecl are now stored in theDouglas Gregor2009-04-231-1/+6
| | | | | | | DeclContext rather than in a separate list. This makes PCH (de-)serialization trivial, so that ivars can be loaded lazily. llvm-svn: 69857
* Eliminate Sema::KnownFunctionIDs, so that Sema doesn't end up pullingDouglas Gregor2009-04-221-18/+2
| | | | | | | | | | | | | | in a bunch of declarations from the PCH file. We're down to loading very few declarations in Carbon-prefixed "Hello, World!": *** PCH Statistics: 6/20693 types read (0.028995%) 7/59230 declarations read (0.011818%) 50/44914 identifiers read (0.111324%) 0/32954 statements read (0.000000%) 5/6187 macros read (0.080815%) llvm-svn: 69825
* Explictly track tentative definitions within Sema, then hand thoseDouglas Gregor2009-04-211-0/+17
| | | | | | | | | | | | | | | tentative definitions off to the ASTConsumer at the end of the translation unit. Eliminate CodeGen's internal tracking of tentative definitions, and instead hook into ASTConsumer::CompleteTentativeDefinition. Also, tweak the definition-deferal logic for C++, where there are no tentative definitions. Fixes <rdar://problem/6808352>, and will make it much easier for precompiled headers to cope with tentative definitions in the future. llvm-svn: 69681
* clean up anonymous bitfield diagnostics, PR4017Chris Lattner2009-04-201-9/+21
| | | | llvm-svn: 69608
* Print an error for uses of __thread on targets which don't support it.Eli Friedman2009-04-191-0/+2
| | | | llvm-svn: 69553
* Add more thorough/correct checking for invalid __thread specifiers.Eli Friedman2009-04-191-7/+29
| | | | llvm-svn: 69542
* add a new Sema::CurFunctionNeedsScopeChecking bool that is used to avoid Chris Lattner2009-04-191-9/+17
| | | | | | | calling into the jump checker when a function or method is known to contain no VLAs or @try blocks. llvm-svn: 69509
* move jump scope checking and related code out into its own file, SemaDecl.cpp isChris Lattner2009-04-191-267/+1
| | | | | | already too large. llvm-svn: 69505
OpenPOWER on IntegriCloud