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.
Eli Friedman [Sat, 7 Mar 2009 07:01:10 +0000 (07:01 +0000)]
Don't discard increment/decrement on function pointers. It's kind of
difficult to come up with a testcase because the code generation for this
construct is broken.
Mike Stump [Sat, 7 Mar 2009 06:16:52 +0000 (06:16 +0000)]
Remove last FIXME for block literal codegen that I know about and turn
on all the new code by default. There is still plenty of testing to
do and issues I'm sure need resolving. Let me know if you find
anything.
Eli Friedman [Sat, 7 Mar 2009 03:57:15 +0000 (03:57 +0000)]
Back out the patch in r66302, and re-fix it properly. We assume for
performance that the type of the returned llvm::Value for an expression
matches the converted type of the clang::Expr; mismatches will cause all
sorts of errors and silent miscompilations.
Daniel Dunbar [Sat, 7 Mar 2009 01:42:16 +0000 (01:42 +0000)]
Cleanup/comment IdentifierInfo::get.
- Shaves off a few instructions on x86_64.
One notable change: this intentionally stops setting the II->Entry
field of IdentifierInfo's retrieved by the ExternalLookup method. This
is to maintain the invariant that .getName() has a constant value for
any given IdentifierInfo. IRgen currently relies on this; which is
quite questionable but will be cleaned up in time.
Apologies for the lack of a test case; there really isn't a good way
to make one. As IRgen will eventually be fixed to not rely on this, we
can survive without one.
Ted Kremenek [Sat, 7 Mar 2009 01:22:02 +0000 (01:22 +0000)]
Selector: (changes made after discussing this more with Steve Naroff)
- Make Selector::getAsIdentifierInfo() private. Using IdentifierInfo* in
Selector is an implementation detail that clients shouldn't think about.
- Modify diagnostic emission in Sema::ProcessPropertyDecl to not use
Selector::getAsIdentifierInfo() (which could crash when IdentifierInfo* is
null) and instead use Selector::getAsString().
- Tidy up Selector::getAsString() implementation.
Ted Kremenek [Fri, 6 Mar 2009 23:58:11 +0000 (23:58 +0000)]
Create PathDiagnosticPiece subclasses PathDiagnosticEventPiece and
PathDiagnosticControlFlowPiece to distinguish (in the class hierarchy) between
events and control-flow diagnostic pieces. Clients must now use these directly
when constructing PathDiagnosticPieces.
Douglas Gregor [Fri, 6 Mar 2009 23:41:27 +0000 (23:41 +0000)]
Downgrade complaints about the use of variable-sized types within a
struct to an extension warning to match the behavior of GNU C, which
addresses the Sema part of PR3671.