Commit Graph

7668 Commits

Author SHA1 Message Date
Chris Lattner 060068a0ef alphabeticalize.
llvm-svn: 59866
2008-11-22 08:22:53 +00:00
Chris Lattner f3cb394f41 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.

llvm-svn: 59865
2008-11-22 07:39:03 +00:00
Chris Lattner 59acca5874 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.

llvm-svn: 59863
2008-11-22 07:23:31 +00:00
Chris Lattner 1ef2028205 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.

llvm-svn: 59862
2008-11-22 07:03:46 +00:00
Anders Carlsson 4d5f2e532c Add test for PR2992.
llvm-svn: 59861
2008-11-22 06:42:54 +00:00
Chris Lattner fdabe83c67 inline a method into its only two call sites.
llvm-svn: 59860
2008-11-22 06:42:31 +00:00
Chris Lattner 014156e108 actually, this version isn't really needed.
llvm-svn: 59859
2008-11-22 06:22:39 +00:00
Chris Lattner 57dab26be1 remove a sneaky version of Diag hiding in PreprocessorLexer.
llvm-svn: 59858
2008-11-22 06:20:42 +00:00
Anders Carlsson 20e11f8fc8 Use tryEvaluate for constant exprs.
llvm-svn: 59857
2008-11-22 02:34:39 +00:00
Chris Lattner 6d27a16b95 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.

llvm-svn: 59856
2008-11-22 02:02:22 +00:00
Chris Lattner 399f9656ba Teach tentative parsing to handle block pointers (rdar://6394309)
llvm-svn: 59853
2008-11-22 01:15:33 +00:00
Chris Lattner afd8aa9d73 fit in 80 cols
llvm-svn: 59851
2008-11-22 01:04:49 +00:00
Ted Kremenek 25391e7cb7 reverting this because it breaks some blocks cases, I'll send doug a testcase
llvm-svn: 59850
2008-11-22 01:04:48 +00:00
Chris Lattner 427c9c1763 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.

There is no functionality change with this patch.

llvm-svn: 59849
2008-11-22 00:59:29 +00:00
Ted Kremenek a3148f16e4 Fix predicate: we're not in caching mode if CurPPLexer == 0, not CurLexer == 0.
llvm-svn: 59848
2008-11-22 00:41:34 +00:00
Ted Kremenek 6b3ced2b15 In PTHLexer::DiscardToEndOfLine() use Lex() instead of AdvanceToken(). This handles transitions in the preprocessor state.
llvm-svn: 59845
2008-11-21 23:28:56 +00:00
Ted Kremenek 1ad05ce600 Reenable the default lexer.
llvm-svn: 59843
2008-11-21 20:51:59 +00:00
Ted Kremenek b6209858cb When creating the raw tokens for PTHLexer, make sure the token representing the file to include is checked for being an identifier.
llvm-svn: 59842
2008-11-21 20:51:15 +00:00
Ted Kremenek 72d9912b08 When creating raw tokens for the PTHLexer specially handle angled strings for #include directives.
llvm-svn: 59840
2008-11-21 19:41:29 +00:00
Fariborz Jahanian e2caaaa13c Fixed bugzilla bug# 3095 related to code gen. for @synchronized.
llvm-svn: 59838
2008-11-21 19:21:53 +00:00
Sebastian Redl bd150f431e 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.

llvm-svn: 59835
2008-11-21 19:14:01 +00:00
Chris Lattner 841399c95a rearrange some fields.
llvm-svn: 59832
2008-11-21 18:59:21 +00:00
Chris Lattner cedef8d111 merge some simple call diagnostics.
llvm-svn: 59831
2008-11-21 18:44:24 +00:00
Chris Lattner 40bb0c83d4 print a type in a diagnostic.
llvm-svn: 59829
2008-11-21 18:27:34 +00:00
Fariborz Jahanian 735a4158d9 Fields of ivars of struct types are considered ivars
themselves for gc API generation purposes.

llvm-svn: 59828
2008-11-21 18:14:01 +00:00
Douglas Gregor 09075a99e0 Don't turn off blocks in C++
llvm-svn: 59827
2008-11-21 17:10:06 +00:00
Chris Lattner 0f137df0aa reapply the (corrected) patch to use the new llvm intrinsics for memcpy/memmove etc.
llvm-svn: 59824
2008-11-21 16:43:15 +00:00
Douglas Gregor 5d58c3a568 Allow redeclaration of typedefs in C++
llvm-svn: 59822
2008-11-21 16:29:06 +00:00
Chris Lattner b7f4ce3de7 temporarily revert Sangiv's patch.
llvm-svn: 59821
2008-11-21 16:26:37 +00:00
Douglas Gregor 15799fd210 Tiny fix to the parsing of linkage-specifications
llvm-svn: 59820
2008-11-21 16:10:08 +00:00
Douglas Gregor b81897cda6 Fix overloading of non-static member functions that differ in their cv-qualifiers
llvm-svn: 59819
2008-11-21 15:36:28 +00:00
Douglas Gregor 9eb16eadfb Enable some more operator overloading tests, and don't look into an identifier for functions that might not have one
llvm-svn: 59818
2008-11-21 15:30:19 +00:00
Sanjiv Gupta 371298488b mem[cpy,set,move] intrinsics are now overloaded.
llvm-svn: 59806
2008-11-21 07:57:42 +00:00
Chris Lattner c5bab9f35e merge 3 more diagnostics into 1.
llvm-svn: 59805
2008-11-21 07:57:12 +00:00
Chris Lattner 2b78690a9c 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.

llvm-svn: 59803
2008-11-21 07:50:02 +00:00
Chris Lattner 6b0cf14ba4 Change CheckIncrementDecrementOperand to test for common cases first
and fall through better.

llvm-svn: 59799
2008-11-21 07:05:48 +00:00
Chris Lattner 85a94a04f4 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 :)

