summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/Sema.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix my earlier commit to work with escaped newlines and leave breadcrumbsJohn McCall2011-03-081-0/+21
| | | | | | | in case we want to make a world where we can check intermediate instantiations for this kind of breadcrumb. llvm-svn: 127221
* Fixed TypedefDecl and TemplateTypeParameter source range.Abramo Bagnara2011-03-061-3/+8
| | | | llvm-svn: 127119
* Don't emit unused warning for deleted functions. Fixes rdar://8365684 & ↵Argyrios Kyrtzidis2011-03-031-0/+2
| | | | | | http://llvm.org/PR9391. llvm-svn: 126950
* Enhance Sema::DiagRuntimeBehavior() to delay some diagnostics to see if the ↵Ted Kremenek2011-02-231-1/+12
| | | | | | | | | | related code is reachable. This suppresses some diagnostics that occur in unreachable code (e.g., -Warray-bound). We only pay the cost of doing the reachability analysis when we issue one of these diagnostics. llvm-svn: 126290
* Have IdempotentOperationsChecker pull its CFGStmtMap from AnalysisContext.Ted Kremenek2011-02-231-1/+1
| | | | llvm-svn: 126288
* Issue AnalysisBasedWarnings as part of calling ↵Ted Kremenek2011-02-231-2/+8
| | | | | | Sema::PopBlockOrFunctionScope(). No real functionality change. llvm-svn: 126287
* Tweaks to C++0x deduced auto type support:Richard Smith2011-02-211-0/+6
| | | | | | | | * Flag indicating 'we're parsing this auto typed variable's initializer' moved from VarDecl to Sema * Temporary template parameter list for auto deduction is now allocated on the stack. * Deduced 'auto' types are now uniqued. llvm-svn: 126139
* Warn about code that uses variables and functions with internal linkageJohn McCall2011-02-191-0/+61
| | | | | | | | | | | | | | without defining them. This should be an error, but I'm paranoid about "uses" that end up not actually requiring a definition. I'll revisit later. Also, teach IR generation to not set internal linkage on variable declarations, just for safety's sake. Doing so produces an invalid module if the variable is not ultimately defined. Also, fix several places in the test suite where we were using internal functions without definitions. llvm-svn: 126016
* Switch labels over to using normal name lookup, instead of their Chris Lattner2011-02-181-49/+0
| | | | | | | own weird little DenseMap. Hey look, we now emit unused label warnings deterministically, amazing. llvm-svn: 125813
* add a fixmeChris Lattner2011-02-171-0/+2
| | | | llvm-svn: 125772
* Step #2/N of __label__ support: keep pushing LabelDecl forward,Chris Lattner2011-02-171-2/+1
| | | | | | | | | | making them be template instantiated in a more normal way and make them handle attributes like other decls. This fixes the used/unused label handling stuff, making it use the same infrastructure as other decls. llvm-svn: 125771
* Step #1/N of implementing support for __label__: split labels intoChris Lattner2011-02-171-0/+48
| | | | | | | | | | | | | | | | | | | LabelDecl and LabelStmt. There is a 1-1 correspondence between the two, but this simplifies a bunch of code by itself. This is because labels are the only place where we previously had references to random other statements, causing grief for AST serialization and other stuff. This does cause one regression (attr(unused) doesn't silence unused label warnings) which I'll address next. This does fix some minor bugs: 1. "The only valid attribute " diagnostic was capitalized. 2. Various diagnostics printed as ''labelname'' instead of 'labelname' 3. This reduces duplication of label checking between functions and blocks. Review appreciated, particularly for the cindex and template bits. llvm-svn: 125733
* When parsing an out-of-line member function declaration, we must delayJohn McCall2011-02-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | access-control diagnostics which arise from the portion of the declarator following the scope specifier, just in case access is granted by friending the individual method. This can also happen with in-line member function declarations of class templates due to templated-scope friend declarations. We were really playing fast-and-loose before with this sort of thing, and it turned out to work because *most* friend functions are in file scope. Making us delay regardless of context exposed several bugs with how we were manipulating delay. I ended up needing a concept of a context that's independent of the declarations in which it appears, and then I actually had to make some things save contexts correctly, but delay should be much cleaner now. I also encapsulated all the delayed-diagnostics machinery in a single subobject of Sema; this is a pattern we might want to consider rolling out to other components of Sema. llvm-svn: 125485
* Move support for "#pragma STDC FP_CONTRACT" to Parser; add Sema actionsPeter Collingbourne2011-02-141-1/+1
| | | | llvm-svn: 125474
* Perform the bad-address-space conversions check as part of John McCall2011-02-011-9/+0
| | | | | | CheckPointerTypesForAssignment. llvm-svn: 124632
* If there were errors, disable 'unused' warnings since they will mostly be noise.Argyrios Kyrtzidis2011-01-311-19/+23
| | | | | | Fixes rdar://8736362. llvm-svn: 124577
* Teach the evaluation of the __is_convertible_to trait to translateDouglas Gregor2011-01-271-5/+11
| | | | | | | | | | | | | | | access control errors into SFINAE errors, so that the trait provides enough support to implement the C++0x std::is_convertible type trait. To get there, the SFINAETrap now knows how to set up a SFINAE context independent of any template instantiations or template argument deduction steps, and (separately) can set a Sema flag to translate access control errors into SFINAE errors. The latter can also be useful if we decide that access control errors during template argument deduction should cause substitution failure (rather than a hard error) as has been proposed for C++0x. llvm-svn: 124446
* Separate the access-control diagnostics from other diagnostics that do not ↵Douglas Gregor2011-01-271-0/+2
| | | | | | have SFINAE behavior. llvm-svn: 124441
* Don't insert class templates into the DynamicClasses vector.Anders Carlsson2011-01-251-0/+2
| | | | llvm-svn: 124201
* 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
OpenPOWER on IntegriCloud