Commit Graph

12196 Commits

Author SHA1 Message Date
Chris Lattner 6840825137 slurp some content from the PTH doc into the user's doc.
llvm-svn: 69569
2009-04-20 04:37:38 +00:00
Chris Lattner f9d8913b80 initial skeleton of a user's manual.
llvm-svn: 69568
2009-04-20 04:23:09 +00:00
Eli Friedman bc633beda4 PR3247: Handle a couple of cases where we weren't emitting VLA sizes (and
subsequently crashed).

llvm-svn: 69567
2009-04-20 03:54:15 +00:00
Eli Friedman 3253e189c6 PR3248: Make sure the evaluate the operand of a sizeof when it has a VLA type.
Adapted from patch by Tim Northover.

llvm-svn: 69566
2009-04-20 03:21:44 +00:00
Zhongxing Xu 23e1f45664 As we now have ValueManager as the new value factory, we do not need factory
methods of SVal.

llvm-svn: 69565
2009-04-20 02:27:09 +00:00
Eli Friedman 7de03e1950 Hook up -Wunused-value to the unused expression warning. This is
useful for macro-heavy codebases that tend to trigger this warning a 
lot.

Note that a make clean is required to get the option working; the 
dependencies for DiagnosticGroups.inc appear to be broken.

llvm-svn: 69564
2009-04-20 01:56:54 +00:00
Daniel Dunbar 5d5dbb1754 Remove non-const form of lookupFieldDeclForIvar.
llvm-svn: 69563
2009-04-20 00:37:55 +00:00
Daniel Dunbar ae03226bc6 Comment fixes.
llvm-svn: 69562
2009-04-20 00:33:43 +00:00
Daniel Dunbar 554fd79b38 Lift GetClassSizeInfo out of GenerateClass, add a FIXME.
- No functionality change.

llvm-svn: 69561
2009-04-19 23:41:48 +00:00
Chris Lattner 504af1177d implement "#pragma GCC diagnostic". Besides being a nice feature, this
will let us test for multiple different warning modes in the same
file in regression tests.

This implements rdar://2362963, a 10-year old feature request :)

llvm-svn: 69560
2009-04-19 23:16:58 +00:00
Chris Lattner c6fafed04c move group twiddling options into Diagnostic.cpp instead of
Warnings.cpp.  Warnings.cpp now doesn't need to #include
tblgen produced output directly.

llvm-svn: 69559
2009-04-19 22:34:23 +00:00
Chris Lattner 3251e3cfaa don't crash on invalid ranges in -fprint-source-range-info
mode, just ignore them as usual.

llvm-svn: 69558
2009-04-19 22:24:10 +00:00
Chris Lattner ddddff4f41 Fix PR4007: clang doesn't know -Werror-foo is the same as -Werror=foo
llvm-svn: 69557
2009-04-19 22:07:21 +00:00
Chris Lattner df2226839f Warn about uses of #pragma STDC FENV_ACCESS ON, since we don't
support it.  I don't know what evaluation method we use for complex
arithmetic, so I don't know whether/if we should warn about use of
CX_LIMITED_RANGE.

This concludes my planned hacking on STDC pragmas, flame away :)

llvm-svn: 69556
2009-04-19 21:55:32 +00:00
Sebastian Redl 8ce189f9ce Conditional operator C++ checking complete. What issues remain are in more general code.
llvm-svn: 69555
2009-04-19 21:53:20 +00:00
Chris Lattner 02ef4e3dba diagnose invalid syntax of STDC pragmas.
llvm-svn: 69554
2009-04-19 21:50:08 +00:00
Eli Friedman daea3f62b5 Print an error for uses of __thread on targets which don't support it.
llvm-svn: 69553
2009-04-19 21:48:33 +00:00
Eli Friedman d88c8a104f Add target property for whether thread-local storage is supported.
Let me know if I messed up for some target.  Note that for Windows, we 
should be able to support it (MSVC supports "__declspec(thread)"), but 
I'm pretty sure LLVM doesn't know how to generate the correct code.

