Daniel Dunbar [Thu, 15 Jan 2009 04:24:17 +0000 (04:24 +0000)]
Add utils/ABITest, my ABI test generation tool.
- Mostly written as an entertaining exercise in enumerating large or
(countably, naturally) infinite sets. But hey, its useful too!
- Idea is to number all C-types so that the N-th type can quickly be
computed, with a good deal of flexibility about what types to
include, and taking some care so that the (N+1)-th type is
interestingly different from the N-th type. For example, using the
default generator, the 1,000,000-th function type is:
--
typedef _Complex int T0;
typedef char T1 __attribute__ ((vector_size (4)));
typedef int T2 __attribute__ ((vector_size (4)));
T2 fn1000000(T0 arg0, signed long long arg1, T1 arg2, T0 arg3);
--
and the 1,000,001-th type is:
--
typedef _Complex char T0;
typedef _Complex char T2;
typedef struct T1 { T2 field0; T2 field1; T2 field2; } T1;
typedef struct T3 { } T3;
unsigned short fn1000001(T0 arg0, T1 arg1, T3 arg2);
--
Computing the 10^1600-th type takes a little less than 1s. :)
Ted Kremenek [Thu, 15 Jan 2009 01:26:25 +0000 (01:26 +0000)]
PTH: Embed a persistentID side-table in the PTH file that is sorted in the
lexical order of the corresponding identifier strings. This will be used for a
forthcoming optimization. This slows down PTH generation time by 7%. We can
revert this change if the optimization proves to not be valuable.
Daniel Dunbar [Wed, 14 Jan 2009 23:26:40 +0000 (23:26 +0000)]
ccc: Implement support clang PTH using gcc PCH style interface.
This requires some hackery, as gcc's PCH mechanism changes behavior,
whereas while PTH is simply a cache. Notably:
- Automatically cause clang to load a .pth file if we find one that
matches a command line -include argument (similar to how gcc
looks for .gch files).
- When generating precompiled headers, translate the suffix from .gch
to .pth (so we do not conflict with actual gcc PCH files).
- When generating precompiled headers, copy the input header to the
same location as the output PTH file. This is necessary because gcc
supports -include xxx.h even if xxx.h doesn't exist, but for clang
we need to actually have the contents of this file available.
Douglas Gregor [Wed, 14 Jan 2009 22:20:51 +0000 (22:20 +0000)]
Refactor name lookup.
This change refactors and cleans up our handling of name lookup with
LookupDecl. There are several aspects to this refactoring:
- The criteria for name lookup is now encapsulated into the class
LookupCriteria, which replaces the hideous set of boolean values
that LookupDecl currently has.
- The results of name lookup are returned in a new class
LookupResult, which can lazily build OverloadedFunctionDecls for
overloaded function sets (and, eventually, eliminate the need to
allocate member for OverloadedFunctionDecls) and contains a
placeholder for handling ambiguous name lookup (for C++).
- The primary entry points for name lookup are now LookupName (for
unqualified name lookup) and LookupQualifiedName (for qualified
name lookup). There is also a convenience function
LookupParsedName that handles qualified/unqualified name lookup
when given a scope specifier. Together, these routines are meant
to gradually replace the kludgy LookupDecl, but this won't happen
until after we have base class lookup (which forces us to cope
with ambiguities).
- Documented the heck out of name lookup. Experimenting a little
with using Doxygen's member groups to make some sense of the Sema
class. Feedback welcome!
- Fixes some lingering issues with name lookup for
nested-name-specifiers, which now goes through
LookupName/LookupQualifiedName.
Douglas Gregor [Wed, 14 Jan 2009 15:45:31 +0000 (15:45 +0000)]
Introduce support for C++0x explicit conversion operators (N2437)
Small cleanup in the handling of user-defined conversions.
Also, implement an optimization when constructing a call. We avoid
recomputing implicit conversion sequences and instead use those
conversion sequences that we computed as part of overload resolution.
Ted Kremenek [Tue, 13 Jan 2009 23:19:12 +0000 (23:19 +0000)]
PTH:
- Use canonical FileID when using getSpelling() caching. This
addresses some cache misses we were seeing with -fsyntax-only on
Cocoa.h
- Added Preprocessor::getPhysicalCharacterAt() utility method for
clients to grab the first character at a specified sourcelocation.
This uses the PTH spelling cache.
- Modified Sema::ActOnNumericConstant() to use
Preprocessor::getPhysicalCharacterAt() instead of
SourceManager::getCharacterData() (to get PTH hits).
These changes cause -fsyntax-only to not page in any sources from
Cocoa.h. We see a speedup of 27%.
Ted Kremenek [Tue, 13 Jan 2009 22:05:50 +0000 (22:05 +0000)]
PTH: Fix remaining cases where the spelling cache in the PTH file was being missed when it shouldn't. This shaves another 7% off PTH time for -Eonly on Cocoa.h
Daniel Dunbar [Tue, 13 Jan 2009 21:07:43 +0000 (21:07 +0000)]
ccc: Darwin: Implement some important general argument translations
for the Darwin tool chain.
- Ideally we would localize these to tool specific argument
processing but for now this matches gcc closely.
Douglas Gregor [Tue, 13 Jan 2009 19:47:12 +0000 (19:47 +0000)]
Turn off some Destroy calls that are currenly causing double-destruction of ScopedDecls. We will re-enable this later, when we have time to fully solve the ownership issue.
DeclContext::KindTrait was not meant to be used outside of DeclContext::CastTo (causes compilation error on MSVC).
Add DeclContext::getDeclKind() and use that instead of DeclContext::KindTrait.
Daniel Dunbar [Tue, 13 Jan 2009 05:54:38 +0000 (05:54 +0000)]
ccc: Add option groups.
- Simple mechanism for group together sets of options so the driver
can efficiently deal with them as a group (i.e., for forwarding -i*
to cc1).
- Use to finish off the major missing pieces of Darwin/CC1 support.
Zhongxing Xu [Tue, 13 Jan 2009 01:49:57 +0000 (01:49 +0000)]
Add KillStruct to region store.
- put the killed region in the kill set.
- set its default value to unknown.
- removes all bindings for its subregions.
Zhongxing Xu [Tue, 13 Jan 2009 01:29:24 +0000 (01:29 +0000)]
Add an initial framework of a DeclContextPrinter. It can print DeclContext and
its Decls in indented format. An Example:
$ cat t.cpp
class A {
int a;
void f();
};
void A::f() {
a = 3;
}
$ clang -print-decl-contexts t.cpp
[translation unit] 0x9754d7c
<typedef> __builtin_va_list
[class] A 0x9753310
<class> A 0x975ce20
<field> a
<c++ method> f
<c++ ctor> A
<c++ ctor> A
<c++ method> operator=
<c++ dtor> ~A
[c++ method] f [[0x9753310]]
Some comments: '<>' indicates a declaration, '[]' indicates a definition, '[[
]]' displays the semantic DeclContext which is different from the lexical
DeclContext. The symbols printed can definitely be changed in the future.
Ted Kremenek [Mon, 12 Jan 2009 21:45:02 +0000 (21:45 +0000)]
retain/release checker:
- Refactor a bunch of logic in the retain/release checker, making it more
condense and easier to read.
- Add support for "Create" methods in the DiskArbitration framework
retain/release tests:
- Rename CFDate.m to retain-release.m, and move test from CFString.c to
retain-release.m
- Add DiskArbitration framework tests cases.
- Add/refine and few more retain/release GC test cases.
Patch to supprt case of readonly property being
assigned to when it has user declared setter method
defined in the class implementation (but no declaration in
the class itself).
There is still some work to do in Objective-C++, but this requires
that each of the Objective-C entities (interfaces, implementations,
etc.) to be introduced into the context stack with
PushDeclContext/PopDeclContext. This will be a separate fix, later.
Nuno Lopes [Sun, 11 Jan 2009 23:22:37 +0000 (23:22 +0000)]
make ScalarExprEmitter::EmitCompare() emit the expression with the correct type instead of always zext it to an int
this fixes codegen of simple exprs in C++ like 'if (x != 0)'
Daniel Dunbar [Sun, 11 Jan 2009 23:13:15 +0000 (23:13 +0000)]
ccc: Add fairly complete argument translation for Darwin link step.
- Some things are still hardcoded, and macosx-version-min comparison
isn't implemented, but otherwise this very closely matches gcc.
- The one exception is that arguments (like -framework or -Wl,) which are
treated as linker inputs instead of options are not being
forwarded yet.
Chris Lattner [Sun, 11 Jan 2009 19:48:19 +0000 (19:48 +0000)]
make paste avoidance avoid pasting digraphs and :: only when digraphs or c++ is enabled
respectively. Inspired by a patch by Dan Villiom Podlaski Christiansen.