summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* split ObjC and C++ Statements out into their own headers.Chris Lattner2009-04-262-1/+3
| | | | llvm-svn: 70105
* Correct the order of the parameters to CheckAssignmentConstraints in Eli Friedman2009-04-261-1/+1
| | | | | | | cleanup attribute checking. The difference isn't normally visible, but it can make a difference... llvm-svn: 70104
* Fix for PR4074: allow subscripting non-lvalue arrays in C90 mode.Eli Friedman2009-04-251-2/+24
| | | | | | | I wasn't originally going to use this approach, but cases like test/Sema/expr-comma.c make things difficult. llvm-svn: 70096
* minor diagnostics improvements.Chris Lattner2009-04-251-5/+5
| | | | llvm-svn: 70092
* Make VerifyIntegerConstantExpr print extension warnings for non-ICEs.Eli Friedman2009-04-251-7/+12
| | | | | | | Overall, I'm not particularly happy with the current situation regarding constant expression diagnostics, but I plan to improve it at some point. llvm-svn: 70089
* fix PR4073 by making designated initializer checking code useChris Lattner2009-04-252-30/+17
| | | | | | | | | | | | | | VerifyIntegerConstantExpression instead of isIntegerConstantExpr. This makes it ext-warn but tolerate things that fold to a constant but that are not valid i-c-e's. There must be a bug in the i-c-e computation though, because it doesn't catch this case even with pedantic. This also switches the later code to use EvaluateAsInt which is simpler and handles everything that evaluate does. llvm-svn: 70081
* remove a fixme that is already done.Chris Lattner2009-04-251-5/+1
| | | | llvm-svn: 70064
* improve a diagnostic to make more sense.Chris Lattner2009-04-251-1/+1
| | | | llvm-svn: 70062
* accept an ignore the no_instrument_function attribute. Since we don'tChris Lattner2009-04-251-0/+1
| | | | | | support -pg, we never instrument :) llvm-svn: 70061
* 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-253-28/+9
| | | | | | | | | | | | | | | | | | | | | | | | | 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-253-35/+28
| | | | llvm-svn: 70022
* various "is invalid" cleanups for C++ ctors/dtors.Chris Lattner2009-04-253-55/+54
| | | | llvm-svn: 70021
* This is a pretty big cleanup for how invalid decl/type are handle.Chris Lattner2009-04-256-172/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add new checker-specific attribute 'objc_ownership_retain'. This isn't hooked upTed Kremenek2009-04-251-0/+14
| | | | | | | | to the checker yet, but essentially it allows a user to specify that an Objective-C method or C function increments the reference count of a passed object. llvm-svn: 70005
* reject explicit pointer arithmetic on interface pointers in 64-bit objc ABIChris Lattner2009-04-241-7/+22
| | | | llvm-svn: 70004
* Add new checker-specific attribute 'objc_ownership_returns'. This isn't hookedTed Kremenek2009-04-241-0/+21
| | | | | | | up to the checker yet, but essentially it allows a user to specify that an Objective-C method or C function returns an owned an Objective-C object. llvm-svn: 70001
* fix the sizeof error recovery issue (sizeof-interface.m:attributeRuns)Chris Lattner2009-04-242-7/+13
| | | | | | | | 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
* Fix a pasto in the lookup of instance methods in the global poolDouglas Gregor2009-04-241-2/+2
| | | | llvm-svn: 69996
* PCH support for the global method pool (= instance and factory methodDouglas Gregor2009-04-244-24/+112
| | | | | | | | pools, combined). The methods in the global method pool are lazily loaded from an on-disk hash table when Sema looks into its version of the hash tables. llvm-svn: 69989
* Avoid issuing spurious errors as side-effect of diagnosingFariborz Jahanian2009-04-241-2/+2
| | | | | | application of sizeof on an interface. llvm-svn: 69980
* Add an ASTContext parameter to CXXTemporaryObjectExpr.Anders Carlsson2009-04-241-2/+4
| | | | llvm-svn: 69959
* Add a VarDecl parameter to the CXXTemporaryObjectExpr constructor. It's ↵Anders Carlsson2009-04-241-2/+7
| | | | | | unused for now, so no functionality change yet. Also, create CXXTempVarDecls to pass to the CXXTemporaryObjectExpr ctor. llvm-svn: 69957
* Create a CXXConstructExpr instead of a CXXTemporaryObjectExpr in ↵Anders Carlsson2009-04-242-7/+4
| | | | | | InitializeVarWithConstructor. llvm-svn: 69956
* Eliminate Sema::ObjCAliasDecls. This is based on Steve's fix, but alsoDouglas Gregor2009-04-244-25/+29
| | | | | | | updates name lookup so that we see through @compatibility_alias declarations to their underlying interfaces. llvm-svn: 69950
* Fix Objective-C crashesDouglas Gregor2009-04-241-3/+0
| | | | llvm-svn: 69945
* Fix rdar://6821047 - clang crashes on subscript of interface in 64-bit modeChris Lattner2009-04-242-23/+26
| | | | | | | | | | | | | | Several changes here: 1. We change Type::isIncompleteType to realize that forward declared interfaces are incomplete. This eliminate special case code for this from the sizeof path, and starts us rejecting P[4] when P is a pointer to an incomplete interface. 2. Explicitly reject P[4] when P points to an interface in non-fragile ABI mode. 3. Switch the sizeof(interface) diagnostic back to an error instead of a warning in non-fragile abi mode. llvm-svn: 69943
* Eliminate Sema::ObjCInterfaceDeclsDouglas Gregor2009-04-243-20/+2
| | | | llvm-svn: 69942
* Eliminate Sema::ObjCImplementations, relying instead on name lookup. What's ↵Douglas Gregor2009-04-245-28/+59
| | | | | | | | | | | good for uniformity is good for PCH (or is it the other way around?). As part of this, make ObjCImplDecl inherit from NamedDecl (since ObjCImplementationDecls now need to have names so that they can be found). This brings ObjCImplDecl very, very close to ObjCContainerDecl; we may be able to merge them soon. llvm-svn: 69941
* Eliminate Sema::ObjCProtocols. Instead, we place ObjCProtocolDecls inDouglas Gregor2009-04-234-20/+31
| | | | | | | | | | | | their own namespace (IDNS_Protocol) and use the normal name-lookup routines to find them. Aside from the simplification this provides (one less DenseMap!), it means that protocols will be lazily deserialized from PCH files. Make the code size of the selector table block match the code size of the type and decl blocks. llvm-svn: 69939
* PCH support for all of the predefined Objective-C types, such as id,Douglas Gregor2009-04-232-39/+47
| | | | | | | | SEL, Class, Protocol, CFConstantString, and __objcFastEnumerationState. With this, we can now run the Objective-C methods and properties PCH tests. llvm-svn: 69932
* Diagnose if an implementation implements a forward classFariborz Jahanian2009-04-231-1/+3
| | | | | | declaration (and avoid issuing bogus error later on). llvm-svn: 69928
* Fix handling of C99 "extern inline" semantics when dealing withDouglas Gregor2009-04-232-2/+59
| | | | | | | multiple declarations of the function. Should fix PR3989 and <rdar://problem/6818429>. llvm-svn: 69905
* Remove @compatibility_alias regression.Steve Naroff2009-04-231-1/+2
| | | | llvm-svn: 69899
* More PushOnScopeChain() FIXME's.Steve Naroff2009-04-231-4/+2
| | | | llvm-svn: 69894
* Sema::ActOnStartClassInterface(): Use PushOnScopeChains().Steve Naroff2009-04-231-2/+1
| | | | | | This enables class recognition to work with PCH. I believe this means we can remove Sema::ObjCInterfaceDecls and it's usage within Sema::LookupName(). Will investigate. llvm-svn: 69891
* 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 the three SmallVectors in ObjCImplDecl (for instanceDouglas Gregor2009-04-233-37/+40
| | | | | | | | | | | methods, class methods, and property implementations) and instead place all of these entities into the DeclContext. This eliminates more linear walks when looking for class or instance methods and should make PCH (de-)serialization of ObjCDecls trivial (and lazy). llvm-svn: 69849
* Eliminate Sema::KnownFunctionIDs, so that Sema doesn't end up pullingDouglas Gregor2009-04-223-42/+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
* ObjCQualifiedClass is dead, remove it.Chris Lattner2009-04-221-8/+0
| | | | llvm-svn: 69783
* change implicit int warnings to point to the identifier, not the Chris Lattner2009-04-222-18/+34
| | | | | | | | | | | | start of the declspec. The fixit still goes there, and we underline the declspec. This helps when the start of the declspec came from a macro that expanded from a system header. For example, we now produce: t.c:2:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] static x; ~~~~~~ ^ llvm-svn: 69777
* Fix some mishandling of the attr(gnu_inline) mode when used withChris Lattner2009-04-221-5/+0
| | | | | | | | | | extern. Previously we would warn about it and ignore the attribute. This is incorrect, it should be handled as a c89 "extern inline" function. Many thanks to Matthieu Castet for pointing this out and beating me over the head until I got it. PR3988: extern inline function are not externally visible llvm-svn: 69756
* Tighten up blocks type checking. This was discussed back in theMike Stump2009-04-211-1/+1
| | | | | | r56595 timeframe, but left undone. Radar 6812711 llvm-svn: 69745
* Fix rdar://6814047, a crash on invalid in blocks code I noticed whenChris Lattner2009-04-211-1/+1
| | | | | | working on the previous fix. llvm-svn: 69742
* fix marking of nested blocks with the "hasBlockDeclRefExprs" toChris Lattner2009-04-211-12/+24
| | | | | | | | mark exactly the blocks which have references that are "live through". This fixes a rejects valid: rdar://6808730 - [sema] [blocks] block rejected at global scope llvm-svn: 69738
* Lazy deserialization of the declaration chains associated withDouglas Gregor2009-04-214-13/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | identifiers from a precompiled header. This patch changes the primary name lookup method for entities within a precompiled header. Previously, we would load all of the names of declarations at translation unit scope into a large DenseMap (inside the TranslationUnitDecl's DeclContext), and then perform a special "last resort" lookup into this DeclContext when we knew there was a PCH file (see Sema::LookupName). Now, when we see an identifier named for the first time, we load all of the declarations with that name that are visible from the translation unit into the IdentifierInfo's chain of declarations. Thus, the explicit "look into the translation unit's DeclContext" code is gone, and Sema effectively uses the same IdentifierInfo-based name lookup mechanism whether we are using a PCH file or not. This approach should help PCH scale with the size of the input program rather than the size of the PCH file. The "Hello, World!" application with Carbon.h as a PCH file now loads 20% of the identifiers in the PCH file rather than 85% of the identifiers. 90% of the 20% of identifiers loaded are actually loaded when we deserialize the preprocessor state. The next step is to make the preprocessor load macros lazily, which should drastically reduce the number of types, declarations, and identifiers loaded for "Hello, World". llvm-svn: 69737
OpenPOWER on IntegriCloud