]> granicus.if.org Git - clang/log
clang
15 years agoremove dead code.
Zhongxing Xu [Wed, 15 Apr 2009 03:36:15 +0000 (03:36 +0000)]
remove dead code.

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

15 years agoTweaks to Objective-C metadata (32 & 64-bit) to match llvm-gcc.
Daniel Dunbar [Wed, 15 Apr 2009 02:56:18 +0000 (02:56 +0000)]
Tweaks to Objective-C metadata (32 & 64-bit) to match llvm-gcc.
 - Set alignment on property lists.
 - 32-bit:
   o Set section on property lists.
   o Fix section name for category class methods.
   o Fix symbol name for property lists.
   o Fix section name for class method.
   o Set alignment and section on class extension structure.
   o Set alignment on a number of things: instance variables, methods,
   method descriptions, the symbols structure.
 - 64-bit:
   o Fix section flags for protocol list.

I doubt most of these were problems in practice, but it is nice to
match llvm-gcc.

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

15 years agoDriver: For clang, accept -fsigned-bitfields and reject
Daniel Dunbar [Wed, 15 Apr 2009 02:37:43 +0000 (02:37 +0000)]
Driver: For clang, accept -fsigned-bitfields and reject
-funsigned-bitfields for now (clang defaults to -fsigned-bitfields).
 - <rdar://problem/6790309> ER: Support
   -fsigned-bitfields/-funsigned-bitfields

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

15 years agoPCH support for CStyleCastExpr and BinaryOperator expression kinds.
Douglas Gregor [Wed, 15 Apr 2009 00:25:59 +0000 (00:25 +0000)]
PCH support for CStyleCastExpr and BinaryOperator expression kinds.

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

15 years agoImprove "assignment to cast" diagnostic.
Daniel Dunbar [Wed, 15 Apr 2009 00:08:05 +0000 (00:08 +0000)]
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;
    ~ ^

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

15 years agoPCH support for ParenExpr
Douglas Gregor [Tue, 14 Apr 2009 23:59:37 +0000 (23:59 +0000)]
PCH support for ParenExpr

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

15 years agoAdd PCH support for ImplicitCastExprs. This is the first expression
Douglas Gregor [Tue, 14 Apr 2009 23:32:43 +0000 (23:32 +0000)]
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.

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

15 years agoStrip paren expressions when trying to diagnose "cast as lvalue"
Daniel Dunbar [Tue, 14 Apr 2009 23:26:44 +0000 (23:26 +0000)]
Strip paren expressions when trying to diagnose "cast as lvalue"
extension.

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

15 years agoChange Lexer::MeasureTokenLength to take a LangOptions reference.
Chris Lattner [Tue, 14 Apr 2009 23:22:57 +0000 (23:22 +0000)]
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.

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

15 years agoDiagnose properties which have no implementations;
Fariborz Jahanian [Tue, 14 Apr 2009 23:15:21 +0000 (23:15 +0000)]
Diagnose properties which have no implementations;
either unimplemented setter/getter or no
implementation directive.

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

