summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/ParseAST.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Another step in the process of making the parser depend on Sema:John McCall2010-08-201-113/+0
| | | | | | | | | - move DeclSpec &c into the Sema library - move ParseAST into the Parse library Reflect this change in a thousand different includes. Reflect this change in the link orders. llvm-svn: 111667
* Add a ParseAST overload that takes a Sema object, so that the callerDouglas Gregor2010-08-121-35/+23
| | | | | | | | | can create (and hold on to) the Sema object. Also, move Sema-related initialization/finalization with its various consumers and external sources into the Sema constructor and destructor, rather than placing it in ParseAST. llvm-svn: 110973
* Fixing the build isn't good enough; back out r110956 and r110953.John McCall2010-08-121-25/+39
| | | | llvm-svn: 110958
* dgregor should write code that compiles.John McCall2010-08-121-4/+6
| | | | llvm-svn: 110956
* Add a ParseAST overload that takes a Sema object, so that the callerDouglas Gregor2010-08-121-36/+20
| | | | | | | | | can create (and hold on to) the Sema object. Also, move Sema-related initialization/finalization with its various consumers and external sources into the Sema constructor and destructor, rather than placing it in ParseAST. llvm-svn: 110952
* Move Sema's headers into include/clang/Sema, renaming a few along the way.Douglas Gregor2010-08-121-1/+1
| | | | llvm-svn: 110945
* atch for implementation of objective-c's -WselectorFariborz Jahanian2010-07-221-1/+1
| | | | | | | warning flag in clang. Little more to do for a PCH issue. Radar 6507158. llvm-svn: 109129
* push some source location information down through the compiler,Chris Lattner2010-04-201-2/+1
| | | | | | | | into ContentCache::getBuffer. This allows it to produce diagnostics on the broken #include line instead of without a location. llvm-svn: 101939
* Fronted: Kill overly specialized RecordLayoutDumper, just make ↵Daniel Dunbar2010-04-081-0/+24
| | | | | | -dump-record-layouts a bit that Sema honors. llvm-svn: 100747
* Entering the main source file in the preprocessor can fail if theDouglas Gregor2010-03-171-1/+2
| | | | | | source file has been changed. Handle that failure more gracefully. llvm-svn: 98727
* Add {ExternalSemaSource,SemaConsumer}::ForgetSema callback, and update PCHReaderDaniel Dunbar2009-12-011-1/+8
| | | | | | to use it so it at least won't try to access Sema once it is gone. llvm-svn: 90261
* Don't call Decl::CollectingStats(false) and Stmt::CollectingStats(false). ↵Kovarththanan Rajaratnam2009-11-291-3/+0
| | | | | | When called with false these functions return whether statistics are enabled. They don't change any state. Since we're not using the return value avoid calling them in the first place. llvm-svn: 90077
* Fixes a typo, reported by Doug.Fariborz Jahanian2009-11-171-1/+1
| | | | llvm-svn: 89107
* Silence some warnings produced by Clang, and add a missing headerDouglas Gregor2009-11-171-1/+1
| | | | llvm-svn: 89051
* Handle case of missing '@end' in implementation contextFariborz Jahanian2009-11-161-0/+3
| | | | | | | | gracefully, on par with gcc, by: Issuing a warning, doing final sematinc check of its definitions and generating its meta-data. llvm-svn: 88934
* Rework Sema code completion interface.Daniel Dunbar2009-11-131-12/+2
| | | | | | | | | | | | | - Provide Sema in callbacks, instead of requiring it in constructor. This eliminates the need for a factory function. Clients now just pass the object to consume the results in directly. - CodeCompleteConsumer is cheap to construct, so building it whenever we are doing code completion is reasonable. Doug, please review. llvm-svn: 87099
* Spell function pointer correctly.Daniel Dunbar2009-09-221-1/+1
| | | | llvm-svn: 82543
* Refactor and simplify the CodeCompleteConsumer, so that all of theDouglas Gregor2009-09-211-1/+3
| | | | | | | real work is performed within Sema. Addresses Chris's comments, but still retains the heavyweight list-of-multimaps data structure. llvm-svn: 82459
* Initial implementation of a code-completion interface in Clang. InDouglas Gregor2009-09-171-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | essence, code completion is triggered by a magic "code completion" token produced by the lexer [*], which the parser recognizes at certain points in the grammar. The parser then calls into the Action object with the appropriate CodeCompletionXXX action. Sema implements the CodeCompletionXXX callbacks by performing minimal translation, then forwarding them to a CodeCompletionConsumer subclass, which uses the results of semantic analysis to provide code-completion results. At present, only a single, "printing" code completion consumer is available, for regression testing and debugging. However, the design is meant to permit other code-completion consumers. This initial commit contains two code-completion actions: one for member access, e.g., "x." or "p->", and one for nested-name-specifiers, e.g., "std::". More code-completion actions will follow, along with improved gathering of code-completion results for the various contexts. [*] In the current -code-completion-dump testing/debugging mode, the file is truncated at the completion point and EOF is translated into "code completion". llvm-svn: 82166
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-7/+7
| | | | llvm-svn: 81346
* Fix build of clang with gcc-4.4: #include <cstdio> was missing.Torok Edwin2009-08-241-0/+2
| | | | llvm-svn: 79916
* PR3679 - enable #pragma weak aliasing.Ryan Flynn2009-07-311-0/+6
| | | | llvm-svn: 77660
* Remove an unneeded header.Mike Stump2009-07-221-1/+0
| | | | llvm-svn: 76716
* Lazy deserialization of the declaration chains associated withDouglas Gregor2009-04-211-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Introduce the notion of a SemaConsumer, which is an ASTConsumer thatDouglas Gregor2009-04-201-0/+4
| | | | | | | | | also gets access to the Sema object performing semantic analysis. This will be used by the PCH writer to serialize Sema state. No functionality change. llvm-svn: 69595
* rearrange #include order.Chris Lattner2009-04-191-2/+2
| | | | llvm-svn: 69511
* When building a PCH file, don't perform end-of-translation-unitDouglas Gregor2009-04-141-2/+3
| | | | | | | | | wrap-up (e.g., turning tentative definitions into definitions). Also, very that, when we actually use the PCH file, we get the ride code generation for tentative definitions and definitions that show up in the PCH file. llvm-svn: 69043
* When writing a PCH file, keep track of all of the non-static,Douglas Gregor2009-04-141-0/+4
| | | | | | | | | non-inline external definitions (and tentative definitions) that are found at the top level. The corresponding declarations are stored in a record in the PCH file, so that they can be provided to the ASTConsumer (via HandleTopLevelDecl) when the PCH file is read. llvm-svn: 69005
* Push DeclGroup much farther throughout the compiler. Now the variousChris Lattner2009-03-291-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | productions (except the already broken ObjC cases like @class X,Y;) in the parser that can produce more than one Decl return a DeclGroup instead of a Decl, etc. This allows elimination of the Decl::NextDeclarator field, and exposes various clients that should look at all decls in a group, but which were only looking at one (such as the dumper, printer, etc). These have been fixed. Still TODO: 1) there are some FIXME's in the code about potentially using DeclGroup for better location info. 2) ParseObjCAtDirectives should return a DeclGroup due to @class etc. 3) I'm not sure what is going on with StmtIterator.cpp, or if it can be radically simplified now. 4) I put a truly horrible hack in ParseTemplate.cpp. I plan to bring up #3/4 on the mailing list, but don't plan to tackle #1/2 in the short term. llvm-svn: 68002
* Introduce a new OpaquePtr<N> struct type, which is a simple POD wrapper for aChris Lattner2009-03-281-2/+2
| | | | | | | | | | | | | | | | | | | | pointer. Its purpose in life is to be a glorified void*, but which does not implicitly convert to void* or other OpaquePtr's with a different UID. Introduce Action::DeclPtrTy which is a typedef for OpaquePtr<0>. Change the entire parser/sema interface to use DeclPtrTy instead of DeclTy*. This makes the C++ compiler enforce that these aren't convertible to other opaque types. We should also convert ExprTy, StmtTy, TypeTy, AttrTy, BaseTy, etc, but I don't plan to do that in the short term. The one outstanding known problem with this patch is that we lose the bitmangling optimization where ActionResult<DeclPtrTy> doesn't know how to bitmangle the success bit into the low bit of DeclPtrTy. I will rectify this with a subsequent patch. llvm-svn: 67952
* push more ASTContext goodness out through interfaces that useChris Lattner2009-03-281-1/+0
| | | | | | TranslationUnit llvm-svn: 67913
* remove TranslationUnit from ParseAST.Chris Lattner2009-03-281-6/+7
| | | | llvm-svn: 67911
* change HandleTranslationUnit to take an ASTContext instead of TranslationUnitChris Lattner2009-03-281-1/+1
| | | | llvm-svn: 67910
* eliminate ASTConsumer::InitializeTU, all clients areChris Lattner2009-03-281-1/+1
| | | | | | happy with just ASTContext, they don't need a TU. llvm-svn: 67894
* simplify ParseAST by sucking -disable-free handling logic up intoChris Lattner2009-03-281-22/+6
| | | | | | clang.cpp llvm-svn: 67890
* Patch by Alexei Svitkine: Refactor Sema::ParseAST API to allow clients to ↵Ted Kremenek2009-01-281-18/+22
| | | | | | pass as an argument a TranslationUnit object whose contents live beyond the call to ParseAST. llvm-svn: 63175
* Finish making AST BumpPtrAllocation runtime configurable (based on ↵Steve Naroff2009-01-271-1/+2
| | | | | | | | | | | -disable-free). snaroff% time ../../Release-Asserts/bin/clang INPUTS/Cocoa_h.m 0.179u 0.051s 0:00.23 95.6% 0+0k 0+0io 0pf+0w snaroff% time ../../Release-Asserts/bin/clang INPUTS/Cocoa_h.m -disable-free 0.169u 0.052s 0:00.22 95.4% 0+0k 0+0io 0pf+0w llvm-svn: 63153
* Remove the TopLevelDecls from TranslationUnit, since all of those decls are ↵Douglas Gregor2009-01-201-1/+0
| | | | | | owned by the ASTContext's TranslationUnitDecl. There are definitely some leaking Decls now that I'll tackle tomorrow llvm-svn: 62568
* Comment fix, ParseAST does not take ownership of the consumer.Daniel Dunbar2008-10-271-2/+1
| | | | llvm-svn: 58281
* Add --disable-free flag to clang.Daniel Dunbar2008-10-161-11/+20
| | | | | | | | - Disables the freeing of the ASTContext and the TranslationUnit after parsing & sema. - Primarily for timing the impact on -fsyntax-only timings. llvm-svn: 57643
* Re-enable deletion of AST nodes upon completion of ParseAST.Ted Kremenek2008-08-201-3/+0
| | | | llvm-svn: 55038
* More #include cleaningDaniel Dunbar2008-08-111-3/+0
| | | | | | | | | | | - Kill unnecessary #includes in .cpp files. This is an automatic sweep so some things removed are actually used, but happen to be included by a previous header. I tried to get rid of the obvious examples and this was the easiest way to trim the #includes in one fell swoop. - We now return to regularly scheduled development. llvm-svn: 54632
* More #include cleaningDaniel Dunbar2008-08-111-0/+2
| | | | | | | | - Drop Expr.h,RecordLayout.h from ASTContext.h (for DeclBase.h and SourceLocation.h) - Move ASTContext constructor into implementation llvm-svn: 54627
* ParseAST now never releases the passed ASTConsumer. This is the ↵Ted Kremenek2008-08-081-4/+1
| | | | | | | | | | | responsibility of the client. The motivation is that clients may either: (a) query the ASTConsumer object after AST parsing to collect data/etc. (b) reuse the ASTConsumer. llvm-svn: 54502
* ParseAST now conditionally deletes the passed ASTConsumer.Ted Kremenek2008-08-071-2/+3
| | | | | | | | | | ModuleBuilder now performs llvmgen in HandleTranslationUnit. This patch follows from the discussion on the following thread on cfe-commits: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080804/006849.html llvm-svn: 54486
* Added method "HandleTranslationUnit" to ASTConsumer. This is called by ↵Ted Kremenek2008-07-021-0/+2
| | | | | | ParseAST when all of the ASTs in a translation unit have been built. llvm-svn: 53042
* Introduce preliminary support for NSString format-string checking.Ted Kremenek2008-06-161-0/+2
| | | | | | Patch by Nikita Zhuk! llvm-svn: 52336
* Moved LangOptions from TranslationUnit to ASTContext. This induced a ↵Ted Kremenek2008-06-041-2/+3
| | | | | | variety of cleanups in some ASTConsumers. llvm-svn: 51943
* Added "InitializeTU" to ASTConsumer. This is used by Sema::ParseAST to pass aTed Kremenek2008-05-311-1/+1
| | | | | | | | | | | TranslationUnit object instead of an ASTContext. By default it calls Initialize(ASTConstext& Context) (to match with the current interface used by most ASTConsumers). Modified the ObjC-Rewriter to use InitializeTU, and to tell the TranslationUnit to not free its Decls. This is a workaround for: <rdar://problem/5966749> llvm-svn: 51825
* Stop leaking the main Sema object. (Leak found using valgrind.)Eli Friedman2008-05-271-2/+3
| | | | llvm-svn: 51580
OpenPOWER on IntegriCloud