llvm-svn: 69552
2009-04-19 21:38:35 +00:00
Chris Lattner a0b1f76d10 reject invalid stuff in the STDC namespace.
llvm-svn: 69551
2009-04-19 21:25:37 +00:00
Chris Lattner 958ee04368 stub out STDC #pragmas.
llvm-svn: 69550
2009-04-19 21:20:35 +00:00
Daniel Dunbar f5e9b1f5d0 Forward f[no-]dollars-in-identifiers to clang, when specified.
llvm-svn: 69549
2009-04-19 21:20:32 +00:00
Sebastian Redl 0753c6f591 Bring member pointer operands of the conditional operator to a common type. We're getting there ...
llvm-svn: 69548
2009-04-19 21:15:26 +00:00
Chris Lattner 21656f22db basic support for -Wunknown-pragmas, more coming.
llvm-svn: 69547
2009-04-19 21:10:26 +00:00
Daniel Dunbar 8281bdeb4d Forward -fno-diagnostics-fixit-info to clang-cc.
llvm-svn: 69546
2009-04-19 21:09:34 +00:00
Eli Friedman 4f856744e5 PR3853: Add CodeGen support for __thread.
llvm-svn: 69545
2009-04-19 21:05:03 +00:00
Chris Lattner 1c1a00cf51 move token paste poisoning diagnostics to after the instantiation loc
for a token is set, this makes the diagnostic "expanded from stack" work
for this diagnostic.  Add a testcase for PR3918.

llvm-svn: 69544
2009-04-19 20:29:42 +00:00
Eli Friedman 08a375b954 Tests for __thread specifier.
llvm-svn: 69543
2009-04-19 20:29:08 +00:00
Eli Friedman d5c0eeda72 Add more thorough/correct checking for invalid __thread specifiers.
llvm-svn: 69542
2009-04-19 20:27:55 +00:00
Eli Friedman fe92e701aa Silence gcc warning.
llvm-svn: 69541
2009-04-19 20:21:56 +00:00
Chris Lattner db41ddf756 pick a smaller header, one that we control to test this.
llvm-svn: 69540
2009-04-19 20:18:57 +00:00
Chris Lattner 1dc5219a0a rename test for consistency with other pragma test.
llvm-svn: 69539
2009-04-19 20:16:27 +00:00
Chris Lattner 0e71dbf9f0 merge pragma poison tests into one file with -verify mode.
llvm-svn: 69538
2009-04-19 20:15:59 +00:00
Chris Lattner ab9d51cfc4 merge two tests
llvm-svn: 69537
2009-04-19 20:10:12 +00:00
Chris Lattner da4ebb8921 Fix PR3918: Invalid use of __VA_ARGS__ not diagnosed,
by rejecting invalid poisoned tokens in the token
pasting path.

llvm-svn: 69536
2009-04-19 20:06:32 +00:00
Sebastian Redl 3b7ef5e374 Another piece of the conditional operator puzzle. We'll want to use FindCompositePointerType in some other places, too.
llvm-svn: 69534
2009-04-19 19:26:31 +00:00
Chris Lattner 1377dc4c79 convert to -verify mode.
llvm-svn: 69532
2009-04-19 18:54:13 +00:00
Chris Lattner 249c38bb02 Fix PR4006, incorrect handling of __VA_ARGS__ when it was the first token
in a function-like macro body.  This has the added bonus of moving some
function-like macro specific code out of the object-like macro codepath.

llvm-svn: 69530
2009-04-19 18:26:34 +00:00
Chris Lattner 6df41af7fb actually just do this on all x86 targets, it won't hurt
non-glibc ones.

llvm-svn: 69528
2009-04-19 17:32:33 +00:00
Chris Lattner 4997b8ef98 Define __NO_MATH_INLINES on linux/x86 so that we don't get inline
functions in glibc header files that use FP Stack inline asm which the
backend can't deal with (PR879).

This "fixes" PR3970 for linux.  Other affected systems should do similar
things.  Maybe this should just go to the general i386/x86-64 sections?