llvm-svn: 59798
2008-11-21 06:59:12 +00:00
Chris Lattner b11c23da14 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.

llvm-svn: 59797
2008-11-21 06:54:20 +00:00
Chris Lattner adcbb7f85d testcase for PR3096
llvm-svn: 59794
2008-11-21 06:19:48 +00:00
Douglas Gregor 9ecea26443 Cleanup memory management in overloading of operator->, slightly
llvm-svn: 59791
2008-11-21 03:04:22 +00:00
Douglas Gregor 4fc308bd3b Don't print canonical types in overloading-related diagnostics
llvm-svn: 59789
2008-11-21 02:54:28 +00:00
Chris Lattner fd384b1b3a 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.

llvm-svn: 59774
2008-11-21 01:18:36 +00:00
Ted Kremenek 473d76e81d Add comment to IsFileLexer, clean up indentation, and tighten how it's written.
llvm-svn: 59773
2008-11-21 01:07:52 +00:00
Chris Lattner 66c8bebe81 remove expected-error from #if 0 section of code.
llvm-svn: 59772
2008-11-21 01:05:35 +00:00
Chris Lattner 4d7c58f0eb disable expected-errors in #if parts of the test.
llvm-svn: 59771
2008-11-21 01:05:04 +00:00
Chris Lattner 1759ea400e split into two tests.
llvm-svn: 59770
2008-11-21 01:04:13 +00:00
Ted Kremenek 53ab374d9f 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.

llvm-svn: 59768
2008-11-21 00:58:35 +00:00
Fariborz Jahanian c2ad6dc3b4 Consolidated @try and @synchronize into a single
code gen. method.

llvm-svn: 59767
2008-11-21 00:49:24 +00:00
Ted Kremenek dfcbcfe328 Add checker test case: warn about returning an uninitialized value to the caller.
llvm-svn: 59765
2008-11-21 00:28:47 +00:00
Ted Kremenek 0b63f96ab5 - Clean up transfer function logic for 'return' statements.
- Add check for returning an undefined value to a caller.

llvm-svn: 59764
2008-11-21 00:27:44 +00:00