Douglas Gregor [Wed, 7 Apr 2010 16:53:43 +0000 (16:53 +0000)]
Split Sema::ActOnFriendTypeDecl into Sema::CheckFriendTypeDecl (for
semantic analysis) and Sema::ActOnFriendTypeDecl (the action
callback). This is a prerequisite for improving template instantiation
of friend type declarations.
Chris Lattner [Wed, 7 Apr 2010 05:46:54 +0000 (05:46 +0000)]
a ridiculous amount of propagation through the backend later,
have the code generate slap a srcloc metadata on inline asm nodes.
This allows us to diagnose invalid inline asms with such nice
diagnostics as:
Douglas Gregor [Wed, 7 Apr 2010 00:21:17 +0000 (00:21 +0000)]
Implement code completion for Objective-C method declarations and
definitions, e.g., after
-
or
- (id)
we'll find all of the "likely" instance methods that one would want to
declare or define at this point. In the latter case, we only produce
results whose return types match "id".
Teach MemRegion::getBaseRegion() about ObjCIvarRegions. We want to treat
them the same way as fields. This fixes a regression in RegionStore::RemoveDeadbindings()
that emerged from going to the cluster-based analysis.
John McCall [Tue, 6 Apr 2010 21:38:20 +0000 (21:38 +0000)]
Implement the protected access restriction ([class.protected]), which requires
that protected members be used on objects of types which derive from the
naming class of the lookup. My first N attempts at this were poorly-founded,
largely because the standard is very badly worded here.
Douglas Gregor [Tue, 6 Apr 2010 20:19:47 +0000 (20:19 +0000)]
When code completion produces an overload set as its results (e.g.,
while we're completing in the middle of a function call), also produce
"ordinary" name results that show what can be typed at that point.
Douglas Gregor [Tue, 6 Apr 2010 20:02:15 +0000 (20:02 +0000)]
Only prove macros as code-completion results when we're in a case
statement or for ordinary names. This means that we won't show macros
when completing, e.g., member expressions such as "p->".
Chris Lattner [Tue, 6 Apr 2010 18:38:50 +0000 (18:38 +0000)]
teach clang to install the inline asm diagnostic handler,
allowing backend errors to be mapped through clang's
diagnostics subsystem, including the backend location info.
Douglas Gregor [Tue, 6 Apr 2010 17:30:22 +0000 (17:30 +0000)]
Make code-completion for Objective-C message sends to "id" work in the
presence of precompiled headers by forcibly loading all of the
methods we know about from the PCH file before constructing our
code-completion list.
Daniel Dunbar [Tue, 6 Apr 2010 17:07:49 +0000 (17:07 +0000)]
Driver: Add a Tool::hasGoodDiagnostics hook, and use it to simplify logic for
deciding when we need to emit an extra "command failed" diagnostic.
- This also fixes the case where we were emitting that extra diagnostics, even
when using clang w/ the integrated assembler, which has good diagnostics.
Douglas Gregor [Tue, 6 Apr 2010 16:40:00 +0000 (16:40 +0000)]
Implement support for code completion of an Objective-C message send to
"id" or an expression of type "id". In these cases, we produce a list
of all of the (class or instance) methods, respectively, that we know about.
Note that this implementation does not yet work well with precompiled
headers; that's coming soon.
Daniel Dunbar [Mon, 5 Apr 2010 21:36:35 +0000 (21:36 +0000)]
IRgen: Move BitField LValues to just hold a reference to the CGBitFieldInfo.
- Unfortunately, this requires some horrible code in CGObjCMac which always
allocats a CGBitFieldInfo because we don't currently build a proper layout
for Objective-C classes. It needs to be cleaned up, but I don't want the
bit-field cleanups to be blocked on that.
Douglas Gregor [Mon, 5 Apr 2010 21:25:31 +0000 (21:25 +0000)]
Extend the type printing policy to allow one to turn off the printing
of file locations for anonymous tag types (e.g., "enum <anonymous at
t.h:15:6>"), which can get rather long.
Douglas Gregor [Mon, 5 Apr 2010 21:10:19 +0000 (21:10 +0000)]
Clarify the ownership semantics of the Diagnostic object used by
ASTUnit. Previously, we would end up with use-after-free errors
because the Diagnostic object would be creating in one place (say,
CIndex) and its ownership would not be transferred into the
ASTUnit. Fixes <rdar://problem/7818608>.
Douglas Gregor [Mon, 5 Apr 2010 18:10:21 +0000 (18:10 +0000)]
Minor ASTUnit cleanups:
- Rename "Diagnostics" and related to "StoredDiagnostics", to better
capture what we're actually storing.
- Move SourceManager and FileManager to the heap.
Douglas Gregor [Mon, 5 Apr 2010 16:10:30 +0000 (16:10 +0000)]
Code completion results that refer to macros now get the cursor kind
of macro definitions when passed to CIndex. Add test for code
completion of macros via CIndex.
Don't produce a vtable for a class if we have an explicit template instantiation declaration and no key function. We will produce the vtable at the explicit template instantiation.
Daniel Dunbar [Fri, 2 Apr 2010 21:14:02 +0000 (21:14 +0000)]
IRgen/Obj-C: Eliminate FindIvarInterface, now that ivar's are in the right DeclContexts (-2 FIXMEs). We still have an annoying linear scan + hidden dependency on how Obj-C layout is done.
- This is also an algorithmic improvement in IRgen for Obj-C, although it probably doesn't matter in practice.
Daniel Dunbar [Fri, 2 Apr 2010 20:10:03 +0000 (20:10 +0000)]
Sema/Obj-C: Narrow type of ObjCIvarDecl::Create, and check additional invariants on the provided DeclContext.
- Doug, please see the FIXME in DeclObjC.cpp -- I am not sure what the right fix is.
Douglas Gregor [Fri, 2 Apr 2010 19:02:06 +0000 (19:02 +0000)]
We seem to get an inconsistent alignment value in the generated
assembly for the global "d7". We were previously testing for alignment
3, which seems to happen for some builders and not for others. I've
eliminated the alignment check and added a FIXME to unbreak the
buildbots.
Douglas Gregor [Fri, 2 Apr 2010 18:24:57 +0000 (18:24 +0000)]
Rework our handling of copy construction of temporaries, which was a
poor (and wrong) approximation of the actual rules governing when to
build a copy and when it can be elided.
The correct implementation is actually simpler than the
approximation. When we only enumerate constructors as part of
initialization (e.g., for direct initialization or when we're copying
from a class type or one of its derived classes), we don't create a
copy. When we enumerate all conversion functions, we do create a
copy. Before, we created some extra copies and missed some
others. The new test copy-initialization.cpp shows a case where we
missed creating a (required, non-elidable) copy as part of a
user-defined conversion, which resulted in a miscompile. This commit
also fixes PR6757, where the missing copy made us reject well-formed
code in the ternary operator.
This commit also cleans up our handling of copy elision in the case
where we create an extra copy of a temporary object, which became
necessary now that we produce the right copies. The code that seeks to
find the temporary object being copied has moved into
Expr::getTemporaryObject(); it used to have two different
not-quite-the-same implementations, one in Sema and one in CodeGen.
Note that we still do not attempt to perform the named return value
optimization, so we miss copy elisions for return values and throw
expressions.
Anders Carlsson [Fri, 2 Apr 2010 06:26:44 +0000 (06:26 +0000)]
If a constructor is a dependent context, just set the base and member initializers as they are written. Fixes a bug where we wouldn't show initialization order warnings when instantiating.
Resolve a layering violation by making AddTaggedVal public for
PartialDiagnostic objects, and hoisting the stream operator for QualType into
Type.h with the operator for the normal DiagnosticBuilder. Also remove the no
longer needed friend declaration for the DeclarationName stream operator.
Douglas Gregor [Thu, 1 Apr 2010 18:32:35 +0000 (18:32 +0000)]
Overhaul checking of non-type template arguments that should refer to
an object or function. Our previous checking was too lax, and ended up
allowing missing or extraneous address-of operators, among other
evils. The new checking provides better diagnostics and adheres more
closely to the standard.