Граф коммитов

2648 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor 673ecd6a4a PCH support for string literals
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69172 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 16:35:07 +00:00
Douglas Gregor 0b0b77fa29 PCH support for UnaryOperator, SizeOfAlignOfExpr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69169 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 15:58:59 +00:00
Steve Naroff ee3899e1ca Fix <rdar://problem/6789707> "warning: 'extern' variable has an initializer" not correct for __private_extern__.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69167 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 15:20:03 +00:00
Steve Naroff b25ddfb155 Fix <rdar://problem/6791490> [clang10 regression] [sema] invalid illegal jump diagnostic.
caused by: <rdar://problem/6252084> [sema] jumps into Obj-C exception blocks should be disallowed.

Sema::RecursiveCalcLabelScopes() and Sema::RecursiveCalcJumpScopes() need to pop the ScopeStack within the statement iteration loop (was outside the loop).

Eli, please review (thanks).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69165 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 14:38:36 +00:00
Chris Lattner 3fbbfcfea8 add another sanity check for -Werror=xx
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69157 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 07:05:12 +00:00
Chris Lattner 17e681fe9c add a missing &&
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69156 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 07:03:57 +00:00
Chris Lattner 92af210410 fix a broken test, that passed for the wrong reason. Two wrongs make a right! :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69155 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 07:02:57 +00:00
Chris Lattner 27ceb9d77d Rejigger how -pedantic and -pedantic-errors work and their interaction
with other diagnostic mapping.  In the new scheme, -Wfoo or -Wno-foo or 
-Werror=foo all override the -pedantic options, and __extension__ 
robustly silences all extension diagnostics in their scope.

An added bonus of this change is that MAP_DEFAULT goes away, meaning that
per-diagnostic mapping information can now be stored in 2 bits, doubling
the density of the Diagnostic::DiagMapping array.  This also 
substantially simplifies Diagnostic::getDiagnosticLevel.

OTOH, this temporarily introduces some "macro intensive" code in 
Diagnostic.cpp.  This will be addressed in a later patch.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69154 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 07:01:18 +00:00
Douglas Gregor ffb4b6e299 Implement support for designated initializers that refer to members of
anonymous structs or unions. Fixes PR3778.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69153 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 06:41:24 +00:00
Chris Lattner 372de1d26b remove #include of system header, making this a) not apple specific, and
b) test dramatically faster.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69135 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 04:26:10 +00:00
Daniel Dunbar 0bf2199b79 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
2009-04-15 02:56:18 +00:00
Douglas Gregor db600c330a 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
2009-04-15 00:25:59 +00:00
Daniel Dunbar 44e35f7b2b 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
2009-04-15 00:08:05 +00:00
Douglas Gregor c04db4feef PCH support for ParenExpr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69106 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14 23:59:37 +00:00
Douglas Gregor 087fd53680 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
2009-04-14 23:32:43 +00:00
Daniel Dunbar 5717daef56 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
2009-04-14 23:26:44 +00:00
Fariborz Jahanian 12bac2566e 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
2009-04-14 23:15:21 +00:00
Daniel Dunbar b90bb0099e 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
2009-04-14 23:14:47 +00:00
Chris Lattner f4382f50b7 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
2009-04-14 22:17:06 +00:00
Douglas Gregor 17fc223395 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
2009-04-14 21:55:33 +00:00
Douglas Gregor 0b7489194f 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
2009-04-14 21:18:50 +00:00
Chris Lattner b6645dd9ca 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
2009-04-14 21:16:09 +00:00
Steve Naroff 1fc5194039 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
2009-04-14 20:53:38 +00:00
Chris Lattner cbb8fc18d8 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
2009-04-14 20:25:53 +00:00
Douglas Gregor 2417ef739b 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
2009-04-14 17:10:28 +00:00
Chris Lattner c51974328b 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
2009-04-14 17:02:11 +00:00
Chris Lattner 86daeee2d4 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
2009-04-14 16:44:36 +00:00
Douglas Gregor f807fe0d1a 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
2009-04-14 16:27:31 +00:00
Steve Naroff d824c9c281 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
2009-04-14 15:11:46 +00:00
Chris Lattner dbb5a376c8 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
2009-04-14 06:44:48 +00:00
Chris Lattner d9d049a93c 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
2009-04-14 06:27:57 +00:00
Daniel Dunbar 5466c7b0ca 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
2009-04-14 02:25:56 +00:00
Mike Stump f33651c2d7 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
2009-04-14 00:57:29 +00:00
Douglas Gregor fdd0172ca1 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
2009-04-14 00:24:19 +00:00
Steve Naroff ab76d45e02 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
2009-04-14 00:03:58 +00:00
Douglas Gregor 3a2f7e4251 PCH support for functions and their parameters.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68997 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 22:18:37 +00:00
Eli Friedman a31fecaf63 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
2009-04-13 21:28:54 +00:00
Douglas Gregor 8c70006581 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
2009-04-13 21:20:57 +00:00
Douglas Gregor b4e715beeb 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
2009-04-13 20:46:52 +00:00
Fariborz Jahanian 29da66ec56 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
2009-04-13 19:30:37 +00:00
Steve Naroff aa4a756185 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
2009-04-13 19:08:08 +00:00
Douglas Gregor 0a2b45e588 Add PCH support for enumerations and enumerators.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68974 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 18:14:40 +00:00
Anders Carlsson 283a062a63 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
2009-04-13 18:03:33 +00:00
Steve Naroff 87454161a6 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
2009-04-13 17:58:46 +00:00
Douglas Gregor bd94500d3a 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
2009-04-13 16:31:14 +00:00
Douglas Gregor 841b53c502 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
2009-04-13 15:14:38 +00:00
Chris Lattner ecca753648 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
2009-04-13 06:04:39 +00:00
Chris Lattner c1f9d828c7 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
2009-04-13 01:29:17 +00:00
Chris Lattner 1721a2dfc0 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
2009-04-13 00:10:38 +00:00
Chris Lattner 16ede0ec39 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
2009-04-12 23:51:02 +00:00