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).
Douglas Gregor [Tue, 19 Jan 2010 22:07:56 +0000 (22:07 +0000)]
Introduce the notion of an "unexposed" declaration into the CIndex
API. This is a catch-all for any declaration known to Clang but not
specifically part of the CIndex API. We'll use the same approach with
expressions, statements, references, etc., as needed.
Douglas Gregor [Tue, 19 Jan 2010 21:36:55 +0000 (21:36 +0000)]
Rework the CXSourceLocation and CXSourceRange APIs. They are now
opaque data structures accessed through the new functions
clang_getInstantiationLocation(), clang_getRangeStart(), and
clang_getRangeEnd(). The new API permits later extensions to introduce
new functions to allow CIndex clients to walk macro instantiations, if
we ever care.
Daniel Dunbar [Tue, 19 Jan 2010 21:12:58 +0000 (21:12 +0000)]
Initial cut at integrating compiler-rt (on Darwin) w/ clang build.
- compiler-rt should be checked out into $LLVM_SRC_ROOT/projects/compiler-rt.
- On Darwin, this will automatically build the runtime libraries clang needs
into $OBJROOT/lib/clang/<version>/darwin/...
- The mechanism can easily support other platforms, and can eventually support
multiple platforms once clang has some kind of configure process (for
specifying the desired targets).
Douglas Gregor [Tue, 19 Jan 2010 19:34:47 +0000 (19:34 +0000)]
Eliminate cursor kinds used to express definitions. Instead, provide
CIndex functions that (1) map from a reference or declaration to the
corresponding definition, if available, and (2) determine whether a
given declaration cursor is also a definition. This eliminates a lot
of duplication in the cursor kinds, and maps more closely to the Clang
ASTs.
This is another API + ABI breaker with no deprecation. Yay, progress.
Douglas Gregor [Tue, 19 Jan 2010 16:01:07 +0000 (16:01 +0000)]
Teach Sema::ActOnDependentTemplateName that a dependent template name
in a member access expression referring into the current instantiation
need not be resolved at template definition *if* the current
instantiation has any dependent base classes. Fixes PR6081.
Douglas Gregor [Tue, 19 Jan 2010 06:46:48 +0000 (06:46 +0000)]
In a mem-initializer, a nested-name-specifier followed by an
identifier always names a type. In the case of a dependent
nested-name-specifier, build a TypenameType to describe the dependent
base type. I'd like to move more of this behavior up into the parser,
but this fixes PR6062.
Douglas Gregor [Tue, 19 Jan 2010 00:34:46 +0000 (00:34 +0000)]
Implement clang_getCursorExtent, which provides a source range for the
cursor itself. In particular, for references this returns the source
range of the reference rather than the source range of the thing it
refers to.
Switch c-index-test from clang_getDeclExtent (which will eventually be
deprecated and removed) over to clang_getCursorExtent. The source
ranges we print for references now make sense; fix up the tests
appropriately.
Douglas Gregor [Mon, 18 Jan 2010 22:48:04 +0000 (22:48 +0000)]
Now that a reasonable deprecation cycle has passed, kill
clang_getCursorLine(), clang_getCursorColumn(),
clang_getCursorSource(), and clang_getCursorSourceFile() outright.
Douglas Gregor [Mon, 18 Jan 2010 22:46:11 +0000 (22:46 +0000)]
Introduce clang_getCursorLocation(), which supercedes
clang_getCursorLine(), clang_getCursorColumn(),
clang_getCursorSource(), and clang_getCursorSourceFile(). Mark those 4
functions as deprecated and stop using them ourselves.
Chris Lattner [Mon, 18 Jan 2010 22:35:47 +0000 (22:35 +0000)]
allow the HandlerComment callback to push tokens into the
preprocessor. This could be used by an OpenMP implementation
or something. Patch by Abramo Bagnara!
Douglas Gregor [Mon, 18 Jan 2010 22:13:09 +0000 (22:13 +0000)]
Clean up the CIndex API slightly.
Renamed CXSourceFileLine to CXSourceLocation and added a CXFile, to
better match Clang's SourceLocation. Teach clang_getDeclExtent to fill
in the CXFile properly.
Renamed CXSourceExtent to CXSourceRange, to better match Clang's
SourceLocation.
Ted Kremenek [Mon, 18 Jan 2010 20:23:29 +0000 (20:23 +0000)]
Replace clang_getDeclUSR() with clang_getCursorUSR(). Also remove printing 'contexts' from c-index-test output; it wasn't helpful and was extremely brittle.
Mostly renaming some methods and updating comments to
reflect what these methods are actually doing. One method
template for future work. No change in functionality.
Zhongxing Xu [Mon, 18 Jan 2010 03:27:34 +0000 (03:27 +0000)]
If the symbol has not been tracked, do not free it. This is possible when free
is called on a pointer that does not get its value directly from malloc.
Douglas Gregor [Sat, 16 Jan 2010 22:29:39 +0000 (22:29 +0000)]
Introduce a second queue of "local" pending implicit instantiation,
which are instantiations of the member functions of local
classes. These implicit instantiations have to occur at the same time
as---and in the same local instantiation scope as---the enclosing
function, since the member functions of the local class can refer to
locals within the enclosing function. This should really, really fix PR5764.
Douglas Gregor [Sat, 16 Jan 2010 20:52:59 +0000 (20:52 +0000)]
While determining when to parse inline member functions of a class,
distinguish between nested classes (whose member functions cannot be
parsed until the innermost non-nested class is complete) and local
classes (that are defined within a function but are not necessarily
nested). The upshot of this change, which fixes PR5764, is that the
bodies of member functions of local (non-nested) classes need to be
parsed when the local class is complete (and no later), since they may
refer to function-local static variables, typedefs, enums, etc.
Douglas Gregor [Sat, 16 Jan 2010 20:21:20 +0000 (20:21 +0000)]
When we are instantiating a member function of a local class, be sure
to merge the local instantiation scope with the outer local
instantiation scope, so that we can instantiate declarations from the
function owning the local class. Fixes an assert while instantiating
Boost.MPL's BOOST_MPL_ASSERT_MSG.
Douglas Gregor [Sat, 16 Jan 2010 18:09:52 +0000 (18:09 +0000)]
Partial fix for PR6022, where we were complaining when a friend
function template declared within a class template did not match a
function in another scope. We really need to rework how
friends-in-templates are semantically checked.
Douglas Gregor [Sat, 16 Jan 2010 17:14:40 +0000 (17:14 +0000)]
Give ObjCClassRef cursors a sane representation, which is encapsulated
in CXCursor.cpp. With this sane representation, fix the class
reference that is part of Objective-C category declarations so that
the cursor's location matches up with the reference, not the class
being referred to.
Douglas Gregor [Sat, 16 Jan 2010 16:38:58 +0000 (16:38 +0000)]
Improve location information for Objective-C category declarations. We
previously only had a single location (the @ in @interface); now we
know where the @ is (for the start of the declaration), where the
class name is (that's the normal "location" now for diagnostics), and
where the category name is. Also, eliminated the redundant "end"
location, since ObjCContainerDecl already has better @end information.
The only XFAIL'd test is temporary; will un-XFAIL-it once I've taught
CIndex how to use the new locations.
Douglas Gregor [Sat, 16 Jan 2010 15:44:18 +0000 (15:44 +0000)]
Use a sane encoding for CXCursor_ObjCProtocolRef, using the actual
source locations where the protocols were referenced rather than the
location of some random enclosing declaration.
Douglas Gregor [Sat, 16 Jan 2010 15:02:53 +0000 (15:02 +0000)]
Keep track of the source locations for each protocol reference in
Objective-C classes, protocol definitions, forward protocol
declarations, and categories. This information isn't actually used
yet; that's coming next.