Commit Graph

57839 Commits

Author SHA1 Message Date
Daniel Dunbar c2223ab255 Improve "assignment to cast" diagnostic.
- Strip off extra parens when looking for casts.
 - Change the location info to point at the cast (instead of the
   assignment).

For example, on
  
  int *b;
  #define a ((void*) b)
  void f0() {
    a = 10;
  }
  
we now emit:
  
  /tmp/t.c:4:3: error: assignment to cast is illegal, lvalue casts are not supported
    a = 10;
    ^ ~
  /tmp/t.c:2:12: note: instantiated from:
  #define a ((void*) b)
            ~^~~~~~~~~~
  
instead of:
  
  /tmp/t.c:4:5: error: expression is not assignable
    a = 10;
    ~ ^

llvm-svn: 69114
2009-04-15 00:08:05 +00:00
Devang Patel 1be3b53d3c Add a method to check that the subprogram holds debug info for the given Function or not.
llvm-svn: 69113
2009-04-15 00:06:07 +00:00
Dan Gohman 7913ea5e4a Add a new MOV8rr_NOREX, and make X86's copyRegToReg use it when
either the source or destination is a physical h register.

This fixes sqlite3 with the post-RA scheduler enabled.

llvm-svn: 69111
2009-04-15 00:04:23 +00:00
Bill Wendling e665e3cf2f Testcase for r69104.
llvm-svn: 69110
2009-04-15 00:04:11 +00:00
Dan Gohman 821e13a8f4 GR8_NOREX can contain the H registers, since they don't require
REX prefixes.

llvm-svn: 69108
2009-04-15 00:00:48 +00:00
Douglas Gregor 954a830eca PCH support for ParenExpr
llvm-svn: 69106
2009-04-14 23:59:37 +00:00
Evan Cheng 5ebf2acd84 Optimize conditional branch on i1 phis with non-constant inputs.
This turns:

eq:
        %3 = icmp eq i32 %1, %2
        br label %join

ne:
        %4 = icmp ne i32 %1, %2
        br label %join

join:
        %5 = phi i1 [%3, %eq], [%4, %ne]
        br i1 %5, label %yes, label %no

=>

eq:
        %3 = icmp eq i32 %1, %2
        br i1 %3, label %yes, label %no

ne:
        %4 = icmp ne i32 %1, %2
        br i1 %4, label %yes, label %no

llvm-svn: 69102
2009-04-14 23:40:03 +00:00
Douglas Gregor f0b575f79d Add PCH support for ImplicitCastExprs. This is the first expression
kind PCH handles that has an expression as an operand, so most of this
work is in the infrastructure to rebuild expression trees from the
serialized representation. We now store expressions in post-order
(e.g., Reverse Polish Notation), so that we can easily rebuild the
appropriate expression tree.

llvm-svn: 69101
2009-04-14 23:32:43 +00:00
Daniel Dunbar 9351c02bef Strip paren expressions when trying to diagnose "cast as lvalue"
extension.

llvm-svn: 69100
2009-04-14 23:26:44 +00:00
Chris Lattner 184e65d363 Change Lexer::MeasureTokenLength to take a LangOptions reference.
This allows it to accurately measure tokens, so that we get:

t.cpp:8:13: error: unknown type name 'X'
static foo::X  P;
       ~~~~~^

instead of the woefully inferior:

t.cpp:8:13: error: unknown type name 'X'
static foo::X  P;
       ~~~~ ^

Most of this is just plumbing to push the reference around.

llvm-svn: 69099
2009-04-14 23:22:57 +00:00
Fariborz Jahanian 6c6aea914a Diagnose properties which have no implementations;
either unimplemented setter/getter or no
implementation directive.

llvm-svn: 69098
2009-04-14 23:15:21 +00:00
Daniel Dunbar 3241fae46c Set alignment on __cstring metadata variables to 1 (matching
llvm-gcc).

llvm-svn: 69097
2009-04-14 23:14:47 +00:00
Dan Gohman 86e43e7999 Fix the RUN lines so that this test actually tests.
llvm-svn: 69096
2009-04-14 22:50:17 +00:00
Dan Gohman 62f4498646 For the h-register addressing-mode trick, use the correct value for
any non-address uses of the address value. This fixes 186.crafty.

