summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* Prevent a segfault for vaarg expressions on unsupported architectures.Sebastian Redl2009-01-091-2/+4
| | | | llvm-svn: 62008
* This patch removes mergeProperties and does the property lookupFariborz Jahanian2009-01-092-36/+12
| | | | | | in designated protocols lazily. llvm-svn: 62007
* Implement EmitUnsupportedRValue to generate an appropriately typed RValue.Daniel Dunbar2009-01-091-3/+13
| | | | llvm-svn: 62004
* Very basic support for pure virtual functions.Sebastian Redl2009-01-091-4/+27
| | | | llvm-svn: 62003
* Replace DeclContext's vector of ScopedDecl pointers with a linked listDouglas Gregor2009-01-094-10/+25
| | | | | | | | | | | | | | | | | | of ScopedDecls (using the new ScopedDecl::NextDeclInScope pointer). Performance-wise: - It's a net win in memory utilization, since DeclContext is now one pointer smaller than it used to be (std::vectors are typically 3 pointers; we now use 2 pointers) and - Parsing Cocoa.h with -fsyntax-only (with a Release-Asserts Clang) is about 1.9% faster than before, most likely because we no longer have the memory allocations and copying associated with the std::vector. I'll re-enable serialization of DeclContexts once I've sorted out the NextDeclarator/NextDeclInScope question. llvm-svn: 62001
* Make sure that ScopedDecls passed to DeclContext::addDecl are added into ↵Douglas Gregor2009-01-093-1/+16
| | | | | | their lexical context llvm-svn: 61998
* Provide a new kind of iterator, the specific_decl_iterator, thatDouglas Gregor2009-01-0910-18/+18
| | | | | | | | | filters the decls seen by decl_iterator with two criteria: the dynamic type of the declaration and a run-time predicate described by a member function. This simplifies EnumDecl, RecordDecl, and ObjCContainerDecl considerably. It has no measurable performance impact. llvm-svn: 61994
* Emit more refined "unsupported" error for block expressions.Daniel Dunbar2009-01-091-0/+5
| | | | llvm-svn: 61993
* Give "unsupported" error on calls through block pointers instead ofDaniel Dunbar2009-01-092-6/+28
| | | | | | crashes. llvm-svn: 61992
* Move property API's up to ObjCContainerDecl (removing a lot of duplicate code).Steve Naroff2009-01-095-154/+65
| | | | | | | | | Add isa/cast/dyncast support for ObjCContainerDecl. Renamed classprop_iterator/begin/end to prop_iterator/begin/end (the class prefix was confusing). More simplifications to Sema::ActOnAtEnd()... Added/changed some FIXME's as a result of the above work. llvm-svn: 61988
* Fix rdar://6480479 - [parser] infinite loop on invalid inputChris Lattner2009-01-091-0/+6
| | | | llvm-svn: 61975
* Convert block types in IRgen. This is not the correct type, butDaniel Dunbar2009-01-091-1/+3
| | | | | | matches llvm-gcc (?). llvm-svn: 61974
* Block pointer types are not aggregate types.Daniel Dunbar2009-01-091-1/+4
| | | | llvm-svn: 61973
* Fix crash on null deference when searching for readwrite properties inDaniel Dunbar2009-01-091-13/+15
| | | | | | | categories. - Also, simplify nesting via early return. llvm-svn: 61968
* Addressed the issue in <rdar://problem/6479085>, where we failed toDouglas Gregor2009-01-093-40/+71
| | | | | | | | | | | | | | | rewrite @class declarations that showed up within linkage specifications because those @class declarations never made it any place where the rewriter could find them. Moved all of the ObjC*Decl nodes over to ScopedDecls, so that they can live in the appropriate top-level or transparent DeclContext near the top level, e.g., TranslationUnitDecl or LinkageSpecDecl. Objective-C declarations now show up in a traversal of the declarations in a DeclContext (they didn't before!). This way, the rewriter finds all Objective-C declarations within linkage specifications. llvm-svn: 61966
* Adding support for ObjC methods which have c-styleFariborz Jahanian2009-01-093-4/+8
| | | | | | parameter list. This is work in progress. llvm-svn: 61964
* Invert assertion condition.Ted Kremenek2009-01-091-1/+1
| | | | llvm-svn: 61961
* Add mm_malloc.h, patch by Sam Weinig.Anders Carlsson2009-01-081-0/+59
| | | | llvm-svn: 61954
* Revert my previous, failed attempt to pretty-print anonymous struct/union ↵Douglas Gregor2009-01-083-9/+5
| | | | | | accesses well. Added a FIXME so we know to revisit this later llvm-svn: 61951
* Fix ObjCInterfaceDecl::Destroy and ObjCProtocolDecl::Destroy to iterate and ↵Ted Kremenek2009-01-081-10/+4
| | | | | | destroy all contained ObjCMethodDecls in one sweep. This fixes a use-after-free error found by valgrind. llvm-svn: 61943
* Remove double-insertion of EnumConstantDecls. Thanks to Zhongxing Xu for ↵Douglas Gregor2009-01-081-5/+0
| | | | | | pointing this out llvm-svn: 61942
* Unify the code for defining tags in C and C++, so that we alwaysDouglas Gregor2009-01-0810-124/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | introduce a Scope for the body of a tag. This reduces the number of semantic differences between C and C++ structs and unions, and will help with other features (e.g., anonymous unions) in C. Some important points: - Fields are now in the "member" namespace (IDNS_Member), to keep them separate from tags and ordinary names in C. See the new test in Sema/member-reference.c for an example of why this matters. In C++, ordinary and member name lookup will find members in both the ordinary and member namespace, so the difference between IDNS_Member and IDNS_Ordinary is erased by Sema::LookupDecl (but only in C++!). - We always introduce a Scope and push a DeclContext when we're defining a tag, in both C and C++. Previously, we had different actions and different Scope/CurContext behavior for enums, C structs/unions, and C++ structs/unions/classes. Now, it's one pair of actions. (Yay!) There's still some fuzziness in the handling of struct/union/enum definitions within other struct/union/enum definitions in C. We'll need to do some more cleanup to eliminate some reliance on CurContext before we can solve this issue for real. What we want is for something like this: struct X { struct T { int x; } t; }; to introduce T into translation unit scope (placing it at the appropriate point in the IdentifierResolver chain, too), but it should still have struct X as its lexical declaration context. PushOnScopeChains isn't smart enough to do that yet, though, so there's a FIXME test in nested-redef.c llvm-svn: 61940
* Move FIXME to a better location.Steve Naroff2009-01-081-5/+5
| | | | llvm-svn: 61937
* Removed ObjCContainerDecl::getPropertyMethods()...doesn't belong in the AST.Steve Naroff2009-01-082-73/+53
| | | | | | Moved logic to Sema::ProcessPropertyDecl(). llvm-svn: 61936
* Remove redundant method context (now that ObjCMethodDecl isa ScopedDecl).Steve Naroff2009-01-082-7/+8
| | | | | | | | Convert clients to use the standard getDeclContext() API. Doug, thanks for the review! llvm-svn: 61935
* This is a large/messy diff that unifies the ObjC AST's with DeclContext.Steve Naroff2009-01-0813-169/+136
| | | | | | | | | | | | | | | - ObjCContainerDecl's (ObjCInterfaceDecl/ObjCCategoryDecl/ObjCProtocolDecl), ObjCCategoryImpl, & ObjCImplementation are all DeclContexts. - ObjCMethodDecl is now a ScopedDecl (so it can play nicely with DeclContext). - ObjCContainerDecl now does iteration/lookup using DeclContext infrastructure (no more linear search:-) - Removed ASTContext argument to DeclContext::lookup(). It wasn't being used and complicated it's use from an ObjC AST perspective. - Added Sema::ProcessPropertyDecl() and removed Sema::diagnosePropertySetterGetterMismatch(). - Simplified Sema::ActOnAtEnd() considerably. Still more work to do. - Fixed an incorrect casting assumption in Sema::getCurFunctionOrMethodDecl(), now that ObjCMethodDecl is a ScopedDecl. - Removed addPropertyMethods from ObjCInterfaceDecl/ObjCCategoryDecl/ObjCProtocolDecl. This passes all the tests on my machine. Since many of the changes are central to the way ObjC finds it's methods, I expect some fallout (and there are still a handful of FIXME's). Nevertheless, this should be a step in the right direction. llvm-svn: 61929
* Add isSubRegionOf() method to SubRegion.Zhongxing Xu2009-01-081-0/+13
| | | | llvm-svn: 61924
* PTH: Hook up getSpelling() caching in PTHLexer. This results in a niceTed Kremenek2009-01-081-4/+62
| | | | | | | | | | | | | | | | | | | | performance gain. Here's what we see for -Eonly on Cocoa.h (using PTH): - wall time decreases by 21% (26% speedup overall) - system time decreases by 35% - user time decreases by 6% These reductions are due to not paging source files just to get spellings for literals. The solution in place doesn't appear to be 100% yet, as we still see some of the pages for source files getting mapped in. Using -print-stats, we see that SourceManager maps in 7179K less bytes of source text (reduction of 75%). Will investigate why the remaining 25% are getting paged in. With these changes, here's how PTH compares to non-PTH on Cocoa.h: -Eonly: PTH takes 64% of the time as non-PTH (54% speedup) -fsyntax-only: PTH takes 89% of the time as non-PTH (11% speedup) llvm-svn: 61913
* PTH:Ted Kremenek2009-01-082-7/+41
| | | | | | | | | | - Added stub PTHLexer::getSpelling() that will be used for fetching cached spellings from the PTH file. This doesn't do anything yet. - Added a hook in Preprocessor::getSpelling() to call PTHLexer::getSpelling() when using a PTHLexer. - Updated PTHLexer to read the offsets of spelling tables in the PTH file. llvm-svn: 61911
* Objc's compatibility-alias semantics and codeFariborz Jahanian2009-01-082-1/+10
| | | | | | gen issue fix. llvm-svn: 61901
* Update some doxygen comments to be more rich. Remove ↵Ted Kremenek2009-01-071-16/+16
| | | | | | StoreManager::GetRegionSVal. llvm-svn: 61894
* Refactor MemRegionManager instance variable into parent class. No ↵Ted Kremenek2009-01-072-8/+6
| | | | | | functionality change. llvm-svn: 61888
* Fix PR clang/3291Douglas Gregor2009-01-071-3/+3
| | | | llvm-svn: 61886
* Fix printing of member references to avoid displaying implicitly-generated ↵Douglas Gregor2009-01-073-2/+9
| | | | | | member references, e.g., for anonymous struct/unions or implicit 'this' in member functions llvm-svn: 61885
* Don't ICE when messaging on 'super' receiver when classFariborz Jahanian2009-01-071-3/+6
| | | | | | of category implementation is undeclared. Issue error instead. llvm-svn: 61882
* Another nasty code gen. bug with trivial fix. Calling classFariborz Jahanian2009-01-071-1/+3
| | | | | | | method on 'super' receiver in a category implementation. Other simpler cases were working by accident. llvm-svn: 61880
* Finished semantic analysis of anonymous unions in C++.Douglas Gregor2009-01-074-19/+108
| | | | | | | | | Duplicate-member checking within classes is still a little messy, and anonymous unions are still completely broken in C. We'll need to unify the handling of fields in C and C++ to make this code applicable in both languages. llvm-svn: 61878
* ObjC AST cleanups/simplifications (phase 1).Steve Naroff2009-01-071-49/+6
| | | | | | Add ObjCContainerDecl class and have ObjCInterfaceDecl/ObjCCategoryDecl/ObjCProtocolDecl inherit from it. llvm-svn: 61866
* Use DeclContext::getLookupContext wherever necessary to ensure that we look ↵Douglas Gregor2009-01-071-2/+3
| | | | | | through transparent contexts llvm-svn: 61861
* When determining whether a variable is a file-scoped variable, checkDouglas Gregor2009-01-071-2/+2
| | | | | | | out its lookup context (to see through linkage specifications). Addresses <rdar://problem/6477142>. llvm-svn: 61848
* Initial implementation of anonymous unions (and, as a GNU extension,Douglas Gregor2009-01-078-16/+362
| | | | | | | | | | | | structures and classes) in C++. Covers name lookup and the synthesis and member access for the unnamed objects/fields associated with anonymous unions. Some C++ semantic checks are still missing (anonymous unions can't have function members, static data members, etc.), and there is no support for anonymous structs or unions in C. llvm-svn: 61840
* This commit reflects changes to the retain/release checker motivated by myTed Kremenek2009-01-071-36/+42
| | | | | | | | | | | | | | | | | | | | | | | recent discussions with Thomas Clement and Ken Ferry concerning the "fundamental rule" for Cocoa memory management (http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html). Here is the revised behavior of the checker concerning tracking retain/release counts for objects returned from message expressions involving instance methods: 1) Track the returned object if the return type of the message expression is id<..>, id, or a pointer to *any* object that subclasses NSObject. Such objects are assumed to have a retain count. Previously the checker only tracked objects when the receiver of the message expression was part of the standard Cocoa API (i.e., had class names prefixed with 'NS'). This should significantly expand the amount of checking performed. 2) Consider the object owned if the selector of the message expression contains "alloc", "new", or "copy". Previously we also considered "create", but this doesn't follow from the fundamental rule (discussions with the Cocoa folks confirms this). llvm-svn: 61837
* Allow Objective-C entities to be declared within a transparent contextDouglas Gregor2009-01-064-8/+11
| | | | | | nested in the translation unit. This fixes <rdar://problem/6476070>. llvm-svn: 61832
* SourceManager: Implement "lazy" creation of MemBuffers for source files.Ted Kremenek2009-01-061-5/+22
| | | | | | | | | | | | | | | | | | | | | | | | - Big Idea: Source files are now mmaped when ContentCache::getBuffer() is first called. While this doesn't change the functionality when lexing regular source files, it can result in source files not being paged in when using PTH. - Performance change: - No observable difference (-fsyntax-only/-Eonly) on Cocoa.h when doing regular source lexing. - No observable time difference (-fsyntax-only/-Eonly) on Cocoa.h when using PTH. We do observe, however, a reduction of 279K in memory mapped source code (3% reduction). The majority of pages from Cocoa.h (and friends) are still being pulled in, however, because any literal will cause Preprocessor::getSpelling() to be called (causing the source for the file to get pulled in). The next possible optimization is to cache literal strings in the PTH file to avoid the need for the original header sources entirely. - Right now there is a preprocessor directive to toggle between "lazy" and "eager" creation of MemBuffers. This is not permanent, and is there in the short term to just test additional optimizations. llvm-svn: 61827
* Another tweak to handle the MS extensions (<rdar://problem/5956221>).Steve Naroff2009-01-062-0/+2
| | | | llvm-svn: 61821
* Add whitespace to silence the following warning in a Release build: warning: ↵Ted Kremenek2009-01-061-1/+1
| | | | | | suggest a space before ';' or explicit braces around empty body in 'while' statement llvm-svn: 61820
* Return UnknownVal in RegionStoreManager::getSizeInElements() for unsupported ↵Ted Kremenek2009-01-061-0/+1
| | | | | | regions. This silences a warning when compiling Release-Asserts builds. llvm-svn: 61818
* Couple of code gen. fixes in ObjC's colection-statement. HardFariborz Jahanian2009-01-061-1/+3
| | | | | | to track down, easy to fix. This is on going. llvm-svn: 61817
* Fix <rdar://problem/5956221> clang ObjC rewriter: Microsoft-specific ↵Steve Naroff2009-01-061-0/+6
| | | | | | | | __fastcall keyword unrecognized. This fix is C++ specific. llvm-svn: 61816
* - Various comment typo fixes in Sema.hChris Lattner2009-01-062-20/+18
| | | | | | | | | - Simplify ParseDeclCXX to use early exit on error instead of nesting. - Change ParseDeclCXX to using the 'skip on error' form of ExpectAndConsume. - If we don't see the ; in a using directive, still call the action, for hopefully better error recovery. llvm-svn: 61801
OpenPOWER on IntegriCloud