Douglas Gregor [Tue, 10 Mar 2009 21:58:27 +0000 (21:58 +0000)]
Partial fix for PR3310, concerning type-checking for tentative
definitions. We were rejecting tentative definitions of incomplete
(which is bad), and now we don't.
This fix is partial because we don't do the end-of-translation-unit
initialization for tentative definitions that don't ever have any
initializers specified.
Douglas Gregor [Tue, 10 Mar 2009 20:44:00 +0000 (20:44 +0000)]
Extend the notion of active template instantiations to include the
context of a template-id for which we need to instantiate default
template arguments.
In the TextDiagnosticPrinter, don't suppress the caret diagnostic if
we are producing a non-note diagnostic that follows a note diagnostic
with the same location, because notes are (conceptually) a part of the
warning or error that comes before them.
Douglas Gregor [Tue, 10 Mar 2009 18:03:33 +0000 (18:03 +0000)]
Add a notion of "post-diagnostic hooks", which are callbacks attached
to a diagnostic that will be invoked after the diagnostic (if it is
not suppressed). The hooks are allowed to produce additional
diagnostics (typically notes) that provide more information. We should
be able to use this to help diagnostic clients link notes back to the
diagnostic they clarify. Comments welcome; I'll write up documentation
and convert other clients (e.g., overload resolution failures) if
there are no screams of protest.
As the first client of post-diagnostic hooks, we now produce a
template instantiation backtrace when a failure occurs during template
instantiation. There's still more work to do to make this output
pretty, if that's even possible.
Chris Lattner [Tue, 10 Mar 2009 06:42:37 +0000 (06:42 +0000)]
Fix PR3682 by just disabling a broken assertion. This check should be
done in sema, and is reflected by the existing PR3258. In the meantime,
fix PR3682 by disabling a bogus assertion (which doesn't account for +
operands).
Chris Lattner [Tue, 10 Mar 2009 06:33:24 +0000 (06:33 +0000)]
move matching of named operands into AsmStmt class. At the same
time handle + operands in operand counting, fixing asm.c:t7 to
expand into $2 instead of $1.
Chris Lattner [Tue, 10 Mar 2009 05:39:21 +0000 (05:39 +0000)]
Expand %= into ${:uid} so that the code generator emits a unique ID for the
asm. This allows us to properly handle the case when an optimizer duplicates
the asm, such as here:
void bar() {
int i;
for (i = 0; i < 3; ++i)
asm("foo %=" : : "r"(0));
}
we now produce:
_bar:
xorl %eax, %eax
## InlineAsm Start
foo 0
## InlineAsm End
## InlineAsm Start
foo 1
## InlineAsm End
## InlineAsm Start
foo 2
## InlineAsm End
ret
instead of:
_bar:
xorl %eax, %eax
## InlineAsm Start
foo 1
## InlineAsm End
## InlineAsm Start
foo 1
## InlineAsm End
## InlineAsm Start
foo 1
## InlineAsm End
ret
Ted Kremenek [Tue, 10 Mar 2009 05:16:17 +0000 (05:16 +0000)]
BugReporter:
- Group control flow and event PathDiagnosticPieces into PathDiagnosticMacroPieces.
- Afterwards, eliminate any PathDiagnosticMacroPieces from a PathDiagnostic that
contain no informative events.
HTMLDiagnostics:
- Use new information about PathDiagnosticMacroPieces to specially format
message bubbles for macro expansions containing interesting events.
Douglas Gregor [Tue, 10 Mar 2009 00:06:19 +0000 (00:06 +0000)]
Limit the template instantiation depth to some user-configurable value
(default: 99). Beyond this limit, produce an error and consider the
current template instantiation a failure.
The stack we're building to track the instantiations will, eventually,
be used to produce instantiation backtraces from diagnostics within
template instantiation. However, we're not quite there yet.
This adds a new Clang driver option -ftemplate-depth=NNN, which should
eventually be generated from the GCC command-line operation
-ftemplate-depth-NNN (note the '-' rather than the '='!). I did not
make the driver changes to do this mapping.
Daniel Dunbar [Mon, 9 Mar 2009 23:53:08 +0000 (23:53 +0000)]
Backout r66408, we don't want handling of globals to rely on the
module symbol table. The root problem inspiring this was fixed in
r66316 (and again in r66506).
Douglas Gregor [Mon, 9 Mar 2009 23:48:35 +0000 (23:48 +0000)]
Implement template instantiation for ClassTemplateSpecializationTypes,
such as replacing 'T' in vector<T>. There are a few aspects to this:
- Extend TemplateArgument to allow arbitrary expressions (an
Expr*), and switch ClassTemplateSpecializationType to store
TemplateArguments rather than it's own type-or-expression
representation.
- ClassTemplateSpecializationType can now store dependent types. In
that case, the canonical type is another
ClassTemplateSpecializationType (with default template arguments
expanded) rather than a declaration (we don't build Decls for
dependent types).
- Split ActOnClassTemplateId into ActOnClassTemplateId (called from
the parser) and CheckClassTemplateId (called from
ActOnClassTemplateId and InstantiateType). They're smart enough to
handle dependent types, now.
Chris Lattner [Mon, 9 Mar 2009 21:19:16 +0000 (21:19 +0000)]
Fix PR3766, a really nasty silent miscompilation case where we emitted
a warning and then threw away the AST. While I'm in there, tighten up the
code to actually reject completely bogus cases (sending a message to a
struct). We still allow sending a message to an int, which doesn't make
sense but GCC allows it and is easy to support.
Ted Kremenek [Mon, 9 Mar 2009 20:35:15 +0000 (20:35 +0000)]
Teach GRSimpleVals::EvalNE and GRSimplVals::EvalEQ about TypedRegionViews and
SymbolicRegions. This fixes a serious regression when checking symbolic pointers
against null.
Ted Kremenek [Mon, 9 Mar 2009 20:28:08 +0000 (20:28 +0000)]
Add member template "MemRegion::getAs<RegionType>" that dynamically casts a
given MemRegion object to a target region type. This differs from dyn_cast<> in
that it also ignores TypedViewRegions.
Daniel Dunbar [Mon, 9 Mar 2009 20:09:19 +0000 (20:09 +0000)]
NeXT: Add CreateMetadataVar utility method to encapsulate creation of
Obj-C metadata variables (which generally should be handled the same,
although they aren't currently).
- No functionality change.
Chris Lattner [Sun, 8 Mar 2009 08:16:41 +0000 (08:16 +0000)]
add \n characters to the scratch buffer *before* returned tokens.
This prevents caret diagnostics from the scratch buffer from
including other tokens in the scratch buffer that occurred beforei
them.
Chris Lattner [Sun, 8 Mar 2009 08:11:22 +0000 (08:11 +0000)]
generalize the "end of line" checking logic to stop at any \0 at the
end of line instead of just the end of buffer. Scratch buffers contain
embedded \0's between tokens which are logic line separators. If a
normal text buffer contains \0's, it doesn't make a lot of sense to include
them in the caret diag output anyway.
Chris Lattner [Sun, 8 Mar 2009 08:08:45 +0000 (08:08 +0000)]
simplify some logic by making ScratchBuffer handle the application of trailing
\0's to created tokens instead of making all clients do it. No functionality
change.
Chris Lattner [Sun, 8 Mar 2009 07:26:58 +0000 (07:26 +0000)]
Update DeclNodes.def to reflect the move of ObjCCategoryImpl
from being a NamedDecl to being and ObjCImplDecl. This fixes
some valgrind issues where ObjCCategoryImpl's were being cast
to NamedDecl and then stuck on name lookup datastructures.
Chris Lattner [Sun, 8 Mar 2009 06:51:10 +0000 (06:51 +0000)]
refine the "use of unary operator that may be intended as compound assignment (+=)"
warning to only trigger when there is whitespace or something else after the + as
suggested by Eli.
Eli Friedman [Sat, 7 Mar 2009 20:17:55 +0000 (20:17 +0000)]
Make constant emission for @encode use the common string emission code.
This is a bit cleaner, and also "fixes" bad code that compares the
addresses of the string constants.