llvm-svn: 69094
2009-04-14 22:45:05 +00:00
Daniel Dunbar 729df96bf5 Avoid use of magic \01 prefix when unneeded.
llvm-svn: 69093
2009-04-14 22:44:26 +00:00
Chris Lattner faa1dbb4d0 add fixitrewriter to xcode proj
llvm-svn: 69092
2009-04-14 22:44:23 +00:00
Daniel Dunbar 346892aafc Comment fix.
llvm-svn: 69091
2009-04-14 22:41:13 +00:00
Evan Cheng 3f1a3008f4 Mac OS X 10.6 and above do not use key manager to register EH frames.
llvm-svn: 69090
2009-04-14 22:31:59 +00:00
Dan Gohman e5cd1fcdb9 When the result of an EXTRACT_SUBREG, INSERT_SUBREG, or SUBREG_TO_REG
operator is used by a CopyToReg to export the value to a different
block, don't reuse the CopyToReg's register for the subreg operation
result if the register isn't precisely the right class for the
subreg operation.

Also, rename the h-registers.ll test, now that there are more
than one.

llvm-svn: 69087
2009-04-14 22:17:14 +00:00
Chris Lattner b4a8fe8dcc Make the implicit-int handling error recovery stuff handle C++
nested name specifiers.  Now we emit stuff like:

t.cpp:8:13: error: unknown type name 'X'
static foo::X  P;
       ~~~~ ^

instead of:

t.cpp:8:16: error: invalid token after top level declarator
static foo::X  P;
               ^

This is inspired by a really awful error message I got from 
g++ when I misspelt diag::kind as diag::Kind.

llvm-svn: 69086
2009-04-14 22:17:06 +00:00
Douglas Gregor e0a3a51637 Add PCH support for PredefinedExpr and FloatingLiteral expressions
llvm-svn: 69084
2009-04-14 21:55:33 +00:00
Chris Lattner 20a0c61487 refactor "implicit int error recovery" code out of
ParseDeclarationSpecifiers into its own function, no
functionality change.

llvm-svn: 69083
2009-04-14 21:34:55 +00:00
Mikhail Glushenkov 60cde5ba7c Call CreateProcess with bInheritHandles = TRUE.
Makes llvmc show error messages printed by child processes when run from the
Cygwin/MSYS shell. Since ExecuteAndWait does not return until the child program
has finished execution, this change should be harmless.

llvm-svn: 69082
2009-04-14 21:31:36 +00:00
Mikhail Glushenkov 3a62efb732 Delete trailing whitespace.
llvm-svn: 69081
2009-04-14 21:31:14 +00:00
Douglas Gregor feb84b0074 PCH support for a few very, very simple kinds of expressions. Hook up
expression (de-)serialization for VLAs, variable initializers,
enum constant initializers, and bitfield widths.

llvm-svn: 69075
2009-04-14 21:18:50 +00:00
Chris Lattner a723ba97db Fix a regression in a previous patch that broke implicit
int in a bitfield.  Shantonu found this in a gcc testsuite file.

llvm-svn: 69074
2009-04-14 21:16:09 +00:00
Steve Naroff 5196c618fb Fix <rdar://problem/6252084> [sema] jumps into Obj-C exception blocks should be disallowed.
This builds on Eli's work from http://llvm.org/viewvc/llvm-project?view=rev&revision=65678.

llvm-svn: 69073
2009-04-14 20:53:38 +00:00
Chris Lattner b874dbd478 add support for -W[no-]extra-tokens
llvm-svn: 69071
2009-04-14 20:36:01 +00:00
Chris Lattner 28549de12c remove dead enum
llvm-svn: 69070
2009-04-14 20:30:29 +00:00
Chris Lattner bae0e68930 Fix PR3988: extern inline functions get strong symbol definitions in
C99 mode.  This is a regression from an earlier patch of mine.

This also simplifies the linkage enums a bit.

llvm-svn: 69069
2009-04-14 20:25:53 +00:00
Fariborz Jahanian 899e7eb6c7 Do not dead code strip global meta-data objects.
This will match gcc's behavior in the arena.

