summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Initial infrastructure for class template partial specialization. HereDouglas Gregor2009-05-313-19/+173
| | | | | | | | | | | | | we have the basics of declaring and storing class template partial specializations, matching class template partial specializations at instantiation time via (limited) template argument deduction, and using the class template partial specialization's pattern for instantiation. This patch is enough to make a simple is_pointer type trait work, but not much else. llvm-svn: 72662
* Forgot the implementation. Thanks Eli.Anders Carlsson2009-05-301-0/+41
| | | | llvm-svn: 72647
* Add RemoveOutermostTemporaryBinding. Not used yet.Anders Carlsson2009-05-301-0/+11
| | | | llvm-svn: 72644
* Clean up the newly added C++ AST nodes.Anders Carlsson2009-05-301-3/+3
| | | | llvm-svn: 72643
* It's OK for a full expr to be null. This fixes the failing test cases.Anders Carlsson2009-05-301-3/+2
| | | | llvm-svn: 72642
* ActOnReturnStmt should also take a FullExprArg.Anders Carlsson2009-05-303-4/+4
| | | | llvm-svn: 72641
* AddInitializerToDecl needs to take a full expression.Anders Carlsson2009-05-303-4/+4
| | | | llvm-svn: 72640
* Add the newly created temporary to the ExprTemporaries stack.Anders Carlsson2009-05-301-1/+2
| | | | llvm-svn: 72638
* Stop using CXXTempVarDecl and use CXXTemporary instead.Anders Carlsson2009-05-302-5/+2
| | | | llvm-svn: 72634
* Remove VarDecl from CXXConstructExpr.Anders Carlsson2009-05-304-15/+6
| | | | llvm-svn: 72633
* Bind temporaries correctly when instantiating expressions.Anders Carlsson2009-05-301-1/+1
| | | | llvm-svn: 72632
* Remove VarDecl from CheckInitializerTypes now that CXXConstructExpr doesn't ↵Anders Carlsson2009-05-303-10/+5
| | | | | | need to take a VarDecl anymore. (It still does, but it won't for long) llvm-svn: 72630
* Add Sema::MaybeBindToTemporary which takes an expression and (if needed) ↵Anders Carlsson2009-05-302-5/+27
| | | | | | wraps it in a CXXBindTemporaryExpr. Use this when creating CXXTemporaryObjectExprs. llvm-svn: 72629
* Add a CXXBindTemporaryExpr.Anders Carlsson2009-05-301-0/+10
| | | | llvm-svn: 72627
* Replace a cast with a dyn_cast as suggested by Doug.Anders Carlsson2009-05-301-7/+8
| | | | llvm-svn: 72624
* Pretty printing and improved representation for namespace alias declarationsDouglas Gregor2009-05-301-1/+3
| | | | llvm-svn: 72616
* Printing for using directives, e.g.,Douglas Gregor2009-05-301-2/+6
| | | | | | | | | using namespace std::debug; Extended UsingDirectiveDecl to store the nested-name-specifier that precedes the nominated namespace. llvm-svn: 72614
* Add a member lookup criteria constructor for searching for overridden ↵Anders Carlsson2009-05-303-14/+24
| | | | | | virtual member functions. Use this instead of regular name lookup when checking for overriding functions so we will see declarations that would otherwise be hidden. Fixes 6902298. llvm-svn: 72601
* Refactor and clean up the AST printer, so that it uses a DeclVisitor,Douglas Gregor2009-05-301-2/+4
| | | | | | | | | walks through DeclContexts properly, and prints more of the information available in the AST. The functionality is still available via -ast-print, -ast-dump, etc., and also via the new member functions Decl::dump() and Decl::print(). llvm-svn: 72597
* Make the LookupBase boolean an enum instead.Anders Carlsson2009-05-292-7/+17
| | | | llvm-svn: 72594
* Create a new PrintingPolicy class, which we pass down through the ASTDouglas Gregor2009-05-292-2/+3
| | | | | | | | | printing logic to help customize the output. For now, we use this rather than a special flag to suppress the "struct" when printing "struct X" and to print the Boolean type as "bool" in C++ but "_Bool" in C. llvm-svn: 72590
* Make sure we don't give the wrong warning, and make sure not to set Eli Friedman2009-05-291-6/+9
| | | | | | | hadError (suppressing future diagnostics) if we didn't print an error. llvm-svn: 72588
* Add an assertion so that we don't accidentally build constant arrays of Eli Friedman2009-05-291-1/+1
| | | | | | VLAs. llvm-svn: 72587
* Reduce the amount of stack space we use in SmallVectors duringDouglas Gregor2009-05-294-13/+13
| | | | | | | template instantiation. This helps reduce our stack footprint when performing deep template instantiations. llvm-svn: 72582
* Revert r72575, which isn't really right, and fix up other code to Eli Friedman2009-05-291-20/+20
| | | | | | handle the construct in question correctly. llvm-svn: 72581
* Reject incomplete types in exception specs.Sebastian Redl2009-05-293-8/+55
| | | | llvm-svn: 72580
* Avoid dumping during semantic analysis when checking array types whenMike Stump2009-05-291-15/+16
| | | | | | a vla is used. llvm-svn: 72575
* Disallow exception specifications on multi-level indirections.Sebastian Redl2009-05-292-0/+47
| | | | llvm-svn: 72571
* Some cleanups and commenting to our declaration-name handlingDouglas Gregor2009-05-291-11/+5
| | | | llvm-svn: 72570
* Now that we have declared/defined tag types within DeclGroups,Douglas Gregor2009-05-292-7/+1
| | | | | | | | | | | | | instantiation of tags local to member functions of class templates (and, eventually, function templates) works when the tag is defined as part of the decl-specifier-seq, e.g., struct S { T x, y; } s1; Also, make sure that we don't try to default-initialize a dependent type. llvm-svn: 72568
* If a declarator group declares a type, make sure to add that declaration Eli Friedman2009-05-292-3/+8
| | | | | | to the DeclGroup. llvm-svn: 72559
* When we parse a tag specifier, keep track of whether that tagDouglas Gregor2009-05-284-9/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | specifier resulted in the creation of a new TagDecl node, which happens either when the tag specifier was a definition or when the tag specifier was the first declaration of that tag type. This information has several uses, the first of which is implemented in this commit: 1) In C++, one is not allowed to define tag types within a type specifier (e.g., static_cast<struct S { int x; } *>(0) is ill-formed) or within the result or parameter types of a function. We now diagnose this. 2) We can extend DeclGroups to contain information about any tags that are declared/defined within the declaration specifiers of a variable, e.g., struct Point { int x, y, z; } p; This will help improve AST printing and template instantiation, among other things. 3) For C99, we can keep track of whether a tag type is defined within the type of a parameter, to properly cope with cases like, e.g., int bar(struct T2 { int x; } y) { struct T2 z; } We can also do similar things wherever there is a type specifier, e.g., to keep track of where the definition of S occurs in this legal C99 code: (struct S { int x, y; } *)0 llvm-svn: 72555
* Introduced DeclContext::isDependentContext, which determines whether aDouglas Gregor2009-05-281-0/+7
| | | | | | | | | | | | | | | | | | | given DeclContext is dependent on type parameters. Use this to properly determine whether a TagDecl is dependent; previously, we were missing the case where the TagDecl is a local class of a member function of a class template (phew!). Also, make sure that, when we instantiate declarations within a member function of a class template (or a function template, eventually), that we add those declarations to the "instantiated locals" map so that they can be found when instantiating declaration references. Unfortunately, I was not able to write a useful test for this change, although the assert() that fires when uncommenting the FIXME'd line in test/SemaTemplate/instantiate-declref.cpp tells the "experienced user" that we're now doing the right thing. llvm-svn: 72526
* Reimplement much of the way that we track nested classes in theDouglas Gregor2009-05-273-2/+19
| | | | | | | | | | | | | parser. Rather than placing all of the delayed member function declarations and inline definitions into a single bucket corresponding to the top-level class, we instead mirror the nesting structure of the nested classes and place the delayed member functions into their appropriate place. Then, when we actually parse the delayed member function declarations, set up the scope stack the same way as it was when we originally saw the declaration, so that we can find, e.g., template parameters that are in scope. llvm-svn: 72502
* Reintroduce the home for exception specs, and make Sema fill it. However, ↵Sebastian Redl2009-05-273-3/+24
| | | | | | keep the spec out of the canonical type this time. Net effect is currently nothing, because the spec isn't checked anywhere. llvm-svn: 72498
* Fix the type of a enum non-type template argument within the instantiation.Sebastian Redl2009-05-271-1/+1
| | | | llvm-svn: 72489
* Simplify, and improve the performance of, template instantiation forDouglas Gregor2009-05-274-30/+32
| | | | | | | | | | | declaration references. The key realization is that dependent Decls, which actually require instantiation, can only refer to the current instantiation or members thereof. And, since the current context during instantiation contains all of those members of the current instantiation, we can simply find the real instantiate that matches up with the "current instantiation" template. llvm-svn: 72486
* Add some more tests for instantiation of declaration references. Also,Douglas Gregor2009-05-272-1/+6
| | | | | | improve some error recovery with explicit template instantiation. llvm-svn: 72484
* Enumeration declarations that were instantiated from an enumerationDouglas Gregor2009-05-271-1/+4
| | | | | | | | within a template now have a link back to the enumeration from which they were instantiated. This means that we can now find the instantiation of an anonymous enumeration. llvm-svn: 72482
* Improve name lookup for and template instantiation of declarationDouglas Gregor2009-05-273-27/+18
| | | | | | | | | | | | | | | | | | | | | | | references. There are several smallish fixes here: - Make sure we look through template parameter scope when determining whether we're parsing a nested class (or nested class *template*). This makes sure that we delay parsing the bodies of inline member functions until after we're out of the outermost class (template) scope. - Since the bodies of member functions are always parsed "out-of-line", even when they were declared in-line, teach unqualified name lookup to look into the (semantic) parents. - Use the new InstantiateDeclRef to handle the instantiation of a reference to a declaration (in DeclRefExpr), which drastically simplifies template instantiation for DeclRefExprs. - When we're instantiating a ParmVarDecl, it must be in the current instantiation scope, so only look there. Also, remove the #if 0's and FIXME's from the dynarray example, which now compiles and executes thanks to Anders and Eli. llvm-svn: 72481
* Fix another test case.Anders Carlsson2009-05-271-0/+8
| | | | llvm-svn: 72478
* Relax an assert to an if check.Anders Carlsson2009-05-271-3/+3
| | | | llvm-svn: 72477
* Convert ObjC qualified type clients over to using iterators.Steve Naroff2009-05-271-14/+19
| | | | | | | | This allows me to remove some API that I don't want to carry over to ObjCObjectPointerType. No functionality change. llvm-svn: 72475
* Create CXXConstructExprs when constructing via copy initialization.Anders Carlsson2009-05-273-4/+15
| | | | llvm-svn: 72474
* Initial stab at a generalized operation for determining theDouglas Gregor2009-05-274-19/+161
| | | | | | | | | | | | instantiation of a declaration from the template version (or version that lives in a template) and a given set of template arguments. This needs much, much more testing, but it suffices for simple examples like typedef T* iterator; iterator begin(); llvm-svn: 72461
* Don't drop the computed implicit conversions when building a call toDouglas Gregor2009-05-271-0/+3
| | | | | | | overloaded operator[] or overloaded postfix unary operator (++, --). Thanks to Eli for finding this bug! llvm-svn: 72460
* Template instantiation for "typeof" for both types and expressions.Douglas Gregor2009-05-262-7/+18
| | | | llvm-svn: 72440
* Make sure that CodeGen sees template instantiations.Douglas Gregor2009-05-262-0/+8
| | | | llvm-svn: 72433
* When evaluating a VarDecl as a constant or determining whether it isDouglas Gregor2009-05-262-3/+3
| | | | | | | | an integral constant expression, maintain a cache of the value and the is-an-ICE flag within the VarDecl itself. This eliminates exponential-time behavior of the Fibonacci template metaprogram. llvm-svn: 72428
* An Obj-C message send expression can never have a reference type.Anders Carlsson2009-05-261-0/+7
| | | | llvm-svn: 72417
OpenPOWER on IntegriCloud