Anders Carlsson [Fri, 22 Jan 2010 17:37:20 +0000 (17:37 +0000)]
No need to canonicalize the type and use dyn_cast. Also, correctly diagnose trying to override a function returning an lvalue reference with a function overriding an rvalue reference.
Daniel Dunbar [Fri, 22 Jan 2010 03:38:14 +0000 (03:38 +0000)]
Driver/Darwin: Update tool chain to use static clang_rt libraries provided by
compiler-rt. This tool chain now works on x86 and ARM, but isn't the x86 default
yet.
This drastically cleans up the linker invocation, old invocation:
--
"/Developer/usr/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/ld" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.6.0" "-weak_reference_mismatches" "non-weak" "-o" "a.out" "-lcrt1.10.6.o" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64" "-L/usr/lib/i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.." "t.o" "-lSystem" "-lgcc"
--
Douglas Gregor [Fri, 22 Jan 2010 00:50:27 +0000 (00:50 +0000)]
Teach the cursor visitor to walk all of the C and Objective-C
declarations that have enough source information to make such a walk
useful. This includes walking into variable initializers and enum
constants, the types behind typedefs, etc.
John McCall [Fri, 22 Jan 2010 00:28:27 +0000 (00:28 +0000)]
Create function, block, and template parameters in the context of the
translation unit. This is temporary for function and block parameters;
template parameters can just stay this way, since Templates aren't
DeclContexts. This gives us the nice property that everything created
in a record DC should have access in C++.
Chris Lattner [Fri, 22 Jan 2010 00:14:44 +0000 (00:14 +0000)]
revert my patch for rdar://7520940 that warns when a published header
is #included with "foo.h" style syntax instead of framework syntax.
It produced too much noise.
Douglas Gregor [Thu, 21 Jan 2010 20:48:56 +0000 (20:48 +0000)]
Teach the cursor visitor to walk into typeof types (both kinds). This
is hard to test now; tests will come when we can walk stataements and
expressions properly.
Ted Kremenek [Thu, 21 Jan 2010 19:22:34 +0000 (19:22 +0000)]
Allocate the 'Protocols' array in ObjCInterfaceType and
ObjCObjectPointerType using the allocator associated with ASTContext.
Not only does this fix a memory leak, but it also makes these arrays
BumpPtrAllocated (in the typical case).
Daniel Dunbar [Thu, 21 Jan 2010 17:10:39 +0000 (17:10 +0000)]
Add a test for clang_rt support on Darwin. With appropriate massaging, this
checks that the runtime library can be linked and works for compiling on 10.6
for 10.{4,5,6} targets. Currently test is only for x86, and misses some
compiler-rt functions.
Mike Stump [Thu, 21 Jan 2010 15:20:48 +0000 (15:20 +0000)]
Speed up compilation by avoiding generating exceptional edges from
CallExprs as those edges help cause a n^2 explosion in the number of
destructor calls. Other consumers, such as static analysis, that
would like to have more a more complete CFG can select the inclusion
of those edges as CFG build time.
This also fixes up the two compilation users of CFGs to be tolerant of
having or not having those edges. All catch code is assumed be to
live if we didn't generate the exceptional edges for CallExprs.
Douglas Gregor [Wed, 20 Jan 2010 23:57:43 +0000 (23:57 +0000)]
Stash a CXXUnit pointer into each cursor. This allows us to simplify
the interface to clang_visitChildren() by eliminating the
CXTranslationUnit pointer.
Devang Patel [Wed, 20 Jan 2010 23:56:40 +0000 (23:56 +0000)]
A Decl->getName() is not unique. However, the debug info descriptors
are uniqued. The debug info descriptor describing record's context is
necessary to keep two Decl's descriptor unique if their name match.
There is more work to do to create descriptors for DeclContext.
As a temp. step use type's name in FwdDecl.
In objective-c++ land, a block pointer is another object pointer.
So, casting a generic object pointer ('id' or 'Class') to the
block pointer is allowed. Fixes radar 7562285.
Douglas Gregor [Wed, 20 Jan 2010 21:13:59 +0000 (21:13 +0000)]
Switch the internals of clang_loadTranslationUnit() over to the new
cursor-based traversal, and eliminate TUVisitor. We're now down to one
visitor for traversing the AST. Yay!
Douglas Gregor [Wed, 20 Jan 2010 20:59:29 +0000 (20:59 +0000)]
Introduce a new, cursor-based traversal function that visits the
children of a given cursor, regardless of what kind of cursor it
is. This is a generalization of clang_loadDeclaration and
clang_loadTranslationUnit that will also extent to statements,
expressions, etc.
As proof-of-concept, switched clang_loadDeclaration() from its own
visitor over to an instance of this traversal function internally.
Settled rule on warning on unimplemented property in
category implementation when some implementations
are missing in the primary class implementation.
(fixes radar 6505200).
Improve performance of warning when not implementing a required
property of a protocol (my previous patch). No change in functionality.
(radar 7544809).
Daniel Dunbar [Wed, 20 Jan 2010 06:09:53 +0000 (06:09 +0000)]
Fix an invalid Twine use spotty by abbeyj, it isn't safe to use Twine
temporaries (this is one reason I'm nervous about propagating their use beyond
particularly performance critical places).
Chandler Carruth [Wed, 20 Jan 2010 03:59:11 +0000 (03:59 +0000)]
Fix a layering issue between Basic and FE by moving a utility class into Basic.
This isn't entirely satisfactory, as it seems an implementation detail, and
with nothing to do with TargetInfo. Suggestions on where to put this are
welcome.
John McCall [Wed, 20 Jan 2010 00:46:10 +0000 (00:46 +0000)]
Give UnresolvedSet the ability to store access specifiers for each declaration.
Change LookupResult to use UnresolvedSet. Also extract UnresolvedSet into its
own header and make it templated over an inline capacity.
Douglas Gregor [Wed, 20 Jan 2010 00:26:57 +0000 (00:26 +0000)]
Kill off clang_getDeclColumn, clang_getDeclExtent, clang_getDeclLine,
clang_getDeclSource, and clang_getDeclSourceFile; the cursor
equivalents are the way of the future.
Douglas Gregor [Wed, 20 Jan 2010 00:23:15 +0000 (00:23 +0000)]
Introduce a special cursor kind for the translation unit, to serve as
the root of the conceptual cursor hierarchy (just like we do with
declarations). This will be used when we get to unify
clang_loadTranslationUnit() and clang_loadDeclaration() into something
more generally useful.
Douglas Gregor [Tue, 19 Jan 2010 23:25:01 +0000 (23:25 +0000)]
Kill CXCursor_ObjCSelectorRef, CXCursor_VarRef, CXCursor_FunctionRef,
and CXCursor_EnumConstantRef; they've been subsumed by expression
references, which do a much nicer job.
Douglas Gregor [Tue, 19 Jan 2010 23:20:36 +0000 (23:20 +0000)]
Extend the CIndex API with direct support for expressions and
statements, moving some of the more unnatural kinds of references
(VarRef, EnumConstantRef, etc.) over to the expressions. We can now
poke at arbitrary expressions and statements with, e.g.,
clang_getCursor() and get back useful information (e.g., source
ranges).