Chris Lattner [Sun, 23 Nov 2008 22:46:27 +0000 (22:46 +0000)]
make some objc redefinition warnings more consistent: call definitions
"definitions", not declarations. Point out the location of the
original definition.
Chris Lattner [Sun, 23 Nov 2008 22:38:38 +0000 (22:38 +0000)]
Tweak duplicate category diagnostic to work like the duplicate protocol diagnostic.
Also, point out where the previous decl was. This unxfails two tests.
Chris Lattner [Sun, 23 Nov 2008 21:45:46 +0000 (21:45 +0000)]
Convert IdentifierInfo's to be printed the same as DeclarationNames
with implicit quotes around them. This has a bunch of follow-on
effects and requires tweaking to a whole lot of code. This causes
a regression in two tests (xfailed) by causing it to emit things like:
Line 10: duplicate interface declaration for category 'MyClass1' ('Category1')
instead of:
Line 10: duplicate interface declaration for category 'MyClass1(Category1)'
I will fix this in a follow-up commit.
As part of this, I had to start switching stuff to use ->getDeclName() instead
of Decl::getName() for consistency. This is good, but I was planning to do this
as an independent patch. There will be several follow-on patches
to clean up some of the mess, but this patch is already too big.
Chris Lattner [Sun, 23 Nov 2008 20:28:15 +0000 (20:28 +0000)]
add support for inserting a DeclarationName into a diagnostic directly
without calling getAsString(). This implicitly puts quotes around the
name, so diagnostics need to be tweaked to accommodate this.
Chris Lattner [Sun, 23 Nov 2008 09:13:29 +0000 (09:13 +0000)]
Add support for sending QualType's directly into diags and convert two
diags over to use this. QualTypes implicitly print single quotes around
them for uniformity and future extension.
Doing this requires a little function pointer dance to prevent libbasic
from depending on libast.
Chris Lattner [Sun, 23 Nov 2008 00:42:53 +0000 (00:42 +0000)]
finish up the diagnostics documentation. We don't
support QualType and DeclarationName yet, so some of it
is lies, however, this will be fixed shortly.
New AST node to access "implicit" setter/getter using property dor syntax.
Issuing diagnostics when assigning to read-only properties.
This is work in progress.
Chris Lattner [Sat, 22 Nov 2008 08:28:49 +0000 (08:28 +0000)]
move the Diag method for Sema to be inline. This shrinks the release-asserts
clang executable (when built with gcc 4.2 on the mac) from 14519740 to 14495028 bytes. This shrinks individual object files as well: SemaChecking
from 23580->22248, SemaDeclObjc from 61368->57376, SemaExpr from
115628->110516, as well as several others.
Chris Lattner [Sat, 22 Nov 2008 07:39:03 +0000 (07:39 +0000)]
Fix a weird inconsistency with hex floats. Previously the lexer
would not eat the "-1" in "0x0p-1", but LiteralSupport would accept
it when extensions are on. This caused strangeness and failures
when hexfloats were properly treated as an extension (not error)
in LiteralSupport.
Chris Lattner [Sat, 22 Nov 2008 07:23:31 +0000 (07:23 +0000)]
remove the NumericLiteralParser::Diag helper method, inlining it into
its call sites. This makes it more explicit when the hasError flag is
getting set and removes a confusing difference in behavior between
PP.Diag and Diag in this code.
Chris Lattner [Sat, 22 Nov 2008 07:03:46 +0000 (07:03 +0000)]
Move the Preprocessor::Diag methods inline. This has the interesting
(and carefully calculated) effect of allowing the compiler to reason
about the aliasing properties of DiagnosticBuilder object better,
allowing the whole thing to be promoted to registers instead of
resulting in a ton of stack traffic.
While I'm not very concerned about the performance of the Diag() method
invocations, I *am* more concerned about their code size and impact on the
non-diagnostic code. This patch shrinks the clang executable (in
release-asserts mode with gcc-4.2) from 14523980 to 14519816 bytes. This
isn't much, but it shrinks the lexer from 38192 to 37776, PPDirectives.o
from 31116 to 28868 bytes, etc.
Chris Lattner [Sat, 22 Nov 2008 02:02:22 +0000 (02:02 +0000)]
Change the Lexer::Diag method to not magically silence warnings,
force the caller to check instead. This eliminates the need (and the
risk!) of weird null DiagnosticBuilder's floating around.
Chris Lattner [Sat, 22 Nov 2008 00:59:29 +0000 (00:59 +0000)]
Split the DiagnosticInfo class into two disjoint classes:
one for building up the diagnostic that is in flight (DiagnosticBuilder)
and one for pulling structured information out of the diagnostic when
formatting and presenting it.
Sebastian Redl [Fri, 21 Nov 2008 19:14:01 +0000 (19:14 +0000)]
Implementation of new and delete parsing and sema.
This version uses VLAs to represent arrays. I'll try an alternative way next, but I want this safe first.
Chris Lattner [Fri, 21 Nov 2008 07:50:02 +0000 (07:50 +0000)]
Add the concept of "modifiers" to the clang diagnostic format
strings. This allows us to have considerable flexibility in how
these things are displayed and provides extra information that
allows us to merge away diagnostics that are very similar.
Diagnostic modifiers are a string of characters with the regex
[-a-z]+ that occur between the % and digit. They may
optionally have an argument that can parameterize them.
For now, I've added two example modifiers. One is a very useful
tool that allows you to factor commonality across diagnostics
that need single words or phrases combined. Basically you can
use %select{a|b|c}4 with with an integer argument that selects
either a/b/c based on an integer value in the range [0..3).
The second modifier is also an integer modifier, aimed to help
English diagnostics handle plurality. "%s3" prints to 's' if
integer argument #3 is not 1, otherwise it prints to nothing.
I'm fully aware that 's' is an English concept and doesn't
apply to all situations (mouse vs mice). However, this is very
useful and we can add other crazy modifiers once we add support
for polish! ;-)
I converted a couple C++ diagnostics over to use this as an
example, I'd appreciate it if others could merge the other
likely candiates. If you have other modifiers that you want,
lets talk on cfe-dev.
Chris Lattner [Fri, 21 Nov 2008 06:59:12 +0000 (06:59 +0000)]
move the diagnostic location and ID out of DiagnosticInfo and store it in
the Diagnostic class. Since we can already only have one diagnostic in
flight at a time, this shrinks DiagnosticInfo.
This reduces DiagnosticInfo to being basically a rather crazy smart pointer
to a DiagnosticInfo :)
Chris Lattner [Fri, 21 Nov 2008 06:54:20 +0000 (06:54 +0000)]
move diagnostic insertion methods to be free methods instead of
in the DiagnosticInfo class. This requires marking them as taking
a const DiagnosticInfo, which is bogus (they logically mutate DI),
but works with the C++ type system.
Chris Lattner [Fri, 21 Nov 2008 01:18:36 +0000 (01:18 +0000)]
Change -verify mode to find the "expected-error" and "expected-warning" strings
with a raw lexer instead of a PP lexer. This means that -verify doesn't scan
#include'd headers for expected-error/warning strings, and it also means that it
doesn't ignore them in #if 0.
Ted Kremenek [Fri, 21 Nov 2008 00:58:35 +0000 (00:58 +0000)]
PTHLexer:
- Move out logic for handling the end-of-file to LexEndOfFile (to match the Lexer) class. The logic now mirrors the Lexer class more, which allows us to pass most of the Preprocessor test cases.
Ted Kremenek [Thu, 20 Nov 2008 16:32:22 +0000 (16:32 +0000)]
PTHLexer:
- Rename 'CurToken' and 'LastToken' to 'CurTokenIdx' and 'LastTokenIdx'
respectively.
- Add helper methods GetToken(), AdvanceToken(), AtLastToken() to abstract away
details of the token stream. This also allows us to easily replace their
implementation later.
Ted Kremenek [Thu, 20 Nov 2008 16:14:48 +0000 (16:14 +0000)]
Output 'ANALYZE' messages to standard error. This should address the intermixing of 'ANALYZE' and the other diagnostics the clang driver emits to standard error.