Douglas Gregor [Thu, 8 Apr 2010 15:52:03 +0000 (15:52 +0000)]
Eliminate excessive PCH deserialization caused by the search for
__cxxabiv1::__fundamental_type_info in every translation
unit. Previously, we would perform name lookup for
__cxxabiv1::__fundamental_type_info at the end of IRGen for a each
translation unit, to determine whether it was present. If so, we we
produce type information for all of the fundamental types. However,
this name lookup causes PCH deserialization of a significant part of the
translation unit, which has a woeful impact on performance.
With this change, we now look at each record type after we've
generated its vtable to see if it is
__cxxabiv1::__fundamental_type_info. If so, we generate type info for
all of the fundamental types. This works because
__cxxabiv1::__fundamental_type_info should always have a key function
(typically the virtual destructor), that will be defined once in the
support library. The fundamental type information will end up there.
Daniel Dunbar [Thu, 8 Apr 2010 02:59:45 +0000 (02:59 +0000)]
IRgen: Move the bit-field access type into CGBitFieldInfo, and change bit-field LValues to just store the base address of object containing the bit-field.
When a template (without arguments) is passed as a template type
parameter, explicitly ask the user to give it arguments. We used to
complain that it wasn't a type and expect the user to figure it out.
Sean Hunt [Wed, 7 Apr 2010 23:11:06 +0000 (23:11 +0000)]
Implement checking for template literal operator functions. This
code won't actually get used yet because we don't handle non-type
parameter packs, but when we do, this code should jump in and work.
Chris Lattner [Wed, 7 Apr 2010 20:49:23 +0000 (20:49 +0000)]
add a new driver-level -ferror-limit=412 option, which causes clang to stop
emitting diagnostics after it has produced that many errors. Give this a
default value of 20 which produces plenty of errors for people to fix before
recompiling but not so many that their entire console scrolls away when the
compiler gets confused. The experience looks like this:
$ clang foo.c
<tons of crap>
foo.c:102:3: error: unknown type name 'somethingbad'
somethingbad x;
^
fatal error: too many errors emitted, stopping now
36 warnings and 20 errors generated.
Douglas Gregor [Wed, 7 Apr 2010 20:29:57 +0000 (20:29 +0000)]
Return early from Sema::MarkDeclarationReferenced when we know there
isn't any extra work to perform. Also, don't check for unused
parameters when the warnings will be suppressed anyway. Improves
performance of -fsyntax-only on 403.gcc's combine.c by ~2.5%.
<rdar://problem/7836787>
Douglas Gregor [Wed, 7 Apr 2010 17:57:12 +0000 (17:57 +0000)]
Improve handling of friend types in several ways:
- When instantiating a friend type template, perform semantic
analysis on the resulting type.
- Downgrade the errors concerning friend type declarations that do
not refer to classes to ExtWarns in C++98/03. C++0x allows
practically any type to be befriended, and ignores the friend
declaration if the type is not a class.
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.