llvm-svn: 69527
2009-04-19 17:29:50 +00:00
Chris Lattner 29d34cabc5 implement compiler support for -fno-diagnostics-fixit-info,
rdar://6805442

llvm-svn: 69525
2009-04-19 07:44:08 +00:00
Chris Lattner 30b55dc946 invalid directives can occur in #if 0 code, just pass them
through like other directives PTH doesn't care about.  This
should fix rdar://6804029

llvm-svn: 69524
2009-04-19 07:32:03 +00:00
Chris Lattner 9941ce33c3 make PTH not crash on a null directive (# on its own line)
llvm-svn: 69523
2009-04-19 07:25:40 +00:00
Chris Lattner 6ada5d72f8 use isNot instead of !is
llvm-svn: 69522
2009-04-19 07:15:51 +00:00
Chris Lattner fc507055c7 fix -fdollars-in-identifiers to have a default that is overriden
by the command line option if present.

llvm-svn: 69521
2009-04-19 07:06:52 +00:00
Chris Lattner 98b100590d fix rdar://6804322 by wiring up -fdollars-in-identifiers
with assembler-with-cpp mode.

llvm-svn: 69520
2009-04-19 07:00:02 +00:00
Chris Lattner 5f65cc8215 silence a warning, it isn't clear what the right answer is here,
will talk to steve.

llvm-svn: 69519
2009-04-19 06:59:18 +00:00
Chris Lattner ea73782ce3 convert to -verify mode.
llvm-svn: 69518
2009-04-19 06:56:11 +00:00
Chris Lattner 96adcd5e74 silence a warning, I need to talk to Devang about this code.
llvm-svn: 69517
2009-04-19 06:50:29 +00:00
Chris Lattner b433b279f3 Fix rdar://6804402 - crash on objc implementations declared with
@class but no implementation.  This was broken in all 3 runtime
impls.

llvm-svn: 69512
2009-04-19 06:02:28 +00:00
Chris Lattner 4e1f0c6757 rearrange #include order.
llvm-svn: 69511
2009-04-19 05:30:08 +00:00
Chris Lattner 45542ea107 run the jump checker on blocks, even though they don't have gotos,
they do allow switches.

llvm-svn: 69510
2009-04-19 05:28:12 +00:00
Chris Lattner 9fecd743ca add a new Sema::CurFunctionNeedsScopeChecking bool that is used to avoid
calling into the jump checker when a function or method is known to contain
no VLAs or @try blocks.

llvm-svn: 69509
2009-04-19 05:21:20 +00:00
Chris Lattner c5f4ab6372 test that vlas are checked in an objc method context.
llvm-svn: 69508
2009-04-19 05:20:37 +00:00
Chris Lattner de6240cd45 apparently gotos aren't allowed at all in blocks. Stub out a testcase for when/if they are.
llvm-svn: 69507
2009-04-19 04:51:27 +00:00
Chris Lattner 4be550ec68 more testcases of variably modified types.
llvm-svn: 69506
2009-04-19 04:48:07 +00:00
Chris Lattner 1a1fdbd75d move jump scope checking and related code out into its own file, SemaDecl.cpp is
already too large.

llvm-svn: 69505
2009-04-19 04:46:21 +00:00
Daniel Dunbar 2355ea2625 Some more tweaks to driver documentation.
llvm-svn: 69504
2009-04-19 02:33:12 +00:00
Daniel Dunbar 9a7a78b0ae Fix bug in computation of ivar offsets for (adjacent) bitfields.
- The confusing IRgen bitfield interface is partly to blame here;
   fixing the functional error for now, cleanups to the interface to
   follow.

llvm-svn: 69503
2009-04-19 02:03:42 +00:00
Chris Lattner ecbcb3ab0b minor typographical fixes
llvm-svn: 69502
2009-04-19 02:02:45 +00:00
Chris Lattner cd3bb8f7e4 revert david's patch, which causes a testsuite failure.
llvm-svn: 69501
2009-04-19 01:33:30 +00:00
Chris Lattner cc6892e336 rewrite an O(N^2) algorithm to be O(n).
llvm-svn: 69500
2009-04-19 01:32:00 +00:00
Chris Lattner c67540501f second half of indirect jump checking: make sure that any
address taken labels are in function scope

llvm-svn: 69499
2009-04-19 01:16:06 +00:00
Chris Lattner 0bf2dd2ed4 First half of jump scope checking for indirect goto.
llvm-svn: 69498
2009-04-19 01:05:26 +00:00
Chris Lattner 34d9a51892 Add location info for indirect goto.
llvm-svn: 69497
2009-04-19 01:04:21 +00:00
Daniel Dunbar bf90b33665 Reuse ObjcIvarOffsetVariable instead of duplicating code.
- No functionality change (but added a FIXME).

llvm-svn: 69496
2009-04-19 00:44:02 +00:00
Daniel Dunbar a106052090 Remove some unnecessary complexity.
- No functionality change.

llvm-svn: 69495
2009-04-19 00:31:15 +00:00
Chris Lattner c1b96c3590 "This patch fixes message sends to super in class methods for the GNU runtime (currently an instance method lookup is being performed)."
Patch by David Chisnall!

llvm-svn: 69493
2009-04-18 23:12:40 +00:00
Chris Lattner 19bd27f493 add some testcases that we do not correctly handle.
llvm-svn: 69492
2009-04-18 23:07:55 +00:00
Chris Lattner f7fcb516de reimplement DeclStmt handling so that we correctly handle intermixed
VLA's and statement expressions.

llvm-svn: 69491
2009-04-18 23:01:20 +00:00
Chris Lattner a0cfd6b610 rearrange.
llvm-svn: 69490
2009-04-18 22:56:52 +00:00
Chris Lattner fb5ef701d5 add testcases for some more scary/horrible things that work.
llvm-svn: 69488
2009-04-18 22:42:18 +00:00
Chris Lattner 508253d64b the scope checker does work with objc methods, add testcase.
llvm-svn: 69487
2009-04-18 22:37:38 +00:00
Chris Lattner b6e368235a I didn't understand how @catches were chained. Now that I get it, fix
the scope checker to not think @catches are nested in each other, eliminating
some bogus notes.

llvm-svn: 69486
2009-04-18 22:35:34 +00:00
Chris Lattner bf78da7b36 Fix PR3917: the location of a #line directive is the location of the first _.
llvm-svn: 69485
2009-04-18 22:29:33 +00:00
Chris Lattner 93017cc12a Change Preprocessor::AdvanceToTokenCharacter to stop at
the first real character of a token.  For example, advancing
to byte 3 of foo\
bar

should stop at the b, not the \.

llvm-svn: 69484
2009-04-18 22:28:58 +00:00
Chris Lattner 38b2cde4c4 add a new Lexer::SkipEscapedNewLines method.
llvm-svn: 69483
2009-04-18 22:27:02 +00:00
Chris Lattner fbce7aa1f4 factor escape newline measuring out into its own helper function.
llvm-svn: 69482
2009-04-18 22:05:41 +00:00
Chris Lattner dfbfc44df7 remove unneeded scopes.
llvm-svn: 69481
2009-04-18 21:57:20 +00:00
Chris Lattner 637652d959 forgot to commit this before.
llvm-svn: 69480
2009-04-18 21:55:17 +00:00
Chris Lattner 397ca4a9ef fix typo
llvm-svn: 69479
2009-04-18 21:55:02 +00:00
Chris Lattner 5c926f3660 reject invalid jumps among pieces of @try blocks. This seems to work
reasonably well except for the problem that @catches are nested within
each other in the AST, giving the ugly diagnostics in L8.

llvm-svn: 69477
2009-04-18 21:28:52 +00:00
Chris Lattner 1d4fc1bc6d unconditionally check for goto correctness. This is because switch
statements don't end up in the LabelMap so we don't have a quick way
to filter them.  We could add state to Sema (a "has vla" and "has 
jump" bit) to try to filter this out, but that would be sort of gross
and I'm not convinced it is the best way.  Thoughts welcome.

llvm-svn: 69476
2009-04-18 21:00:42 +00:00
Anders Carlsson 623dcae172 Use EmitCallArgs in EmitObjCMessageExpr.
llvm-svn: 69471
2009-04-18 20:29:27 +00:00
Daniel Dunbar f45dbd8c7b Test case would allow clang to fail.
llvm-svn: 69470
2009-04-18 20:23:29 +00:00
Anders Carlsson 603d6aff8b Make CodeGenFunction::EmitCallArgs a template function that takes a generic "Type Info" parameter. The type info parameter knows how to iterate over its arguments.
llvm-svn: 69469
2009-04-18 20:20:22 +00:00
Anders Carlsson 982a65fdb6 Add functions for iterating over the argument types of an ObjCMethodDecl.
llvm-svn: 69468
2009-04-18 20:18:04 +00:00
Chris Lattner b0cb5b2db2 merge two tests.
llvm-svn: 69466
2009-04-18 20:12:56 +00:00
Chris Lattner 96b3139773 abstract the SwitchStack for blocks just like we do the goto labels.
This fixes a crash on invalid (test10). rdar://6805469

llvm-svn: 69465
2009-04-18 20:10:59 +00:00
Chris Lattner f95894c1d2 fix two error paths out of ParseBlockLiteralExpression to
call ActOnBlockError so that CurBlock gets popped.  This
fixes a crash on test/block-syntax-error.c when this new
assertion is enabled.

llvm-svn: 69464
2009-04-18 20:05:34 +00:00
Chris Lattner 3318e86541 refactor some code, adding a new getLabelMap() accessor method
so that clients can't poke the function-local one when they really
want the current block label.  No functionality change.

llvm-svn: 69463
2009-04-18 20:01:55 +00:00
Chris Lattner 36dec99d12 Improve switch diagnostic to emit the "jump" message on the
specific bad case instead of on the switch.  Putting it on the
switch means you don't know what case is the problem. For 
example:

scope-check.c:54:3: error: illegal switch case into protected scope
  case 2:
  ^
scope-check.c:53:9: note: jump bypasses initialization of variable length array
    int a[x];
        ^

llvm-svn: 69462
2009-04-18 19:50:02 +00:00
Chris Lattner 7535f41c66 first step to getting switches giving "jump into vla scope" errors.
llvm-svn: 69461
2009-04-18 19:42:37 +00:00
Chris Lattner 8560addfa6 add some block goto test cases.
llvm-svn: 69460
2009-04-18 19:32:54 +00:00
Chris Lattner ca4dc2e1ea fix error recovery in the case of a jump to a label with no definition
to create a well formed AST instead of a dangling pointer.  This resolves
several fixme's.

llvm-svn: 69459
2009-04-18 19:30:02 +00:00
Chris Lattner 61639745b6 glibc plays some weird games with multiple different definitions of
int8_t and games it with strange *_defined macros.  Emulate its weirdness
for better compatibility with linux etc.  Problem pointed out by anders 
johnson.

llvm-svn: 69458
2009-04-18 19:11:11 +00:00
Chris Lattner a2ac7aab6e make sure to verify that the "non pch" runs worked.
llvm-svn: 69457
2009-04-18 18:45:36 +00:00
Chris Lattner 07f62f1881 improve wording of scope violation error messages.
llvm-svn: 69456
2009-04-18 18:42:55 +00:00
Chris Lattner e227091199 rename test
llvm-svn: 69455
2009-04-18 18:41:40 +00:00
Chris Lattner d66f172ab1 more fun with line markers: the digit string is required to be interpreted
as decimal, even if it starts with 0.  Also, since things like 0x1 are
completely illegal, don't even bother using numericliteralparser for them.

llvm-svn: 69454
2009-04-18 18:35:15 +00:00
Douglas Gregor 13d190ffbc Don't emit name-lookup tables for functions or methods in the PCH files
llvm-svn: 69449
2009-04-18 15:49:20 +00:00