Douglas Gregor [Wed, 11 Feb 2009 19:52:55 +0000 (19:52 +0000)]
Finished semantic analysis of non-type template arguments, to check
for non-external names whose address becomes the template
argument. This completes C++ [temp.arg.nontype]p1.
Note that our interpretation of C++ [temp.arg.nontype]p1b3 differs
from EDG's interpretation (we're stricter, and GCC agrees with
us). They're opening a core issue about the matter.
Douglas Gregor [Wed, 11 Feb 2009 18:16:40 +0000 (18:16 +0000)]
Allow the use of default template arguments when forming a class
template specialization (e.g., std::vector<int> would now be
well-formed, since it relies on a default argument for the Allocator
template parameter).
This is much less interesting than one might expect, since (1) we're
not actually using the default arguments for anything important, such
as naming an actual Decl, and (2) we'll often need to instantiate the
default arguments to check their well-formedness. The real fun will
come later.
Douglas Gregor [Wed, 11 Feb 2009 16:16:59 +0000 (16:16 +0000)]
Implement semantic checking for template arguments that correspond to
pointer-to-member-data non-type template parameters. Also, get
consistent about what it means to returned a bool from
CheckTemplateArgument.
Douglas Gregor [Wed, 11 Feb 2009 01:18:59 +0000 (01:18 +0000)]
Add semantic checking for template arguments that correspond to
non-type template parameters that are references to functions or
pointers to member functions. Did a little bit of refactoring so that
these two cases, along with the handling of non-type template
parameters that are pointers to functions, are handled by the same
path.
Also, tweaked FixOverloadedFunctionReference to cope with member
function pointers. This is a necessary step for getting all of the fun
member pointer conversions working outside of template arguments, too.
Douglas Gregor [Wed, 11 Feb 2009 00:44:29 +0000 (00:44 +0000)]
Semantic checking for template arguments that correspond to non-type
template parameters that have reference type. Effectively, we're doing
a very limited form of reference binding here.
Douglas Gregor [Wed, 11 Feb 2009 00:19:33 +0000 (00:19 +0000)]
Add partial semantic checking of template arguments that are meant for
non-type template parameters of pointer-to-object and
pointer-to-function type. The most fun part of this is the use of
overload resolution to pick a function from the set of overloaded
functions that comes in as a template argument.
Also, fixed two minor bugs in this area:
- We were allowing non-type template parameters of type pointer to
void.
- We weren't patching up an expression that refers to an overloaded
function set via "&f" properly.
We're still not performing complete checking of the expression to be
sure that it is referring to an object or function with external
linkage (C++ [temp.arg.nontype]p1).
Ted Kremenek [Tue, 10 Feb 2009 22:16:22 +0000 (22:16 +0000)]
PTH: Replace ad hoc 'file name' -> 'PTH data' lookup table in the PTH file with an on-disk chained hash table. This data structure is implemented using templates, and will be used to replace similar data structures. This change leads to no visibile performance impact on Cocoa.h, but now we only pay a price for the table on order with the number of files accessed and not the number in the PTH file.
Douglas Gregor [Tue, 10 Feb 2009 21:49:46 +0000 (21:49 +0000)]
GNU allows structs with flexible array members to be placed inside
arrays and other structs/unions as an extension. Downgrade our error
to a warning. Fixes PR3540.
Mike Stump [Tue, 10 Feb 2009 20:16:46 +0000 (20:16 +0000)]
Fixup -ast-print so that:
We handle indentation of decls better.
We Indent extern "C" { } stuff better.
We print out structure contents more often.
We handle pass indentation information into the statement printer, so that
nested things come out more indented.
We print out FieldDecls.
We print out Vars.
We print out namespaces.
We indent functions better.
Douglas Gregor [Tue, 10 Feb 2009 19:49:53 +0000 (19:49 +0000)]
Implement parsing, semantic analysis and ASTs for default template
arguments. This commit covers checking and merging default template
arguments from previous declarations, but it does not cover the actual
use of default template arguments when naming class template
specializations.
Sanjiv Gupta [Tue, 10 Feb 2009 04:17:25 +0000 (04:17 +0000)]
Function parameters for PIC16 are like local variables. So use the keyword ".auto." to mangle their names. The working of PIC16AsmPrinter relies on that keyword currently.
Daniel Dunbar [Tue, 10 Feb 2009 03:03:30 +0000 (03:03 +0000)]
Support va_arg on _Complex.
gcc compat test suite results (Darwin x86-32 & -64):
--
# of expected passes 1110
# of unexpected failures 74
# of unresolved testcases 168
# of unsupported tests 2
Daniel Dunbar [Tue, 10 Feb 2009 01:51:39 +0000 (01:51 +0000)]
ABI: Correctly handle load/store of values which have a different LLVM
memory representation (e.g., bool).
- This upgrades (downgrades) MultiSource/Applications/ClamAV/clamscan
to a miscompile and fixes
SingleSource/UnitTests/2003-05-31-CastToBool.
Daniel Dunbar [Tue, 10 Feb 2009 00:57:50 +0000 (00:57 +0000)]
Add util Emit{LoadOf,StoreTo}Scalar methods to encapsulate conversion
from LLVM memory type to/from LLVM temporary type.
- No intended functionality change.
Douglas Gregor [Tue, 10 Feb 2009 00:53:15 +0000 (00:53 +0000)]
Teach the type-id/expression disambiguator about different
disambiguation contexts, so that we properly parse template arguments
such as
A<int()>
as type-ids rather than as expressions. Since this can be confusing
(especially when the template parameter is a non-type template
parameter), we try to give a friendly error message.
Almost, eliminate a redundant error message (that should have been a
note) and add some ultra-basic checks for non-type template
arguments.
Douglas Gregor [Mon, 9 Feb 2009 23:23:08 +0000 (23:23 +0000)]
Rudimentary checking of template arguments against their corresponding
template parameters when performing semantic analysis of a template-id
naming a class template specialization.
Douglas Gregor [Mon, 9 Feb 2009 21:04:56 +0000 (21:04 +0000)]
Implement Sebastian's idea for simplifying our handling of the greater-than operator/delimiter. Also, clean up after ourselves following a failed parse of a template-argument-list
Douglas Gregor [Mon, 9 Feb 2009 19:45:19 +0000 (19:45 +0000)]
When handling "the rest" of a designated array subobject, maybe sure
to tell it that it wasn't (directly) designated. This way, we unwind
back to the explicit initializer list properly rather than getting
stuck in the wrong subobject. Fixes llvm.org/PR3519
Douglas Gregor [Mon, 9 Feb 2009 19:34:22 +0000 (19:34 +0000)]
Eliminate TemplateArg so that we only have a single kind of
representation for template arguments. Also simplifies the interface
for ActOnClassTemplateSpecialization and eliminates some annoying
allocations of TemplateArgs.
My attempt at smart pointers for template arguments lists is
relatively lame. We can improve it once we're sure that we have the
right representation for template arguments.
Douglas Gregor [Mon, 9 Feb 2009 18:46:07 +0000 (18:46 +0000)]
Start processing template-ids as types when the template-name refers
to a class template. For example, the template-id 'vector<int>' now
has a nice, sugary type in the type system. What we can do now:
- Parse template-ids like 'vector<int>' (where 'vector' names a
class template) and form proper types for them in the type system.
- Parse icky template-ids like 'A<5>' and 'A<(5 > 0)>' properly,
using (sadly) a bool in the parser to tell it whether '>' should
be treated as an operator or not.
This is a baby-step, with major problems and limitations:
- There are currently two ways that we handle template arguments
(whether they are types or expressions). These will be merged, and,
most likely, TemplateArg will disappear.
- We don't have any notion of the declaration of class template
specializations or of template instantiations, so all template-ids
are fancy names for 'int' :)
Douglas Gregor [Mon, 9 Feb 2009 15:09:02 +0000 (15:09 +0000)]
Make Sema::getTypeName return the opaque pointer of a QualType rather
than a Decl, which gives us some more flexibility to express the
results with the type system. There are no clients using this
flexibility yet, but it's meant to be able to describe qualified names
as written in the source (e.g., "foo::type") or template-ids that name
a class template specialization (e.g., "std::vector<INT>").
DeclSpec's TST_typedef has become TST_typename, to reflect its use to
describe types found by name (that may or may not be typedefs). The
type representation of a DeclSpec with TST_typename is an opaque
QualType pointer. All users of TST_typedef, both direct and indirect,
have been updated for these changes.