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.
Douglas Gregor [Fri, 6 Mar 2009 22:43:54 +0000 (22:43 +0000)]
Implement GNU C semantics for K&R function definitions that follow a
prototype of the same function, where the promoted parameter types in
the K&R definition are not compatible with the types in the
prototype. Fixes PR2821.
Daniel Dunbar [Fri, 6 Mar 2009 22:13:30 +0000 (22:13 +0000)]
(LLVM svn up) Generalize RuntimeFunctions to RuntimeGlobals and add
CodeGenModule::CreateRuntimeVariable.
- No real functionality change; although we now assert on silly
things like:
--
int objc_exception_throw;
void f0() { @throw(@"A"); }
--
instead of accepting it.
Daniel Dunbar [Fri, 6 Mar 2009 20:45:54 +0000 (20:45 +0000)]
Handle #pragma pack(0). I left this out of diagnostic because users should
really use pack() instead.
- <rdar://problem/6650243> clang warns about '#pragma pack(0)'