15 years agoSet alignment on __cstring metadata variables to 1 (matching
Daniel Dunbar [Tue, 14 Apr 2009 23:14:47 +0000 (23:14 +0000)]
Set alignment on __cstring metadata variables to 1 (matching
llvm-gcc).

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

15 years agoAvoid use of magic \01 prefix when unneeded.
Daniel Dunbar [Tue, 14 Apr 2009 22:44:26 +0000 (22:44 +0000)]
Avoid use of magic \01 prefix when unneeded.

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

15 years agoadd fixitrewriter to xcode proj
Chris Lattner [Tue, 14 Apr 2009 22:44:23 +0000 (22:44 +0000)]
add fixitrewriter to xcode proj

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

15 years agoComment fix.
Daniel Dunbar [Tue, 14 Apr 2009 22:41:13 +0000 (22:41 +0000)]
Comment fix.

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

15 years agoMake the implicit-int handling error recovery stuff handle C++
Chris Lattner [Tue, 14 Apr 2009 22:17:06 +0000 (22:17 +0000)]
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.

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

15 years agoAdd PCH support for PredefinedExpr and FloatingLiteral expressions
Douglas Gregor [Tue, 14 Apr 2009 21:55:33 +0000 (21:55 +0000)]
Add PCH support for PredefinedExpr and FloatingLiteral expressions

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

15 years agorefactor "implicit int error recovery" code out of
Chris Lattner [Tue, 14 Apr 2009 21:34:55 +0000 (21:34 +0000)]
refactor "implicit int error recovery" code out of
ParseDeclarationSpecifiers into its own function, no
functionality change.

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

15 years agoPCH support for a few very, very simple kinds of expressions. Hook up
Douglas Gregor [Tue, 14 Apr 2009 21:18:50 +0000 (21:18 +0000)]
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.

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

15 years agoFix a regression in a previous patch that broke implicit
Chris Lattner [Tue, 14 Apr 2009 21:16:09 +0000 (21:16 +0000)]
Fix a regression in a previous patch that broke implicit
int in a bitfield.  Shantonu found this in a gcc testsuite file.

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

15 years agoFix <rdar://problem/6252084> [sema] jumps into Obj-C exception blocks should be disal...
Steve Naroff [Tue, 14 Apr 2009 20:53:38 +0000 (20:53 +0000)]
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.

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

15 years agoadd support for -W[no-]extra-tokens
Chris Lattner [Tue, 14 Apr 2009 20:36:01 +0000 (20:36 +0000)]
add support for -W[no-]extra-tokens

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

15 years agoremove dead enum
Chris Lattner [Tue, 14 Apr 2009 20:30:29 +0000 (20:30 +0000)]
remove dead enum

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

15 years agoFix PR3988: extern inline functions get strong symbol definitions in
Chris Lattner [Tue, 14 Apr 2009 20:25:53 +0000 (20:25 +0000)]
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.

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

15 years agoDo not dead code strip global meta-data objects.
Fariborz Jahanian [Tue, 14 Apr 2009 18:41:56 +0000 (18:41 +0000)]
Do not dead code strip global meta-data objects.
This will match gcc's behavior in the arena.

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

15 years agoFixup whitespacing.
Mike Stump [Tue, 14 Apr 2009 18:24:37 +0000 (18:24 +0000)]
Fixup whitespacing.

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

15 years agotemporarily revert r69046
Chris Lattner [Tue, 14 Apr 2009 18:05:08 +0000 (18:05 +0000)]
temporarily revert r69046

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

15 years agoFix comment.
Daniel Dunbar [Tue, 14 Apr 2009 17:42:51 +0000 (17:42 +0000)]
Fix comment.

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

15 years agoAdd a tricky, tricky test case for PCH that we currently don't handle. Committed...
Douglas Gregor [Tue, 14 Apr 2009 17:10:28 +0000 (17:10 +0000)]
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

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

15 years agoimplement some sema for gnuc_inline attribute. Reject always_inline and no_inline...
Chris Lattner [Tue, 14 Apr 2009 17:02:11 +0000 (17:02 +0000)]
implement some sema for gnuc_inline attribute.  Reject always_inline and no_inline on objc methods.

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

15 years agoSupport code generation of 'this' exprs
Anders Carlsson [Tue, 14 Apr 2009 16:58:56 +0000 (16:58 +0000)]
Support code generation of 'this' exprs

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

15 years agoLiteral value calculation isn't likely to overflow on targets having int as 32 or...
Sanjiv Gupta [Tue, 14 Apr 2009 16:46:37 +0000 (16:46 +0000)]
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.

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

15 years agoimplement codegen support for __attribute((__gnuc_inline__)),
Chris Lattner [Tue, 14 Apr 2009 16:44:36 +0000 (16:44 +0000)]
implement codegen support for __attribute((__gnuc_inline__)),
pulling some attribute munging stuff into GetLinkageForFunction.

This should fix PR3986

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

15 years agorecognize the gnuc_inline attribute.
Chris Lattner [Tue, 14 Apr 2009 16:30:50 +0000 (16:30 +0000)]
recognize the gnuc_inline attribute.

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

15 years agoWhen building a PCH file, don't perform end-of-translation-unit
Douglas Gregor [Tue, 14 Apr 2009 16:27:31 +0000 (16:27 +0000)]
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.

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

15 years agoASTContext::mergeTypes(): Loosen up the type checking for 'Class' (treating it like...
Steve Naroff [Tue, 14 Apr 2009 15:11:46 +0000 (15:11 +0000)]
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).

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

15 years agoRefactor how attributes are set on values.
Daniel Dunbar [Tue, 14 Apr 2009 08:05:55 +0000 (08:05 +0000)]
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.

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

15 years agoSplit SetGlobalValueAttributes into definition/declaration halves.
Daniel Dunbar [Tue, 14 Apr 2009 07:19:20 +0000 (07:19 +0000)]
Split SetGlobalValueAttributes into definition/declaration halves.
 - No functionality change.

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

15 years agoRename (one) SetFunctionAttributes to SetLLVMFunctionAttributes to
Daniel Dunbar [Tue, 14 Apr 2009 07:08:30 +0000 (07:08 +0000)]
Rename (one) SetFunctionAttributes to SetLLVMFunctionAttributes to
disambiguate it.
 - No functionality change.

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

15 years agoReduce indentation, no functionality change.
Daniel Dunbar [Tue, 14 Apr 2009 07:02:17 +0000 (07:02 +0000)]
Reduce indentation, no functionality change.

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

15 years agodefer emission of always_inline, extern_inline, and inline functions (when
Chris Lattner [Tue, 14 Apr 2009 06:44:48 +0000 (06:44 +0000)]
defer emission of always_inline, extern_inline, and inline functions (when
not in c89 mode).

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

15 years agogive always_inline functions internal linkage. If they cannot be
Chris Lattner [Tue, 14 Apr 2009 06:32:05 +0000 (06:32 +0000)]
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.

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

15 years agoset the linkage of an inline function according to its language rules.
Chris Lattner [Tue, 14 Apr 2009 06:27:57 +0000 (06:27 +0000)]
set the linkage of an inline function according to its language rules.

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

15 years agoAdd a comment on SetGlobalValueAttributes.
Daniel Dunbar [Tue, 14 Apr 2009 06:19:49 +0000 (06:19 +0000)]
Add a comment on SetGlobalValueAttributes.

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

15 years agoadd a new enum type for linkage, no functionality change.
Chris Lattner [Tue, 14 Apr 2009 06:04:17 +0000 (06:04 +0000)]
add a new enum type for linkage, no functionality change.

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

15 years agoClean up handling of visibility.
Daniel Dunbar [Tue, 14 Apr 2009 06:00:08 +0000 (06:00 +0000)]
Clean up handling of visibility.

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

15 years agoreduce indentation, no functionality change.
Chris Lattner [Tue, 14 Apr 2009 05:33:52 +0000 (05:33 +0000)]
reduce indentation, no functionality change.

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

15 years agodo not set visibility on "private" or "available externally" linkage objects.
Chris Lattner [Tue, 14 Apr 2009 05:27:13 +0000 (05:27 +0000)]
do not set visibility on "private" or "available externally" linkage objects.

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

15 years agoOffer a fixit hint for our warning about tokens at the end of a directive:
Chris Lattner [Tue, 14 Apr 2009 05:15:20 +0000 (05:15 +0000)]
Offer a fixit hint for our warning about tokens at the end of a directive:

t.c:3:8: warning: extra tokens at end of #endif directive
#endif foo
       ^
       //

Don't do this in strict-C89 mode because bcpl comments aren't
valid there, and it is too much trouble to analyze whether
C block comments are safe.

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

15 years agoFix the #import / #include_next "extra tokens at end of #foo directive"
Chris Lattner [Tue, 14 Apr 2009 05:07:49 +0000 (05:07 +0000)]
Fix the #import / #include_next "extra tokens at end of #foo directive"
Warning to properly report that it is an import/include_next instead of
claiming it is a #include.

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

15 years agoUse hasAttr instead of getAttr for conditionals.
Mike Stump [Tue, 14 Apr 2009 02:45:29 +0000 (02:45 +0000)]
Use hasAttr instead of getAttr for conditionals.

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

15 years agoAudit __private_extern__ handling.
Daniel Dunbar [Tue, 14 Apr 2009 02:25:56 +0000 (02:25 +0000)]
Audit __private_extern__ handling.
 - Exposed quite a few Sema issues and a CodeGen crash.

 - See FIXMEs in test case, and in SemaDecl.cpp (PR3983).

I'm skeptical that __private_extern__ should actually be a storage
class value. I think that __private_extern__ basically amounts to
  extern A __attribute__((visibility("hidden")))
and would be better off handled (a) as that, or (b) with an extra bit
in the VarDecl.

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

15 years agoAdd VarDecl::getStorageClassSpecifierString (StorageClass -> const char*).
Daniel Dunbar [Tue, 14 Apr 2009 02:08:49 +0000 (02:08 +0000)]
Add VarDecl::getStorageClassSpecifierString (StorageClass -> const char*).
 - No functionality change.

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

15 years agoFixup CodeGen for __weak __block variables. Radar 6756266
Mike Stump [Tue, 14 Apr 2009 00:57:29 +0000 (00:57 +0000)]
Fixup CodeGen for __weak __block variables.  Radar 6756266

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

15 years agoFix build error.
Mike Stump [Tue, 14 Apr 2009 00:56:59 +0000 (00:56 +0000)]
Fix build error.

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

15 years agoChange dyn_cast<> to isa<>. Pointed out by Anders (thanks).
Steve Naroff [Tue, 14 Apr 2009 00:40:09 +0000 (00:40 +0000)]
Change dyn_cast<> to isa<>. Pointed out by Anders (thanks).

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

15 years agoWhen writing a PCH file, keep track of all of the non-static,
Douglas Gregor [Tue, 14 Apr 2009 00:24:19 +0000 (00:24 +0000)]
When writing a PCH file, keep track of all of the non-static,
non-inline external definitions (and tentative definitions) that are
found at the top level. The corresponding declarations are stored in a
record in the PCH file, so that they can be provided to the
ASTConsumer (via HandleTopLevelDecl) when the PCH file is read.

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

15 years agoFix crasher in ASTContext::getObjCEncodingForMethodDecl().
Steve Naroff [Tue, 14 Apr 2009 00:03:58 +0000 (00:03 +0000)]
Fix crasher in ASTContext::getObjCEncodingForMethodDecl().

This was exposed as a result of something else that was recently fixed.

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

15 years agoPartial PCH support for FileScopeAsmDecl and BlockDecl. Both require
Douglas Gregor [Mon, 13 Apr 2009 22:49:25 +0000 (22:49 +0000)]
Partial PCH support for FileScopeAsmDecl and BlockDecl. Both require
expression or statement serialization before we can test them.

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

15 years agoPCH support for functions and their parameters.
Douglas Gregor [Mon, 13 Apr 2009 22:18:37 +0000 (22:18 +0000)]
PCH support for functions and their parameters.

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

15 years agoMinor work related to removing the assumption that value initialization
Eli Friedman [Mon, 13 Apr 2009 21:47:26 +0000 (21:47 +0000)]
Minor work related to removing the assumption that value initialization
implies an all-zero bit pattern.

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

15 years agoMinor simplification.
Eli Friedman [Mon, 13 Apr 2009 21:41:57 +0000 (21:41 +0000)]
Minor simplification.

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

15 years agoPR3461: reject initializer for incomplete type. Based on patch by Tim
Eli Friedman [Mon, 13 Apr 2009 21:28:54 +0000 (21:28 +0000)]
PR3461: reject initializer for incomplete type.  Based on patch by Tim
Northover.

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

15 years agoRemove CheckBuiltinMacros script, obsoleted since we support -dM now.
Daniel Dunbar [Mon, 13 Apr 2009 21:26:41 +0000 (21:26 +0000)]
Remove CheckBuiltinMacros script, obsoleted since we support -dM now.

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

15 years agoIgnore Output directory
Daniel Dunbar [Mon, 13 Apr 2009 21:25:25 +0000 (21:25 +0000)]
Ignore Output directory

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

15 years agoPCH support for record decls/types and their fields. Now that we can
Douglas Gregor [Mon, 13 Apr 2009 21:20:57 +0000 (21:20 +0000)]
PCH support for record decls/types and their fields. Now that we can
handle the definition of __builtin_va_list on x86-64, eliminate the
forced -triple in PCH tests to get better coverage.

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

15 years agoUpdate to use hasAttr() instead of getAttr().
Daniel Dunbar [Mon, 13 Apr 2009 21:08:27 +0000 (21:08 +0000)]
Update to use hasAttr() instead of getAttr().
 - No functionality change.

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

15 years agoPrint the number (and percentage) of identifiers read from the PCH file as part of...
Douglas Gregor [Mon, 13 Apr 2009 20:50:16 +0000 (20:50 +0000)]
Print the number (and percentage) of identifiers read from the PCH file as part of its statistics

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

15 years agoIntroduce PCH (de-)serialization for most compound types, excluding
Douglas Gregor [Mon, 13 Apr 2009 20:46:52 +0000 (20:46 +0000)]
Introduce PCH (de-)serialization for most compound types, excluding
Objective-C types and record types for the moment.

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

15 years agoReapply 68936, turned out to that clang's better debug info exposed a
Daniel Dunbar [Mon, 13 Apr 2009 20:46:33 +0000 (20:46 +0000)]
Reapply 68936, turned out to that clang's better debug info exposed a
codegenerator bug.

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

15 years agoMove/update recent FIXME (wrt UTF-8 checking for ObjC @-strings).
Steve Naroff [Mon, 13 Apr 2009 20:26:29 +0000 (20:26 +0000)]
Move/update recent FIXME (wrt UTF-8 checking for ObjC @-strings).

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

15 years agoupgrade "extra tokens at end of directive" to warn by default.
Chris Lattner [Mon, 13 Apr 2009 20:19:36 +0000 (20:19 +0000)]
upgrade "extra tokens at end of directive" to warn by default.

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

15 years agoIn objc2's None-Fragile ABI, one cannot use the super class ivar for
Fariborz Jahanian [Mon, 13 Apr 2009 19:30:37 +0000 (19:30 +0000)]
In objc2's None-Fragile ABI, one cannot use the super class ivar for
setter/getter synthesis.

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

15 years agoFixed crasher in <rdar://problem/6780904> [irgen] Assertion failed: (Result == conver...
Steve Naroff [Mon, 13 Apr 2009 19:08:08 +0000 (19:08 +0000)]
Fixed crasher in <rdar://problem/6780904> [irgen] Assertion failed: (Result == conversionOK && "UTF-8 to UTF-16 conversion failed"), function GetAddrOfConstantCFString, file CodeGenModule.cpp, line 1063.

Still a diagnostic related FIXME (will discuss with Daniel/Fariborz offline).

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

15 years agoAdd PCH support for enumerations and enumerators.
Douglas Gregor [Mon, 13 Apr 2009 18:14:40 +0000 (18:14 +0000)]
Add PCH support for enumerations and enumerators.

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

15 years agoRevert 68936, LLVM still isn't ready to handle debug info + optimization.
Daniel Dunbar [Mon, 13 Apr 2009 18:03:39 +0000 (18:03 +0000)]
Revert 68936, LLVM still isn't ready to handle debug info + optimization.

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

15 years agoUse the new guard variable mangling function and get rid of the old code.
Anders Carlsson [Mon, 13 Apr 2009 18:03:33 +0000 (18:03 +0000)]
Use the new guard variable mangling function and get rid of the old code.

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

15 years agoAdd support for mangling guard variables.
Anders Carlsson [Mon, 13 Apr 2009 18:02:10 +0000 (18:02 +0000)]
Add support for mangling guard variables.

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

15 years agoChange diagnostic as a result of researching <rdar://problem/6779809> missing interfa...
Steve Naroff [Mon, 13 Apr 2009 17:58:46 +0000 (17:58 +0000)]
Change diagnostic as a result of researching <rdar://problem/6779809> missing interface name in "error: cannot declare variable inside a class, protocol or category ''.

Since ObjC 2.0 class "extensions" have a null name, the diagnostic above is actually "correct". Nevertheless, it is confusing. Decided to remove the name entirely (from my perspective, it didn't add any value). Also simplified the text of the diagnostic a bit.

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

15 years agoFix assertion failure in PTH when tokens followed a closing #endif.
Daniel Dunbar [Mon, 13 Apr 2009 17:57:49 +0000 (17:57 +0000)]
Fix assertion failure in PTH when tokens followed a closing #endif.
 - Ted, please check.

 - Missing test case because PTH won't reliably cache the tokens in a
   test case. *cough*

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

15 years agoMake the reading of the line table from a PCH file more robust against
Douglas Gregor [Mon, 13 Apr 2009 17:12:42 +0000 (17:12 +0000)]
Make the reading of the line table from a PCH file more robust against
the unlikely event that the filename IDs in the stored line table end
up being different from the filename IDs in the newly-created line
table.

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

15 years agoInclude the SourceManager's line table in the PCH file. We can now
Douglas Gregor [Mon, 13 Apr 2009 16:31:14 +0000 (16:31 +0000)]
Include the SourceManager's line table in the PCH file. We can now
properly cope with #line directives in PCH files.

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

15 years agoFactor the internals of SourceManager (specially, LineTableInfo) into a separate...
Douglas Gregor [Mon, 13 Apr 2009 15:31:25 +0000 (15:31 +0000)]
Factor the internals of SourceManager (specially, LineTableInfo) into a separate Internals header. No functionality change

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

15 years agoMake the selection of type declarations in Sema::getTypeName
Douglas Gregor [Mon, 13 Apr 2009 15:14:38 +0000 (15:14 +0000)]
Make the selection of type declarations in Sema::getTypeName
deterministic when faced with an ambiguity. This eliminates the
annoying test/SemaCXX/using-directive.cpp failure.

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

15 years agothe driver caught up. This makes -msse3 correctly set __SSE3__ etc.
Chris Lattner [Mon, 13 Apr 2009 06:33:49 +0000 (06:33 +0000)]
the driver caught up.  This makes -msse3 correctly set __SSE3__ etc.

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

15 years agofix rdar://6774906, a crash handling implicit conversions between pointers
Chris Lattner [Mon, 13 Apr 2009 06:04:39 +0000 (06:04 +0000)]
fix rdar://6774906, a crash handling implicit conversions between pointers
in different address spaces.

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

15 years agoEnable debug info generation while optimizing.
Devang Patel [Mon, 13 Apr 2009 04:22:59 +0000 (04:22 +0000)]
Enable debug info generation while optimizing.

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

15 years agomention the non-standard builtin macros we support.
Chris Lattner [Mon, 13 Apr 2009 02:45:46 +0000 (02:45 +0000)]
mention the non-standard builtin macros we support.

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

15 years agoimplement the microsoft/gnu "__COUNTER__" macro: rdar://4329310
Chris Lattner [Mon, 13 Apr 2009 01:29:17 +0000 (01:29 +0000)]
implement the microsoft/gnu "__COUNTER__" macro: rdar://4329310

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

15 years agoImprove error recovery for calls, fixing:
Chris Lattner [Mon, 13 Apr 2009 00:10:38 +0000 (00:10 +0000)]
Improve error recovery for calls, fixing:
PR3972: Poor diagnostic with missing ')'

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

15 years agofix PR3932: [ObjC]Type defined as 'id' is not recognized as a valid object type.
Chris Lattner [Sun, 12 Apr 2009 23:51:02 +0000 (23:51 +0000)]
fix PR3932: [ObjC]Type defined as 'id' is not recognized as a valid object type.
by making ASTContext::isObjCObjectPointerType accept typedefs of id.

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

15 years agorename test
Chris Lattner [Sun, 12 Apr 2009 23:49:38 +0000 (23:49 +0000)]
rename test

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

15 years agoadd some more coverage.
Chris Lattner [Sun, 12 Apr 2009 23:29:27 +0000 (23:29 +0000)]
add some more coverage.

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

15 years agoclean up test.
Chris Lattner [Sun, 12 Apr 2009 23:27:53 +0000 (23:27 +0000)]
clean up test.

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

15 years agorename test
Chris Lattner [Sun, 12 Apr 2009 23:27:31 +0000 (23:27 +0000)]
rename test

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

15 years agoif we already know that a decl is invalid in an @catch, don't verify its type.
Chris Lattner [Sun, 12 Apr 2009 23:26:56 +0000 (23:26 +0000)]
if we already know that a decl is invalid in an @catch, don't verify its type.

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

15 years agofix some out of date comments pointed out by Sebastian
Chris Lattner [Sun, 12 Apr 2009 22:37:57 +0000 (22:37 +0000)]
fix some out of date comments pointed out by Sebastian

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

15 years agofix a comment typo Sebastian noticed.
Chris Lattner [Sun, 12 Apr 2009 22:30:22 +0000 (22:30 +0000)]
fix a comment typo Sebastian noticed.

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

15 years agoadd support for handling C++'0x unified initializer syntax
Chris Lattner [Sun, 12 Apr 2009 22:29:43 +0000 (22:29 +0000)]
add support for handling C++'0x unified initializer syntax
to isValidAfterIdentifierInDeclarator, as suggested by Sebastian.

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

15 years agoFix some C++ error recovery problems in init declarator parsing
Chris Lattner [Sun, 12 Apr 2009 22:23:27 +0000 (22:23 +0000)]
Fix some C++ error recovery problems in init declarator parsing
that I noticed working on other things.

Instead of emitting:

t2.cc:1:8: error: use of undeclared identifier 'g'
int x(*g);
       ^
t2.cc:1:10: error: expected ')'
int x(*g);
         ^
t2.cc:1:6: note: to match this '('
int x(*g);
     ^

We now only emit:

t2.cc:1:7: warning: type specifier missing, defaults to 'int'
int x(*g);
      ^

Note that the example in SemaCXX/nested-name-spec.cpp:f4 is still
not great, we now produce both of:

void f4(undef::C); // expected-error {{use of undeclared identifier 'undef'}} \
                      expected-error {{variable has incomplete type 'void'}}

The second diagnostic should be silenced by something getting marked invalid.
I don't plan to fix this though.

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

15 years agofix another case that assumed that GetTypeForDeclarator would never return null.
Chris Lattner [Sun, 12 Apr 2009 22:15:02 +0000 (22:15 +0000)]
fix another case that assumed that GetTypeForDeclarator would never return null.

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