summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/Sema.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Implement basic support for template instantiation of pack expansionsDouglas Gregor2010-12-201-1/+2
| | | | | | | | | | | | | | | | | whose patterns are template arguments. We can now instantiate, e.g., typedef tuple<pair<OuterTypes, InnerTypes>...> type; where OuterTypes and InnerTypes are template type parameter packs. There is a horrible inefficiency in TemplateArgumentLoc::getPackExpansionPattern(), where we need to create copies of TypeLoc data because our interfaces traffic in TypeSourceInfo pointers where they should traffic in TypeLocs instead. I've isolated in efficiency in this one routine; once we refactor our interfaces to traffic in TypeLocs, we can eliminate it. llvm-svn: 122278
* Move the functionality to mark all vtables of key functions as used withinChandler Carruth2010-12-121-0/+12
| | | | | | | | | | | | | | a translation unit to the ActOnEndOfTranslationUnit function instead of doing it at the start of DefineUsedVTables. The latter is now called *recursively* during template instantiation, which causes an absolutely insane number of walks of every record decl in the translation unit. After this patch, an extremely template instantiation heavy test case's compile time drops by 10x, and we see between 15% and 20% improvement in average compile times across a project. This is just recovering a regression, it doesn't make anything faster than it was several weeks ago. llvm-svn: 121644
* Tie DefineVTablesUsed() in with recursive function instantiation so that we emitNick Lewycky2010-11-251-20/+18
| | | | | | | | | | a useful template instantiation stack. Fixes PR8640. This also causes a slight change to where the "instantianted from" note shows up in truly esoteric cases (see the change to test/SemaCXX/destructor.cpp), but that isn't directly the fault of this patch. llvm-svn: 120135
* Refactoring. Get FunctionScopeInfo to use DiagnosticErrorTrap.Argyrios Kyrtzidis2010-11-191-9/+7
| | | | llvm-svn: 119764
* Refactoring of Diagnostic class.Argyrios Kyrtzidis2010-11-181-6/+6
| | | | | | | | | | | -Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class. -DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units. -The rest of the state in Diagnostic object is considered related and tied to one translation unit. -Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a SourceLocation instead of a FullSourceLoc. -Reflect the changes to various interfaces. llvm-svn: 119730
* Fix a silly bug in the suppression of non-error diagnostics in aDouglas Gregor2010-10-131-0/+2
| | | | | | | SFINAE context, where we weren't getting the right diagnostic argument count. I blame DiagnosticBuilder's weirdness. Fixes PR8372. llvm-svn: 116411
* Introduce support for emitting diagnostics (warnings + their notes)Douglas Gregor2010-10-121-19/+36
| | | | | | | | | | | | | | | that are suppressed during template argument deduction. This change queues diagnostics computed during template argument deduction. Then, if the resulting function template specialization or partial specialization is chosen by overload resolution or partial ordering (respectively), we will emit the queued diagnostics at that point. This addresses most of PR6784. However, the check for unnamed/local template arguments (which existed before this change) is still only skin-deep, and needs to be extended to look deeper into types. It must be improved to finish PR6784. llvm-svn: 116373
* Move ExternalSemaSource::ReadMethodPool's implementation to Sema.cpp so that ↵Sebastian Redl2010-09-281-0/+6
| | | | | | the header can get away with forward declarations only for ObjCMethodList and Selector. Fixes <rdar://8467631>. llvm-svn: 114978
* Fix a few minor issues with parsing and semantic analysis of C++Douglas Gregor2010-09-081-1/+1
| | | | | | | | typeid expressions: - make sure we have a proper source location for the closing ')' - cache the declaration of std::type_info once we've found it llvm-svn: 113441
* Initialize the MSVCGuidDecl variable in the correct order.Bill Wendling2010-09-081-2/+3
| | | | llvm-svn: 113412
* Microsoft's __uuidof operator implementation part 1.Francois Pichet2010-09-081-1/+1
| | | | llvm-svn: 113356
* Devirtualize Sema, kill off DeleteExpr and DeleteStmt, and reformat.John McCall2010-09-031-5/+0
| | | | llvm-svn: 112945
* One who seeks knowledge learns something new every day.John McCall2010-08-261-0/+19
| | | | | | | | | One who seeks the Tao unlearns something new every day. Less and less remains until you arrive at non-action. When you arrive at non-action, nothing will be left undone. llvm-svn: 112244
* Restore r112114 now that SmallVector<...,0> is safe.John McCall2010-08-261-2/+2
| | | | llvm-svn: 112148
* Revert r112114, "Pull DelayedDiagnostic and AccessedEntity out into their ownDaniel Dunbar2010-08-261-2/+2
| | | | | | header.", it is teh broken. llvm-svn: 112123
* Pull DelayedDiagnostic and AccessedEntity out into their own header.John McCall2010-08-251-2/+2
| | | | | | | | This works courtesy of the new SmallVector<..., 0> specialization that doesn't require a complete type. Note that you'll need to pull at least SmallVector.h from LLVM to compile successfully. llvm-svn: 112114
* Split out a header to hold APIs meant for the Sema implementation from Sema.h.John McCall2010-08-251-0/+1
| | | | | | | Clients of Sema don't need to know (for example) the list of diagnostics we support. llvm-svn: 112093
* Initialize the translation-unit scope before lexing the firstDouglas Gregor2010-08-251-1/+1
| | | | | | | token. The first token might be something that ends up triggering code completion, which in turn requires a valid Scope. Test case forthcoming. llvm-svn: 112066
* GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall2010-08-251-1/+1
| | | | | | to the new constants. llvm-svn: 112047
* More incremental progress towards not including Expr.h in Sema.h.John McCall2010-08-251-10/+6
| | | | llvm-svn: 112044
* Rename *PendingImplicitInstantiations to *PendingInstantiations. NoChandler Carruth2010-08-251-1/+1
| | | | | | functionality changed. llvm-svn: 112040
* Split FunctionScopeInfo and BlockScopeInfo into their own header.John McCall2010-08-251-18/+22
| | | | llvm-svn: 112038
* Remove Sema.h's dependency on DeclCXX.h.John McCall2010-08-251-0/+1
| | | | llvm-svn: 112032
* Sema doesn't need these STL headers.John McCall2010-08-241-1/+1
| | | | llvm-svn: 111926
* More header elimination. The goal of all this is to allow Parser toJohn McCall2010-08-241-0/+2
| | | | | | | #include Sema.h while keeping all the AST declarations opaque. That may not be reasonably attainable, though. llvm-svn: 111907
* Rename PCHReader to ASTReader.Sebastian Redl2010-08-181-2/+2
| | | | llvm-svn: 111467
* Rename -Wunused-method -> -Wunused-member-function.Argyrios Kyrtzidis2010-08-171-1/+1
| | | | llvm-svn: 111305
* Introduce -Wunused-method option for warning on unused class methods in ↵Argyrios Kyrtzidis2010-08-171-1/+3
| | | | | | | | | anonymous namespace. This option is not part of the Unused diagnostic group until the warnings on llvm codebase are fixed and we are ready to turn it on. Suggestion by Daniel. llvm-svn: 111298
* Commit improved version of 111026 & 111027.Argyrios Kyrtzidis2010-08-151-9/+53
| | | | | | | | | | | | | | | | | | | | Unused warnings for functions: -static functions -functions in anonymous namespace -class methods in anonymous namespace -class method specializations in anonymous namespace -function specializations in anonymous namespace Unused warnings for variables: -static variables -variables in anonymous namespace -static data members in anonymous namespace -static data members specializations in anonymous namespace Reveals lots of opportunities for dead code removal in llvm codebase that will interest my esteemed colleagues. llvm-svn: 111086
* Implement caching of code-completion results for macro definitionsDouglas Gregor2010-08-131-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | when the CXTranslationUnit_CacheCompletionResults option is given to clang_parseTranslationUnit(). Essentially, we compute code-completion results for macro definitions after we have parsed the file, then store an ASTContext-agnostic version of those results (completion string, cursor kind, priority, and active contexts) in the ASTUnit. When performing code completion in that ASTUnit, we splice the macro definition results into the results provided by the actual code-completion (which has had macros turned off) before libclang gets those results. We use completion context information to only splice in those results that make sense for that context. With a completion involving all of the macros from Cocoa.h and a few other system libraries (totally ~8500 macro definitions) living in a precompiled header, we get about a 9% performance improvement from code completion, since we no longer have to deserialize all of the macro definitions from the precompiled header. Note that macro definitions are merely the canary; the cache is designed to also support other top-level declarations, which should be a bigger performance win. That optimization will be next. Note also that there is no mechanism for determining when to throw away the cache and recompute its contents. llvm-svn: 111051
* Revert 111026 & 111027, build breakage.Argyrios Kyrtzidis2010-08-131-53/+9
| | | | llvm-svn: 111036
* The unused warnings extravaganza continues. Warn for:Argyrios Kyrtzidis2010-08-131-7/+29
| | | | | | | | | -static variables -variables in anonymous namespace (fixes rdar://7794535) -static data members in anonymous namespace -static data members specializations in anonymous namespace llvm-svn: 111027
* Expand the unused warnings for functions. Warn for:Argyrios Kyrtzidis2010-08-131-7/+29
| | | | | | | | | | -static function declarations -functions in anonymous namespace -class methods in anonymous namespace -class method specializations in anonymous namespace -function specializations in anonymous namespace llvm-svn: 111026
* Change Sema's UnusedStaticFuncs to UnusedFileScopedDecls to allow also ↵Argyrios Kyrtzidis2010-08-131-13/+15
| | | | | | | | keeping track of unused file scoped variables. This is only preparation, currently only static function definitions are tracked, as before. llvm-svn: 111025
* Teach ASTUnit to hold on to the Sema object and ASTConsumer that areDouglas Gregor2010-08-131-1/+1
| | | | | | | | used when parsing (or re-parsing) a file. Also, when loading a precompiled header into ASTUnit, create a Sema object that holds onto semantic-analysis information. llvm-svn: 111003
* Add a ParseAST overload that takes a Sema object, so that the callerDouglas Gregor2010-08-121-3/+26
| | | | | | | | | 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-22/+1
| | | | llvm-svn: 110958
* dgregor should write code that compiles.John McCall2010-08-121-3/+3
| | | | llvm-svn: 110956
* Add a ParseAST overload that takes a Sema object, so that the callerDouglas Gregor2010-08-121-0/+21
| | | | | | | | | 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
* Speculatively revert r110610 " Make ObjCInterfaceDecl redeclarable,Douglas Gregor2010-08-111-1/+1
| | | | | | | | and create separate decl nodes for forward declarations and the definition," which appears to be causing significant Objective-C breakage. llvm-svn: 110803
* - Make ObjCInterfaceDecl redeclarable, and create separate decl nodes for ↵Sebastian Redl2010-08-091-1/+1
| | | | | | | | | | forward declarations and the definition. - Eagerly create ObjCInterfaceTypes for declarations. - The two above changes lead to a 0.5% increase in memory use and no speed regression when parsing Cocoa.h. On the other hand, now chained PCH works when there's a forward declaration in one PCH and the interface definition in another. - Add HandleInterestingDecl to ASTConsumer. PCHReader passes the "interesting" decls it finds to this function instead of HandleTopLevelDecl. The default implementation forwards to HandleTopLevelDecl, but ASTUnit's handler for example ignores them. This fixes a potential crash when lazy loading of PCH data would cause ASTUnit's "top level" declaration collection to change while being iterated. llvm-svn: 110610
* Store inheritance paths after CastExprs instead of inside them.John McCall2010-08-071-4/+4
| | | | | | | | | | | | | | | This takes some trickery since CastExpr has subclasses (and indeed, is abstract). Also, smoosh the CastKind into the bitfield from Expr. Drops two words of storage from Expr in the common case of expressions which don't need inheritance paths. Avoids a separate allocation and another word of overhead in cases needing inheritance paths. Also has the advantage of not leaking memory, since destructors for AST nodes are never run. llvm-svn: 110507
* Store the pending implicit instantiations in the PCH and perform them at the ↵Argyrios Kyrtzidis2010-08-051-20/+23
| | | | | | | | end of the translation unit that included the PCH, as God intended. llvm-svn: 110324
* Support #pragma weak for PCH.Argyrios Kyrtzidis2010-08-051-3/+3
| | | | llvm-svn: 110323
* Implement #pragma GCC visibility.Eli Friedman2010-08-051-1/+2
| | | | llvm-svn: 110315
* Read/write in PCH Sema's StdNamespace and StdBadAlloc and use a LazyDeclPtr ↵Argyrios Kyrtzidis2010-08-021-2/+1
| | | | | | for them that will deserialize them when needed. llvm-svn: 110031
* Only run the jump-checker if there's a branch-protected scope *and* there'sJohn McCall2010-08-011-1/+4
| | | | | | | | | | a switch or goto somewhere in the function. Indirect gotos trigger the jump-checker regardless, because the conditions there are slightly more elaborate and it's too marginal a case to be worth optimizing. Turns off the jump-checker in a lot of cases in C++. rdar://problem/7702918 llvm-svn: 109962
* Remove the vast majority of the Destroy methods from the AST library,Douglas Gregor2010-07-251-2/+0
| | | | | | since we aren't going to be calling them ever. llvm-svn: 109377
* Update ImplicitCastExpr to be able to represent an XValue.Sebastian Redl2010-07-201-4/+14
| | | | llvm-svn: 108807
OpenPOWER on IntegriCloud