John McCall [Wed, 24 Mar 2010 05:22:00 +0000 (05:22 +0000)]
Implement a framework for the delay of arbitrary diagnostics within
templates. So delay access-control diagnostics when (for example) the target
of a friend declaration is a specific specialization of a template.
I was surprised to find that this was required for an access-controlled selfhost.
Douglas Gregor [Wed, 24 Mar 2010 05:07:21 +0000 (05:07 +0000)]
When performing name lookup for the allocation or deallocation
operators, make sure that the implicitly-declared global new and
delete operators are always available. Fixes PR5904.
Douglas Gregor [Wed, 24 Mar 2010 00:46:35 +0000 (00:46 +0000)]
Make sure to properly track the anonymous namespace that lives inside
each namespace, even when the outer namespace has multiple
definitions. As part of this, collapsed two pointers worth of storage
(original namespace and inner anonymous namespace) into a single
pointer with a distinguishing bit, since the two are mutually
exclusive, saving a pointer per NamespaceDecl. Fixes PR6620.
Douglas Gregor [Tue, 23 Mar 2010 23:47:56 +0000 (23:47 +0000)]
Implement computation of the final overriders for each virtual
function within a class hierarchy (C++ [class.virtual]p2).
We use the final-overrider computation to determine when a particular
class is ill-formed because it has multiple final overriders for a
given virtual function (e.g., because two virtual functions override
the same virtual function in the same virtual base class). Fixes
PR5973.
We also use the final-overrider computation to determine which virtual
member functions are pure when determining whether a class is
abstract or diagnosing the improper use of an abstract class. The
prior approach to determining whether there were any pure virtual
functions in a class didn't cope with virtual base class subobjects
properly, and could not easily be fixed to deal with the oddities of
subobject hiding. Fixes PR6631.
Douglas Gregor [Tue, 23 Mar 2010 15:26:55 +0000 (15:26 +0000)]
When recovering from a qualified typedef name, don't clear out the
DeclContext because we don't want a NULL DeclContext. Instead, use the
current context.
Daniel Dunbar [Tue, 23 Mar 2010 05:09:16 +0000 (05:09 +0000)]
Frontend: Don't free the CompilerInstance or FrontendActions when running under
-disable-free. Among other things, this fixes freeing of the LLVM module on
exit.
- Note that this means we are disable-free'ing of a lot more stuff than we used to -- this should flush out bugs in anything left that is trying to do real work in its destructor. I did a mini-audit but '::~' is not totally uncommon.
Zhongxing Xu [Tue, 23 Mar 2010 05:05:02 +0000 (05:05 +0000)]
Since we now may have basicblocks with the same block is in different function,
change the block counter map from unsigned -> unsigned to
<StackFrameContext*, unsigned> -> unsigned.
Rafael Espindola [Mon, 22 Mar 2010 23:12:48 +0000 (23:12 +0000)]
A fixed version of r99174 which also includes a test that we emit vtables when
we see an specialization definition ever if we then see a extern template declaration.
More clean up of ivars which are either in class extensions and
implementation or synthesized into an implementation. Also,
fixes a code gen. bug when ivars are itroduced in interleaved
implementations. (related to radar 7547942).
Douglas Gregor [Mon, 22 Mar 2010 15:53:50 +0000 (15:53 +0000)]
Use the cursor's ASTContext rather than the ASTContext computed from a
declaration, just in case invalid code makes the latter
incorrect. This may be the cause behind <rdar://problem/7777070>.
Douglas Gregor [Mon, 22 Mar 2010 15:10:57 +0000 (15:10 +0000)]
Introduce the notion of a single "delayed" diagnostic into the
Diagnostic subsystem, which is used in the rare case where we find a
serious problem (i.e., an inconsistency in the file system) while
we're busy formatting another diagnostic. In this case, the delayed
diagnostic will be emitted after we're done with the other
diagnostic. This is only to be used for fatal conditions detected at
very inconvenient times, where we can neither stop the current
diagnostic in flight nor can we suppress the second error.
Rafael Espindola [Mon, 22 Mar 2010 14:43:41 +0000 (14:43 +0000)]
When handling a TSK_ExplicitInstantiationDefinition after a
TSK_ExplicitInstantiationDeclaration make sure we call
MaybeMarkVirtualMembersReferenced with a method attached to the definition.
Remove the hack that forced vtable emition with declarations.
John McCall [Mon, 22 Mar 2010 09:20:08 +0000 (09:20 +0000)]
-Wshadow should only warn about parameter declarations when we're
entering a function or block definition, not on every single declaration.
Unfortunately we don't have previous-lookup results around when it's time
to make this decision, so we have to redo the lookup. The alternative is
to use delayed diagnostics.
Douglas Gregor [Sun, 21 Mar 2010 22:49:54 +0000 (22:49 +0000)]
Keep track of the size/modification time of each file source-location
entry in a precompiled header, so that we can detect modified files
even when we miss in the stat cache.
Rafael Espindola [Sun, 21 Mar 2010 17:11:05 +0000 (17:11 +0000)]
Fix PR6648 by not creating a temporary with the type of a
CXXExprWithTemporaries.
Not emitting the expression as an aggregate might be the right thing to do,
but is orthogonal. Emitting it as an scalar expression will still try to
create a temporary for the incomplete type of the CXXExprWithTemporaries and
fail.
Daniel Dunbar [Sat, 20 Mar 2010 21:13:08 +0000 (21:13 +0000)]
tests: Mangle '-vg' onto the end of the triple when running under valgrind, so
we can use the standard XFAIL and XTARGET to conditional tests based on
valgrind.
Ted Kremenek [Sat, 20 Mar 2010 21:06:02 +0000 (21:06 +0000)]
Refactor CFG-based warnings in Sema to be run by a worked object called AnalysisBasedWarnings.
This object controls when the warnings are executed, allowing the client code
in Sema to selectively disable warnings as needed.
Centralizing the logic for analysis-based warnings allows us to optimize
when and how they are run.
Along the way, remove the redundant logic for the 'check fall-through' warning
for blocks; now the same logic is used for both blocks and functions.
Ted Kremenek [Sat, 20 Mar 2010 15:45:06 +0000 (15:45 +0000)]
Fix use-of-invalid-memory found by Valgrind and Windows buildbots.
We were inserting a value into a std::vector<> while iterating over
it, which could cause the underlying memory to get deallocated
and reallocated. While not the best solution, use an llvm::ImmutableList
for now as it is safely supports insertions during iteration.
Daniel Dunbar [Sat, 20 Mar 2010 07:04:11 +0000 (07:04 +0000)]
IRgen: Wrap atomic intrinsics with memory barriers, to ensure we honor the semantics.
- This should be conservatively correct, we eventually should have target hooks for platforms that are less strict.
Daniel Dunbar [Sat, 20 Mar 2010 05:53:45 +0000 (05:53 +0000)]
Evaluate: Fix a subtle bug in the pointer evaluator in which we would do an
expression computation in the wrong bit-width, and end up generating a totally
bogus array reference (_g0+8589934546).
- This showed up on Prolangs/cdecl.
Daniel Dunbar [Sat, 20 Mar 2010 04:28:39 +0000 (04:28 +0000)]
Revert r99024, "Augment path diagnostics to include displaying when a message
expression", statistical evidence indicates it has some kind of memory error.