Ted Kremenek [Fri, 13 Feb 2009 01:45:31 +0000 (01:45 +0000)]
GRExprEngine:
- Add 'EvalBind', which will be used by 'EvalStore' to pull much of the value binding logic out of GRTransferFuncs.
- Rename many cases of 'St' to 'state'.
Ted Kremenek [Fri, 13 Feb 2009 00:51:30 +0000 (00:51 +0000)]
AnalysisConsumer: Explicitly destroy the PathDiagnosticClient at the end of HandleTranslationUnit to ensure that the client's destructor is called even with --disable-free.
Chris Lattner [Fri, 13 Feb 2009 00:51:30 +0000 (00:51 +0000)]
make "floating macro bubble" output of -emit-html much prettier:
only insert spaces between tokens if the code had them or if they
are actually required to avoid pasting. This reuses the same
logic as -E mode.
Daniel Dunbar [Fri, 13 Feb 2009 00:49:01 +0000 (00:49 +0000)]
ccc: Stop patching output file name when using transparent PTH support.
<rdar://problem/6515236> [ccc] generate expected output files when used with PCH
Douglas Gregor [Fri, 13 Feb 2009 00:26:38 +0000 (00:26 +0000)]
Tighten checking of the "overloadable" attribute. If any function by a
given name in a given scope is marked as "overloadable", every
function declaration and definition with that same name and in that
same scope needs to have the "overloadable" attribute. Essentially,
the "overloadable" attribute is not part of attribute merging, so it
must be specified even for redeclarations. This keeps users from
trying to be too sneaky for their own good:
double sin(double) __attribute__((overloadable)); // too sneaky
#include <math.h>
Previously, this would have made "sin" overloadable, and therefore
given it a mangled name. Now, we get an error inside math.h when we
see a (re)declaration of "sin" that doesn't have the "overloadable"
attribute.
Douglas Gregor [Fri, 13 Feb 2009 00:10:09 +0000 (00:10 +0000)]
Add basic support for C++ name mangling according to the Itanium C++
ABI to the CodeGen library. Since C++ code-generation is so
incomplete, we can't exercise much of this mangling code. However, a
few smoke tests show that it's doing the same thing as GCC. When C++
codegen matures, we'll extend the ABI tester to verify name-mangling
as well, and complete the implementation here.
At this point, the major client of name mangling is in the uses of the
new "overloadable" attribute in C, which allows overloading. Any
"overloadable" function in C (or in an extern "C" block in C++) will
be mangled the same way that the corresponding C++ function would be
mangled.
Douglas Gregor [Thu, 12 Feb 2009 19:00:39 +0000 (19:00 +0000)]
Fix a bug with designated initializers where we were stepping out of a
union subobject initialization before checking whether the next
initiailizer was actually a designated initializer. This led to
spurious "excess elements in union initializer" errors. Thanks to
rdivacky for reporting the bug!
Mike Stump [Thu, 12 Feb 2009 18:29:15 +0000 (18:29 +0000)]
Initial codegen for block literals. This is a work in progress. I've
tried to put FIXMEs on the most important things to fix up. Lots left
to do including more codegen, more documentation and cleaning code and
style cleanups.
Steve Naroff [Thu, 12 Feb 2009 17:52:19 +0000 (17:52 +0000)]
Several cleanups:
- rename isObjCIdType/isObjCClassType -> isObjCIdStructType/isObjCClassStructType. The previous name didn't do what you would expect.
- add back isObjCIdType/isObjCClassType to do what you would expect. Not currently used, however many of the isObjCIdStructType/isObjCClassStructType clients could be converted over time.
- move static Sema function areComparableObjCInterfaces to ASTContext (renamed to areComparableObjCPointerTypes, since it now operates on pointer types).
Daniel Dunbar [Thu, 12 Feb 2009 09:04:14 +0000 (09:04 +0000)]
x86_64: Initial varargs support.
- Doesn't yet handle case where values are passed in mixed (general
purpose & floating point) registers; otherwise largely
functional. Code still needs some cleaning.
gcc compat test suite results (Darwin x86-32 & -64):
--
# of expected passes 1262
# of unexpected failures 56
# of unresolved testcases 34
# of unsupported tests 2
Compare to: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090209/012050.html
Ted Kremenek [Thu, 12 Feb 2009 03:26:59 +0000 (03:26 +0000)]
PTH: Cache stat information for files in the PTH file. Hook up FileManager
to use this stat information in the PTH file using a 'StatSysCallCache' object.
Performance impact (Cocoa.h, PTH):
- number of stat calls reduces from 1230 to 425
- fsyntax-only: time improves by 4.2%
We can reduce the number of stat calls to almost zero by caching negative stat
calls and directory stat calls in the PTH file as well.
Ted Kremenek [Thu, 12 Feb 2009 03:17:57 +0000 (03:17 +0000)]
FileManager:
- set the 'StatSysCallCache' object using a setter method instead of
FileManager's constructor. This allows the cache to be installed after the
FileManager object is created.
- Add 'file mode' to FileEntry (useful for stat caching)
Ted Kremenek [Thu, 12 Feb 2009 00:39:05 +0000 (00:39 +0000)]
Add lightweight shim "clang::StatSysCallCache" that caches 'stat' system calls
for use by FileManager. FileManager now takes a StatSysCallCache* in its
constructor (which defaults to NULL). This will be used for evaluating whether
or not caching 'stat' system calls in PTH is a performance win. This shim adds
no observable performance impact in the case where the 'StatSysCallCache*' is
null.
Douglas Gregor [Thu, 12 Feb 2009 00:26:06 +0000 (00:26 +0000)]
Expand the definition of a complex promotion to include complex ->
complex conversions where the conversion between the real types is an
integral promotion. This is how G++ handles complex promotions for its
complex integer extension.
Douglas Gregor [Thu, 12 Feb 2009 00:15:05 +0000 (00:15 +0000)]
Introduce _Complex conversions into the function overloading
system. Since C99 doesn't have overloading and C++ doesn't have
_Complex, there is no specification for this. Here's what I think
makes sense.
Complex conversions come in several flavors:
- Complex promotions: a complex -> complex conversion where the
underlying real-type conversion is a floating-point promotion. GCC
seems to call this a promotion, EDG does something else. This is
given "promotion" rank for determining the best viable function.
- Complex conversions: a complex -> complex conversion that is
not a complex promotion. This is given "conversion" rank for
determining the best viable function.
- Complex-real conversions: a real -> complex or complex -> real
conversion. This is given "conversion" rank for determining the
best viable function.
These rules are the same for C99 (when using the "overloadable"
attribute) and C++. However, there is one difference in the handling
of floating-point promotions: in C99, float -> long double and double
-> long double are considered promotions (so we give them "promotion"
rank), while C++ considers these conversions ("conversion" rank).
Douglas Gregor [Wed, 11 Feb 2009 23:02:49 +0000 (23:02 +0000)]
Initial implementation of function overloading in C.
This commit adds a new attribute, "overloadable", that enables C++
function overloading in C. The attribute can only be added to function
declarations, e.g.,
int *f(int) __attribute__((overloadable));
If the "overloadable" attribute exists on a function with a given
name, *all* functions with that name (and in that scope) must have the
"overloadable" attribute. Sets of overloaded functions with the
"overloadable" attribute then follow the normal C++ rules for
overloaded functions, e.g., overloads must have different
parameter-type-lists from each other.
When calling an overloaded function in C, we follow the same
overloading rules as C++, with three extensions to the set of standard
conversions:
- A value of a given struct or union type T can be converted to the
type T. This is just the identity conversion. (In C++, this would
go through a copy constructor).
- A value of pointer type T* can be converted to a value of type U*
if T and U are compatible types. This conversion has Conversion
rank (it's considered a pointer conversion in C).
- A value of type T can be converted to a value of type U if T and U
are compatible (and are not both pointer types). This conversion
has Conversion rank (it's considered to be a new kind of
conversion unique to C, a "compatible" conversion).
Known defects (and, therefore, next steps):
1) The standard-conversion handling does not understand conversions
involving _Complex or vector extensions, so it is likely to get
these wrong. We need to add these conversions.
2) All overloadable functions with the same name will have the same
linkage name, which means we'll get a collision in the linker (if
not sooner). We'll need to mangle the names of these functions.
Ted Kremenek [Wed, 11 Feb 2009 21:29:16 +0000 (21:29 +0000)]
PTH: Replace string identifier to persistent ID lookup with a hashtable. This is
actually *slightly* slower than the binary search. Since this is algorithmically
better, further performance tuning should be able to make this faster.
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.