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.
Ted Kremenek [Sat, 16 Jan 2010 02:02:09 +0000 (02:02 +0000)]
Remove 'default' case in switch statement in clang_getCursorKindSpelling(). This identified a missing case (warned by the compiler) and identified that CXCursor_FirstDecl didn't actually correspond to the first decl.
Ted Kremenek [Sat, 16 Jan 2010 01:44:12 +0000 (01:44 +0000)]
Remove TranslateKind and centralize Decl -> CXCursorKind in GetCursorKind(). This revealed a bunch of inconsistencies in how CXCursorKinds were being computed.
Douglas Gregor [Fri, 15 Jan 2010 19:40:17 +0000 (19:40 +0000)]
Add -cursor-at=file:line:column command line option to c-index-test,
to directly check the results of clang_getCursor(). Also, start
migrating some index-test tests over to c-index test [*] and some
grep-using tests over to FileCheck.
Douglas Gregor [Fri, 15 Jan 2010 16:21:02 +0000 (16:21 +0000)]
When determining whether a DeclRefExpr is value-dependent when it
references a const variable of integral type, the initializer may be
in a different declaration than the one that name-lookup saw. Find the
initializer anyway. Fixes PR6045.
Ken Dyck [Fri, 15 Jan 2010 12:37:54 +0000 (12:37 +0000)]
Convert the type of the LValue offset variable in APValue to CharUnits, moving
the LValue-related methods of APValue out of line to avoid header file leaching.
John McCall [Fri, 15 Jan 2010 08:34:02 +0000 (08:34 +0000)]
Don't repeat lookup when instantiating resolved member expressions.
Adjust BuildMemberReferenceExpr to perform the inheritance check on implicit
member accesses, which can arise from unqualified lookups and therefore may
reference decls from enclosing class scopes.
Ted Kremenek [Fri, 15 Jan 2010 07:56:51 +0000 (07:56 +0000)]
Teach BugReporter to "escape" the occurance of '%' characters in diagnostic messages when emitted results to the standard Diagnostics output. Fixes PR 6033.
Douglas Gregor [Fri, 15 Jan 2010 01:44:47 +0000 (01:44 +0000)]
When performing qualified name lookup into the current instantiation,
do not look into base classes if there are any dependent base
classes. Instead, note in the lookup result that we couldn't look into
any dependent bases. Use that new result kind to detect when this case
occurs, so that we can fall back to treating the type/value/etc. as a
member of an unknown specialization.
Fixes an issue where we were resolving lookup at template definition
time and then missing an ambiguity at template instantiation time.
John McCall [Thu, 14 Jan 2010 20:11:39 +0000 (20:11 +0000)]
Pre-emptive bugfixes in the diagnostics code: allow arbitrary punctuation
characters to be escaped and implement a scan-forward function which
properly respects brace nesting.
Douglas Gregor [Thu, 14 Jan 2010 17:47:39 +0000 (17:47 +0000)]
When qualified lookup into the current instantiation fails (because it
finds nothing), and the current instantiation has dependent base
classes, treat the qualified lookup as if it referred to an unknown
specialization. Fixes PR6031.
Douglas Gregor [Thu, 14 Jan 2010 15:47:35 +0000 (15:47 +0000)]
Switch the remaining code completions over to LookupVisibleDecls,
after adding the ability to determine whether our lookup is a
base-class lookup. Eliminate CollectMemberLookupResults, since it is
no longer used (yay).
David Chisnall [Thu, 14 Jan 2010 14:08:19 +0000 (14:08 +0000)]
Made ObjC method name mangling match GCC (which does it in a stupid and broken way that can give conflicts on method names containing underscores, but is needed for gdb to work because gdb does not know how to read ObjC class tables and relies on the mangling).
John McCall [Thu, 14 Jan 2010 03:28:57 +0000 (03:28 +0000)]
Improve overload diagnostics some more by calling out qualifier mismatches
for special diagnostics. Unfortunately, the non-overload diagnostics are not
this good.
Douglas Gregor [Thu, 14 Jan 2010 03:21:49 +0000 (03:21 +0000)]
Simplify the code-completion logic for nested-name-specifiers: rather
than traversing visible declarations twice, only perform one traversal
and recognize nested-name-specifiers as special.
Mike Stump [Thu, 14 Jan 2010 02:26:52 +0000 (02:26 +0000)]
Avoid snowballing errors into additional warnings. To do better, we'd
need an error term for the CFG. I suspect we'll always have to cope
with getCFG returning 0, though, I'd love to see even that possibility
removed.
Douglas Gregor [Thu, 14 Jan 2010 01:17:14 +0000 (01:17 +0000)]
When providing completions for a member access expression in C++,
provided nested-name-specifier results for base classes (only), rather
than everything that could possibly be a nested-name-specifier.
Douglas Gregor [Thu, 14 Jan 2010 01:09:38 +0000 (01:09 +0000)]
Switch code-completion for ordinary names over to the new(ish)
LookupVisibleDecls, unifying the name lookup mechanisms used by code
completion and typo correction. Aside from the software-engineering
improvements, this makes code-completion see through using directives
and see ivars when performing unqualified name lookup in an
Objective-C instance method.
John McCall [Thu, 14 Jan 2010 00:50:32 +0000 (00:50 +0000)]
Add the %ordinal format modifier for turning '1' into '1st'. Hard-coded for
English right now; would not be impossible to grab a special format string
from the diagnostic pool and localize that way.
Devang Patel [Thu, 14 Jan 2010 00:48:09 +0000 (00:48 +0000)]
Because CurLoc is the current source location as far as CGDebugInfo is concerned. It is expected that this is set (usually left bracket location of function body compound statement) before EmitfunctionStart() is used.