llvm-svn: 69061
2009-04-14 18:41:56 +00:00
Mike Stump d73e4419f5 Fixup whitespacing.
llvm-svn: 69055
2009-04-14 18:24:37 +00:00
Chris Lattner 66037791b1 temporarily revert r69046
llvm-svn: 69054
2009-04-14 18:05:08 +00:00
Daniel Dunbar 4527d30c3d Fix comment.
llvm-svn: 69053
2009-04-14 17:42:51 +00:00
Douglas Gregor db908332e3 Add a tricky, tricky test case for PCH that we currently don't handle. Committed with a FIXME so that we don't forget it
llvm-svn: 69052
2009-04-14 17:10:28 +00:00
Chris Lattner 4225e23e62 implement some sema for gnuc_inline attribute. Reject always_inline and no_inline on objc methods.
llvm-svn: 69051
2009-04-14 17:02:11 +00:00
Anders Carlsson a5d077df73 Support code generation of 'this' exprs
llvm-svn: 69050
2009-04-14 16:58:56 +00:00
Evan Cheng dfbbf5c043 Some of GR8_NOREX registers are only available in 64-bit mode.
llvm-svn: 69049
2009-04-14 16:57:43 +00:00
Sanjiv Gupta 69650b099a Literal value calculation isn't likely to overflow on targets having int as 32 or less. Fixing the assert as it otherwise triggers for PIC16 which as i16 as int.
llvm-svn: 69046
2009-04-14 16:46:37 +00:00
Chris Lattner 02e987f3e8 implement codegen support for __attribute((__gnuc_inline__)),
pulling some attribute munging stuff into GetLinkageForFunction.

This should fix PR3986

llvm-svn: 69045
2009-04-14 16:44:36 +00:00
Chris Lattner eaad6b70a9 recognize the gnuc_inline attribute.
llvm-svn: 69044
2009-04-14 16:30:50 +00:00
Douglas Gregor 54feb84489 When building a PCH file, don't perform end-of-translation-unit
wrap-up (e.g., turning tentative definitions into definitions). Also,
very that, when we actually use the PCH file, we get the ride code
generation for tentative definitions and definitions that show up in
the PCH file.

llvm-svn: 69043
2009-04-14 16:27:31 +00:00
Steve Naroff 06f440dd7b ASTContext::mergeTypes(): Loosen up the type checking for 'Class' (treating it like 'id').
This fixes <rdar://problem/6782722> XCDataTipsManager.m registers, observes notifications in class methods.

The radar above is the result of clang typing 'self' in a class method as 'Class', which results in some spurious warnings (GCC types 'self' in a class method as 'id').

I considered changing the type of 'self' to 'id' (to conform to GCC), however this resulted in *many* test cases breaking. In addition, I really prefer a more strongly typed 'self'.

All in all, this is the least obtrusive fix I could find for removing the spurious warnings (though we do loose some valid warnings).

llvm-svn: 69041
2009-04-14 15:11:46 +00:00
Daniel Dunbar 389325715b Refactor how attributes are set on values.
- Pull out SetCommonAttributes, which handles the things common to
   aliases, methods, functions, and variables.

 - Pull out SetLLVMFunctionAttributesForDefinition, which handles the
   LLVM attributes which we only want to apply to a definition (like
   noinline and alwaysinline).

 - Kill SetGVDeclarationAttributes (inlined into SetFunctionAttributes
   and specialized).

 - Kill SetFunctionAttributesForDefinition (inlined into sole caller).

 - Inline SetGVDefinitionAttributes into SetMethodAttributes and
   specialize.

 - Rename SetGVDefinitionAttributes to SetFunctionDefinitionAttributes.

This is supposed to be a no functionality change commit, but I may
have made a mistake.

llvm-svn: 69036
2009-04-14 08:05:55 +00:00
Daniel Dunbar 81a3f1bdf3 Split SetGlobalValueAttributes into definition/declaration halves.
- No functionality change.

llvm-svn: 69035
2009-04-14 07:19:20 +00:00
Daniel Dunbar aeddffc99d Rename (one) SetFunctionAttributes to SetLLVMFunctionAttributes to
disambiguate it.
 - No functionality change.

llvm-svn: 69034
2009-04-14 07:08:30 +00:00
Daniel Dunbar 64a41cb39e Reduce indentation, no functionality change.
llvm-svn: 69033
2009-04-14 07:02:17 +00:00
Chris Lattner 92028dad66 defer emission of always_inline, extern_inline, and inline functions (when
not in c89 mode).

llvm-svn: 69032
2009-04-14 06:44:48 +00:00
Chris Lattner 169a5c963f give always_inline functions internal linkage. If they cannot be
inlined for some reason, then we don't want a strong or even weak
definition.

llvm-svn: 69031
2009-04-14 06:32:05 +00:00
Chris Lattner 256c9507c8 set the linkage of an inline function according to its language rules.
llvm-svn: 69030
2009-04-14 06:27:57 +00:00