]> granicus.if.org Git - clang/log
clang
15 years agoFix PR3917: the location of a #line directive is the location of the first _.
Chris Lattner [Sat, 18 Apr 2009 22:29:33 +0000 (22:29 +0000)]
Fix PR3917: the location of a #line directive is the location of the first _.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69485 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoChange Preprocessor::AdvanceToTokenCharacter to stop at
Chris Lattner [Sat, 18 Apr 2009 22:28:58 +0000 (22:28 +0000)]
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 \.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69484 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd a new Lexer::SkipEscapedNewLines method.
Chris Lattner [Sat, 18 Apr 2009 22:27:02 +0000 (22:27 +0000)]
add a new Lexer::SkipEscapedNewLines method.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69483 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofactor escape newline measuring out into its own helper function.
Chris Lattner [Sat, 18 Apr 2009 22:05:41 +0000 (22:05 +0000)]
factor escape newline measuring out into its own helper function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69482 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoremove unneeded scopes.
Chris Lattner [Sat, 18 Apr 2009 21:57:20 +0000 (21:57 +0000)]
remove unneeded scopes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69481 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoforgot to commit this before.
Chris Lattner [Sat, 18 Apr 2009 21:55:17 +0000 (21:55 +0000)]
forgot to commit this before.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69480 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix typo
Chris Lattner [Sat, 18 Apr 2009 21:55:02 +0000 (21:55 +0000)]
fix typo

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69479 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoreject invalid jumps among pieces of @try blocks. This seems to work
Chris Lattner [Sat, 18 Apr 2009 21:28:52 +0000 (21:28 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69477 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agounconditionally check for goto correctness. This is because switch
Chris Lattner [Sat, 18 Apr 2009 21:00:42 +0000 (21:00 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69476 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUse EmitCallArgs in EmitObjCMessageExpr.
Anders Carlsson [Sat, 18 Apr 2009 20:29:27 +0000 (20:29 +0000)]
Use EmitCallArgs in EmitObjCMessageExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69471 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoTest case would allow clang to fail.
Daniel Dunbar [Sat, 18 Apr 2009 20:23:29 +0000 (20:23 +0000)]
Test case would allow clang to fail.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69470 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMake CodeGenFunction::EmitCallArgs a template function that takes a generic "Type...
Anders Carlsson [Sat, 18 Apr 2009 20:20:22 +0000 (20:20 +0000)]
Make CodeGenFunction::EmitCallArgs a template function that takes a generic "Type Info" parameter. The type info parameter knows how to iterate over its arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69469 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd functions for iterating over the argument types of an ObjCMethodDecl.
Anders Carlsson [Sat, 18 Apr 2009 20:18:04 +0000 (20:18 +0000)]
Add functions for iterating over the argument types of an ObjCMethodDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69468 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agomerge two tests.
Chris Lattner [Sat, 18 Apr 2009 20:12:56 +0000 (20:12 +0000)]
merge two tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69466 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoabstract the SwitchStack for blocks just like we do the goto labels.
Chris Lattner [Sat, 18 Apr 2009 20:10:59 +0000 (20:10 +0000)]
abstract the SwitchStack for blocks just like we do the goto labels.
This fixes a crash on invalid (test10). rdar://6805469

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69465 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix two error paths out of ParseBlockLiteralExpression to
Chris Lattner [Sat, 18 Apr 2009 20:05:34 +0000 (20:05 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69464 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agorefactor some code, adding a new getLabelMap() accessor method
Chris Lattner [Sat, 18 Apr 2009 20:01:55 +0000 (20:01 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69463 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImprove switch diagnostic to emit the "jump" message on the
Chris Lattner [Sat, 18 Apr 2009 19:50:02 +0000 (19:50 +0000)]
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];
        ^

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69462 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofirst step to getting switches giving "jump into vla scope" errors.
Chris Lattner [Sat, 18 Apr 2009 19:42:37 +0000 (19:42 +0000)]
first step to getting switches giving "jump into vla scope" errors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69461 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd some block goto test cases.
Chris Lattner [Sat, 18 Apr 2009 19:32:54 +0000 (19:32 +0000)]
add some block goto test cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69460 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix error recovery in the case of a jump to a label with no definition
Chris Lattner [Sat, 18 Apr 2009 19:30:02 +0000 (19:30 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69459 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoglibc plays some weird games with multiple different definitions of
Chris Lattner [Sat, 18 Apr 2009 19:11:11 +0000 (19:11 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69458 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agomake sure to verify that the "non pch" runs worked.
Chris Lattner [Sat, 18 Apr 2009 18:45:36 +0000 (18:45 +0000)]
make sure to verify that the "non pch" runs worked.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69457 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoimprove wording of scope violation error messages.
Chris Lattner [Sat, 18 Apr 2009 18:42:55 +0000 (18:42 +0000)]
improve wording of scope violation error messages.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69456 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agorename test
Chris Lattner [Sat, 18 Apr 2009 18:41:40 +0000 (18:41 +0000)]
rename test

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69455 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agomore fun with line markers: the digit string is required to be interpreted
Chris Lattner [Sat, 18 Apr 2009 18:35:15 +0000 (18:35 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69454 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDon't emit name-lookup tables for functions or methods in the PCH files
Douglas Gregor [Sat, 18 Apr 2009 15:49:20 +0000 (15:49 +0000)]
Don't emit name-lookup tables for functions or methods in the PCH files

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69449 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix test to output LLVM to a temporary file, which we grep as part of the test
Douglas Gregor [Sat, 18 Apr 2009 15:48:37 +0000 (15:48 +0000)]
Fix test to output LLVM to a temporary file, which we grep as part of the test

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69448 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agorewrite the goto scope checking code to be more efficient, simpler,
Chris Lattner [Sat, 18 Apr 2009 09:36:27 +0000 (09:36 +0000)]
rewrite the goto scope checking code to be more efficient, simpler,
produce better diagnostics, and be more correct in ObjC cases (fixing
rdar://6803963).

An example is that we now diagnose:

int test1(int x) {
  goto L;
  int a[x];
  int b[x];
  L:
  return sizeof a;
}

with:

scope-check.c:15:3: error: illegal goto into protected scope
  goto L;
  ^
scope-check.c:17:7: note: scope created by variable length array
  int b[x];
      ^
scope-check.c:16:7: note: scope created by variable length array
  int a[x];
      ^

instead of just saying "invalid jump".  An ObjC example is:

void test1() {
  goto L;
  @try {
L: ;
  } @finally {
  }
}

t.m:6:3: error: illegal goto into protected scope
  goto L;
  ^
t.m:7:3: note: scope created by @try block
  @try {
  ^

There are a whole ton of fixme's for stuff to do, but I believe that this
is a monotonic improvement over what we had.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69437 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd accessor.
Chris Lattner [Sat, 18 Apr 2009 09:27:30 +0000 (09:27 +0000)]
add accessor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69436 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUse getAsPointerType instead of using getCanonicalType directly.
Daniel Dunbar [Sat, 18 Apr 2009 08:54:40 +0000 (08:54 +0000)]
Use getAsPointerType instead of using getCanonicalType directly.
 - <rdar://problem/6803995>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69435 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix a bug found by inspection, class/meta references could be emitted
Daniel Dunbar [Sat, 18 Apr 2009 08:51:00 +0000 (08:51 +0000)]
Fix a bug found by inspection, class/meta references could be emitted
into the wrong section (they shared the same lookup table).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69433 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd another testcase
Chris Lattner [Sat, 18 Apr 2009 07:54:11 +0000 (07:54 +0000)]
add another testcase

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69432 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agodon't evaluate ->child_end() every time through the loop, or *i frequently within it.
Chris Lattner [Sat, 18 Apr 2009 07:53:55 +0000 (07:53 +0000)]
don't evaluate ->child_end() every time through the loop, or *i frequently within it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69431 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agosplit code out into a new CheckFunctionJumpScopes routine,
Chris Lattner [Sat, 18 Apr 2009 07:47:21 +0000 (07:47 +0000)]
split code out into a new CheckFunctionJumpScopes routine,
add some comments, change type from void* -> Stmt*, use
smallvector instead of vector.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69430 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agomake scope checking be static functions instead of sema methods.
Chris Lattner [Sat, 18 Apr 2009 07:36:39 +0000 (07:36 +0000)]
make scope checking be static functions instead of sema methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69429 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix incorrect lowering of __builtin_ia32_shufpd, rdar://6803924
Chris Lattner [Sat, 18 Apr 2009 07:01:54 +0000 (07:01 +0000)]
fix incorrect lowering of __builtin_ia32_shufpd, rdar://6803924

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69428 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agorename file.
Chris Lattner [Sat, 18 Apr 2009 07:00:54 +0000 (07:00 +0000)]
rename file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69427 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agodon't dump .ll file in this dir.
Chris Lattner [Sat, 18 Apr 2009 07:00:06 +0000 (07:00 +0000)]
don't dump .ll file in this dir.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69426 91177308-0d34-0410-b5e6-96231b3b80d8

15 years ago__builtin_prefetch should be declared as "void __builtin_prefetch(const void *)",
Chris Lattner [Sat, 18 Apr 2009 06:51:21 +0000 (06:51 +0000)]
__builtin_prefetch should be declared as "void __builtin_prefetch(const void *)",
not "const void __builtin_prefetch(void *)".  This fixes PR3912.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69425 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agorename test
Chris Lattner [Sat, 18 Apr 2009 06:49:47 +0000 (06:49 +0000)]
rename test

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69424 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix PR3927 by being more careful about the pp test for identifier.
Chris Lattner [Sat, 18 Apr 2009 06:44:18 +0000 (06:44 +0000)]
fix PR3927 by being more careful about the pp test for identifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69423 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agosecond half of PR3940: #line requires simple digit sequence.
Chris Lattner [Sat, 18 Apr 2009 06:38:24 +0000 (06:38 +0000)]
second half of PR3940: #line requires simple digit sequence.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69422 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoStore the type ID for __builtin_va_list in the PCH file, so that the
Douglas Gregor [Sat, 18 Apr 2009 05:55:16 +0000 (05:55 +0000)]
Store the type ID for __builtin_va_list in the PCH file, so that the
AST context's __builtin_va_list type will be set when the PCH file is
loaded. This fixes the crash when CodeGen'ing a va_arg expression
pulled in from a PCH file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69421 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agothis is really just a recommendation, not a requirement.
Chris Lattner [Sat, 18 Apr 2009 02:25:14 +0000 (02:25 +0000)]
this is really just a recommendation, not a requirement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69416 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoenforce requirements imposed by C90 6.8 TC1, fixing PR3919.
Chris Lattner [Sat, 18 Apr 2009 02:23:25 +0000 (02:23 +0000)]
enforce requirements imposed by C90 6.8 TC1, fixing PR3919.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69415 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix PR3938 by taking into account C99 6.10p4.
Chris Lattner [Sat, 18 Apr 2009 01:34:22 +0000 (01:34 +0000)]
Fix PR3938 by taking into account C99 6.10p4.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69413 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoconvert test to -verify style.
Chris Lattner [Sat, 18 Apr 2009 01:33:54 +0000 (01:33 +0000)]
convert test to -verify style.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69412 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoSubstantially restructure function-like macro argument parsing.
Chris Lattner [Sat, 18 Apr 2009 01:13:56 +0000 (01:13 +0000)]
Substantially restructure function-like macro argument parsing.
Highlights: PP::isNextPPTokenLParen() no longer eats the (
when present.  We now simplify slightly the logic parsing
macro arguments.  We now handle PR3937 and other related cases
correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69411 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPreliminary PCH support in the driver
Douglas Gregor [Sat, 18 Apr 2009 00:34:01 +0000 (00:34 +0000)]
Preliminary PCH support in the driver

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69410 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoLazy deserialization of function bodies for PCH files. For the Carbon
Douglas Gregor [Sat, 18 Apr 2009 00:07:54 +0000 (00:07 +0000)]
Lazy deserialization of function bodies for PCH files. For the Carbon
"Hello, World!", this takes us from deserializing 6469
statements/expressions down to deserializing 1
statement/expression. It only translated into a 1% improvement on the
Carbon-prefixed 403.gcc, but (a) it's the right thing to do, and (b)
we expect this to matter more once we lazily deserialize identifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69407 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFunctionDecl::getBody() is getting an ASTContext argument for use in
Douglas Gregor [Sat, 18 Apr 2009 00:02:19 +0000 (00:02 +0000)]
FunctionDecl::getBody() is getting an ASTContext argument for use in
lazy PCH deserialization. Propagate that argument wherever it needs to
be. No functionality change, except that I've tightened up a few PCH
tests in preparation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69406 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoremove dead diagnostic.
Chris Lattner [Fri, 17 Apr 2009 23:57:31 +0000 (23:57 +0000)]
remove dead diagnostic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69405 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix two problems from PR3916, and one problem I noticed while hacking
Chris Lattner [Fri, 17 Apr 2009 23:56:52 +0000 (23:56 +0000)]
Fix two problems from PR3916, and one problem I noticed while hacking
on the code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69404 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoimplement PR3940: #line numbers not fully checked
Chris Lattner [Fri, 17 Apr 2009 23:37:49 +0000 (23:37 +0000)]
implement PR3940: #line numbers not fully checked

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69403 91177308-0d34-0410-b5e6-96231b3b80d8

15 years ago#line is allowed to have macros that expand to nothing after them.
Chris Lattner [Fri, 17 Apr 2009 23:30:53 +0000 (23:30 +0000)]
#line is allowed to have macros that expand to nothing after them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69401 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoKeep track of the number of statements/expressions written to and read
Douglas Gregor [Fri, 17 Apr 2009 22:13:46 +0000 (22:13 +0000)]
Keep track of the number of statements/expressions written to and read
from a PCH file. It turns out that "Hello, World!" is bringing in 19%
of all of the statements in Carbon.h, so we need to be lazy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69393 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix a crash compiling code with its own definition of objc_assign_weak.
Chris Lattner [Fri, 17 Apr 2009 22:12:36 +0000 (22:12 +0000)]
fix a crash compiling code with its own definition of objc_assign_weak.
rdar://6800430

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69392 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agotweak redefinition of a typedef a bit to fix a couple of problems:
Chris Lattner [Fri, 17 Apr 2009 22:04:20 +0000 (22:04 +0000)]
tweak redefinition of a typedef a bit to fix a couple of problems:
1. We had logic in sema to decide whether or not to emit the error
   based on manually checking whether in a system header file.
2. we were allowing redefinitions of typedefs in class scope in C++
   if in header file.
3. there was no way to force typedef redefinitions to be accepted
   by the C compiler, which annoys me when stripping linemarkers out
   of .i files.

The fix is to split the C++ class typedef redefinition path from the
C path, and change the C path to be a warning that normally maps to
error.  This causes it to properly be ignored in system headers,
etc. and gives us a way to control it.  Passing
-Wtypedef-redefinition now turns the error into a warning.

One behavior change is that we now diagnose cases where you redefine
a typedef in your .c file that was defined in a header file.  This
seems like reasonable behavior, and the diagnostic now indicates that
it can be controlled with -Wtypedef-redefinition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69391 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix two embarrassing PCH bugs:
Douglas Gregor [Fri, 17 Apr 2009 21:46:47 +0000 (21:46 +0000)]
Fix two embarrassing PCH bugs:
  1) Accidentally used delete [] on an array of statements that was allocated with ASTContext's allocator
  2) Deserialization of names with multiple declarations (e.g., a struct and a function) used the wrong mangling constant, causing it to view declaration IDs as Decl*s.

403.gcc builds and links properly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69390 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUse PresumedLoc to record line number in debug info entries.
Devang Patel [Fri, 17 Apr 2009 21:35:15 +0000 (21:35 +0000)]
Use PresumedLoc to record line number in debug info entries.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69389 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDon't put msgrefs in used globals (in particular, we don't want
Daniel Dunbar [Fri, 17 Apr 2009 21:10:58 +0000 (21:10 +0000)]
Don't put msgrefs in used globals (in particular, we don't want
no-dead-strip set on them).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69388 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAppropriately set file name and directory name in debug info compile units.
Devang Patel [Fri, 17 Apr 2009 21:06:59 +0000 (21:06 +0000)]
Appropriately set file name and directory name in debug info compile units.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69387 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoimplement a new clang-cc option -dump-build-information=filename which causes the
Chris Lattner [Fri, 17 Apr 2009 21:05:01 +0000 (21:05 +0000)]
implement a new clang-cc option -dump-build-information=filename which causes the
compiler to dump random stuff from the build into the file.  Right now this
amounts to dumping command line arguments and diagnostics to the file.

The idea is that you can set an envvar, do a world build of an OS, then grep
through all the logs for interesting things or something.

Daniel, please wire the driver up to do something with this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69386 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPCH support for inline assembly statements.
Douglas Gregor [Fri, 17 Apr 2009 20:57:14 +0000 (20:57 +0000)]
PCH support for inline assembly statements.

This completes support for all of C (+ extensions). We can (again)
build a PCH file for Carbon.h.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69385 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agorefactor htmldiags to be created up front like the other diag clients.
Chris Lattner [Fri, 17 Apr 2009 20:40:01 +0000 (20:40 +0000)]
refactor htmldiags to be created up front like the other diag clients.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69379 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd a virtual method to DiagnosticClient to get rid of some fragile
Chris Lattner [Fri, 17 Apr 2009 20:16:08 +0000 (20:16 +0000)]
add a virtual method to DiagnosticClient to get rid of some fragile
casting in clang-cc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69377 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPCH tests for va_arg expressions. Verified that the blocks test does create a BlockDe...
Douglas Gregor [Fri, 17 Apr 2009 20:06:59 +0000 (20:06 +0000)]
PCH tests for va_arg expressions. Verified that the blocks test does create a BlockDeclRefExpr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69376 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix a crash on invalid by making ActOnDeclarator create decl with
Chris Lattner [Fri, 17 Apr 2009 19:32:54 +0000 (19:32 +0000)]
fix a crash on invalid by making ActOnDeclarator create decl with
a dummy *function* type when it is recovering and knows it needs
a function.  rdar://6802350 - clang crash on invalid input

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69374 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPCH support for blocks
Douglas Gregor [Fri, 17 Apr 2009 19:21:43 +0000 (19:21 +0000)]
PCH support for blocks

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69373 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agowire up comment diagnostics to -Wcomment, add it to -Wall. Now
Chris Lattner [Fri, 17 Apr 2009 19:09:26 +0000 (19:09 +0000)]
wire up comment diagnostics to -Wcomment, add it to -Wall.  Now
you can silence these with -Wno-all or -Wno-comment, but they
still default to on.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69372 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPCH support for GNU statement expressions
Douglas Gregor [Fri, 17 Apr 2009 19:05:30 +0000 (19:05 +0000)]
PCH support for GNU statement expressions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69370 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPCH support for indirect gotos and address-of-label expressions.
Douglas Gregor [Fri, 17 Apr 2009 18:58:21 +0000 (18:58 +0000)]
PCH support for indirect gotos and address-of-label expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69369 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadjust for the new -Wvector-conversions option
Chris Lattner [Fri, 17 Apr 2009 18:39:25 +0000 (18:39 +0000)]
adjust for the new -Wvector-conversions option

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69366 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agomove a vector conversion warning to be diabled by default (like gcc),
Chris Lattner [Fri, 17 Apr 2009 18:28:37 +0000 (18:28 +0000)]
move a vector conversion warning to be diabled by default (like gcc),
but add it to -Wall (unlike gcc) and give it a controlling group
(-Wvector-conversions).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69365 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPCH support for labels and goto.
Douglas Gregor [Fri, 17 Apr 2009 18:18:49 +0000 (18:18 +0000)]
PCH support for labels and goto.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69364 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUpdate Xcode project with some PCH related headers.
Steve Naroff [Fri, 17 Apr 2009 18:02:59 +0000 (18:02 +0000)]
Update Xcode project with some PCH related headers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69363 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix misspelt attribute.
Chris Lattner [Fri, 17 Apr 2009 17:55:23 +0000 (17:55 +0000)]
fix misspelt attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69362 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix rdar://6800926 - crash compiling non-fragile _Bool bitfield ivar,
Chris Lattner [Fri, 17 Apr 2009 17:46:19 +0000 (17:46 +0000)]
Fix rdar://6800926 - crash compiling non-fragile _Bool bitfield ivar,
the functional change here is changing ConvertType -> ConvertTypeForMem
so that we handle i1 fields properly as memory.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69361 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agotidy some code.
Chris Lattner [Fri, 17 Apr 2009 17:44:48 +0000 (17:44 +0000)]
tidy some code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69360 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoclean up run lines.
Chris Lattner [Fri, 17 Apr 2009 17:43:56 +0000 (17:43 +0000)]
clean up run lines.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69359 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd basic support for building DiagnosticGroups.inc with cmake
Chris Lattner [Fri, 17 Apr 2009 17:04:48 +0000 (17:04 +0000)]
add basic support for building DiagnosticGroups.inc with cmake

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69357 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPCH support for declaration statements, and a test for PredefinedExpr
Douglas Gregor [Fri, 17 Apr 2009 16:55:36 +0000 (16:55 +0000)]
PCH support for declaration statements, and a test for PredefinedExpr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69356 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPCH support for return statements.
Douglas Gregor [Fri, 17 Apr 2009 16:34:57 +0000 (16:34 +0000)]
PCH support for return statements.

Optimize PCH encoding for switch-case statements slightly, by making
the switch-case numbering local to a particular statement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69355 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImplement lvalue test for conditional expressions.
Sebastian Redl [Fri, 17 Apr 2009 16:30:52 +0000 (16:30 +0000)]
Implement lvalue test for conditional expressions.
Add a few commented lines to the test case that point out things that don't work yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69354 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdded -print-ivar-layout option. No change in functionality
Fariborz Jahanian [Fri, 17 Apr 2009 03:04:15 +0000 (03:04 +0000)]
Added -print-ivar-layout option. No change in functionality
yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69346 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd support for the __has_trivial_destructor type trait.
Anders Carlsson [Fri, 17 Apr 2009 02:34:54 +0000 (02:34 +0000)]
Add support for the __has_trivial_destructor type trait.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69345 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd support for generating (very basic) C++ destructors. These aren't called by anyth...
Anders Carlsson [Fri, 17 Apr 2009 01:58:57 +0000 (01:58 +0000)]
Add support for generating (very basic) C++ destructors. These aren't called by anything yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69343 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoSupport QA_OVERRIDE_GCC3_OPTIONS
Daniel Dunbar [Fri, 17 Apr 2009 01:54:00 +0000 (01:54 +0000)]
Support QA_OVERRIDE_GCC3_OPTIONS
 - Cover your eyes...

 - This is a simple but effective way to allow developers to build a
   project with clang while manipulating the command line, without
   having to edit the project itself.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69342 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAttributes on block functions were not being set.
Daniel Dunbar [Fri, 17 Apr 2009 00:48:04 +0000 (00:48 +0000)]
Attributes on block functions were not being set.
 - <rdar://problem/6800351> clang not producing correct large struct
   return code for Blocks

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69337 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPCH support for do-while and for loops
Douglas Gregor [Fri, 17 Apr 2009 00:29:51 +0000 (00:29 +0000)]
PCH support for do-while and for loops

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69334 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPCH support for while and continue statements
Douglas Gregor [Fri, 17 Apr 2009 00:16:09 +0000 (00:16 +0000)]
PCH support for while and continue statements

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69332 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFixup semantic analysis for nested blocks, and allow block literal
Mike Stump [Fri, 17 Apr 2009 00:09:41 +0000 (00:09 +0000)]
Fixup semantic analysis for nested blocks, and allow block literal
expressions that can be of static duration to be returned.
Radar 6786551

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69331 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImplement basic code generation of constructor calls. We can now compile:
Anders Carlsson [Fri, 17 Apr 2009 00:06:03 +0000 (00:06 +0000)]
Implement basic code generation of constructor calls. We can now compile:

struct S {
S(int, int);
};

void f() {
S s(10, 10);
}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69330 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPCH support for the first batch of statements, including null,
Douglas Gregor [Fri, 17 Apr 2009 00:04:06 +0000 (00:04 +0000)]
PCH support for the first batch of statements, including null,
compound, case, default, if, switch, and break statements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69329 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd GetAddrOfCXXConstructor and use it.
Anders Carlsson [Thu, 16 Apr 2009 23:57:24 +0000 (23:57 +0000)]
Add GetAddrOfCXXConstructor and use it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69328 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd constructor getter to CXXTemporaryObjectExpr.
Anders Carlsson [Thu, 16 Apr 2009 23:53:22 +0000 (23:53 +0000)]
Add constructor getter to CXXTemporaryObjectExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69327 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoIf a class has a non-trivial constructor that doesn't take any arguments, we will...
Anders Carlsson [Thu, 16 Apr 2009 23:50:50 +0000 (23:50 +0000)]
If a class has a non-trivial constructor that doesn't take any arguments, we will now make an implicit CXXTemporaryObjectExpr. So

struct S {
  S();
};

void f() {
 S s;
}

's' here will implicitly be declared as.

S s = S();

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69326 91177308-0d34-0410-b5e6-96231b3b80d8

15 years ago-Wall is -Wmost -Wparentheses
Chris Lattner [Thu, 16 Apr 2009 23:30:16 +0000 (23:30 +0000)]
-Wall is -Wmost -Wparentheses

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69324 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDriver: Allow using clang as a precompiler, even if it is an
Daniel Dunbar [Thu, 16 Apr 2009 23:10:13 +0000 (23:10 +0000)]
Driver: Allow using clang as a precompiler, even if it is an
unsupported arch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69322 91177308-0d34-0410-b5e6-96231b3b80d8