]> granicus.if.org Git - clang/log
clang
14 years agoImplement template instantiation for Objective-C++ message sends. We
Douglas Gregor [Thu, 22 Apr 2010 16:44:27 +0000 (16:44 +0000)]
Implement template instantiation for Objective-C++ message sends. We
support dependent receivers for class and instance messages, along
with dependent message arguments (of course), and check as much as we
can at template definition time.

This commit also deals with a subtle aspect of template instantiation
in Objective-C++, where the type 'T *' can morph from a dependent
PointerType into a non-dependent ObjCObjectPointer type.

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

14 years agoARM/APCS: Don't respect bit-field types when laying out structures.
Daniel Dunbar [Thu, 22 Apr 2010 16:14:54 +0000 (16:14 +0000)]
ARM/APCS: Don't respect bit-field types when laying out structures.
 - This fixes the last known ABI issues with ARM/APCS.

 - I've run the first 1k ABITests with '--no-unsigned --no-vector --no-complex'
   on {armv6, armv7} x {-mno-thumb, -mthumb}, and the first 10k tests for armv7
   -mthumb, for both function return types and single argument calls. These all
   pass now (they failed horribly before without --no-bitfield).

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

14 years agoIRgen: Fix another case where we generated an invalid access component when we
Daniel Dunbar [Thu, 22 Apr 2010 15:22:33 +0000 (15:22 +0000)]
IRgen: Fix another case where we generated an invalid access component when we
immediately narrowed the access size. Fix this (and previous case) by just
choosing a better access size up-front.

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

14 years agoIRgen: Fix case where we might generate an access component with width == 0, if
Daniel Dunbar [Thu, 22 Apr 2010 14:56:10 +0000 (14:56 +0000)]
IRgen: Fix case where we might generate an access component with width == 0, if
we have to narrow the access side immediately (can happen with packed,
-fno-bitfield-type-align).

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

14 years agoWhen checking whether to diagnose an initialized "extern" variable,
Douglas Gregor [Thu, 22 Apr 2010 14:36:26 +0000 (14:36 +0000)]
When checking whether to diagnose an initialized "extern" variable,
look for the const on the base type rather than on the top-level
type. Fixes PR6495 properly.

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

14 years agoRecord nested-name-specifiers of when we create
Douglas Gregor [Thu, 22 Apr 2010 14:24:35 +0000 (14:24 +0000)]
Record nested-name-specifiers of when we create
elaborated-type-specifiers. Patch by Enea Zaffanella!

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

14 years agoRe-land the patch that merges two diagnostics into one now that it passes self-host :)
Anders Carlsson [Thu, 22 Apr 2010 05:40:53 +0000 (05:40 +0000)]
Re-land the patch that merges two diagnostics into one now that it passes self-host :)

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

14 years agoNeuter this testcase a little. The way LLVM writes labels for anonymous blocks
John McCall [Thu, 22 Apr 2010 03:27:09 +0000 (03:27 +0000)]
Neuter this testcase a little.  The way LLVM writes labels for anonymous blocks
makes it impossible to check labels.

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

14 years agoSuppress compiler warning.
Daniel Dunbar [Thu, 22 Apr 2010 03:17:06 +0000 (03:17 +0000)]
Suppress compiler warning.

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

14 years agoIRgen: Set alignment correctly on bit-field accesses.
Daniel Dunbar [Thu, 22 Apr 2010 03:17:04 +0000 (03:17 +0000)]
IRgen: Set alignment correctly on bit-field accesses.

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

14 years agoIRgen: Rewrite bit-field access policy to not access data beyond the bounds of the...
Daniel Dunbar [Thu, 22 Apr 2010 02:35:46 +0000 (02:35 +0000)]
IRgen: Rewrite bit-field access policy to not access data beyond the bounds of the structure, which we also now verify as part of the post-layout consistency checks.
 - This fixes some pedantic bugs with packed structures, as well as major problems with -fno-bitfield-type-align.

 - Fixes PR5591, PR5567, and all known -fno-bitfield-type-align issues.

 - Review appreciated.

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

14 years agoIRgen: Fix CGRecordLayout::print to print the bit-field infos in a consistent order.
Daniel Dunbar [Thu, 22 Apr 2010 02:35:36 +0000 (02:35 +0000)]
IRgen: Fix CGRecordLayout::print to print the bit-field infos in a consistent order.

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

14 years agoRevert "Unify two diagnostics into one.", it breaks with an assertion failure on...
Daniel Dunbar [Thu, 22 Apr 2010 02:35:33 +0000 (02:35 +0000)]
Revert "Unify two diagnostics into one.", it breaks with an assertion failure on bootstrap.

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

14 years agoUnify two diagnostics into one.
Anders Carlsson [Thu, 22 Apr 2010 01:17:32 +0000 (01:17 +0000)]
Unify two diagnostics into one.

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

14 years agoCall PerformCopyInitialization to properly initialize the exception temporary
John McCall [Thu, 22 Apr 2010 01:10:34 +0000 (01:10 +0000)]
Call PerformCopyInitialization to properly initialize the exception temporary
in a throw expression.  Use EmitAnyExprToMem to emit the throw expression,
which magically elides the final copy-constructor call (which raises a new
strict-compliance bug, but baby steps).  Give __cxa_throw a destructor pointer
if the exception type has a non-trivial destructor.

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

14 years agoWhenever we complain about a failed initialization of a function or
Douglas Gregor [Thu, 22 Apr 2010 00:20:18 +0000 (00:20 +0000)]
Whenever we complain about a failed initialization of a function or
method parameter, provide a note pointing at the parameter itself so
the user does not have to manually look for the function/method being
called and match up parameters to arguments. For example, we now get:

t.c:4:5: warning: incompatible pointer types passing 'long *' to
parameter of
      type 'int *' [-pedantic]
  f(long_ptr);
    ^~~~~~~~
t.c:1:13: note: passing argument to parameter 'x' here
void f(int *x);
            ^

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

14 years agoRemove an unused declaration.
Anders Carlsson [Wed, 21 Apr 2010 23:55:31 +0000 (23:55 +0000)]
Remove an unused declaration.

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

14 years agoWhen computing the alignof value for a vector type, ensure that
Dan Gohman [Wed, 21 Apr 2010 23:32:43 +0000 (23:32 +0000)]
When computing the alignof value for a vector type, ensure that
the alignment is a power of 2, even in the esoteric case of a
vector element which does not have a power-of-2 sizeof value.

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

14 years agoSwitch the initialization of Objective-C message parameters (as occurs
Douglas Gregor [Wed, 21 Apr 2010 23:24:10 +0000 (23:24 +0000)]
Switch the initialization of Objective-C message parameters (as occurs
during message sends) over to the new initialization code and away
from the C-only CheckSingleAssignmentConstraints. The enables the use
of C++ types in method parameters and message arguments, as well as
unifying more initialiation code overall.

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

14 years agoEncode field accessibility.
Devang Patel [Wed, 21 Apr 2010 23:12:37 +0000 (23:12 +0000)]
Encode field accessibility.

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

14 years agoImplement parsing for message sends in Objective-C++. Message sends in
Douglas Gregor [Wed, 21 Apr 2010 22:36:40 +0000 (22:36 +0000)]
Implement parsing for message sends in Objective-C++. Message sends in
Objective-C++ have a more complex grammar than in Objective-C
(surprise!), because

  (1) The receiver of an instance message can be a qualified name such
  as ::I or identity<I>::type.
  (2) Expressions in C++ can start with a type.

The receiver grammar isn't actually ambiguous; it just takes a bit of
work to parse past the type before deciding whether we have a type or
expression. We do this in two places within the grammar: once for
message sends and once when we're determining whether a []'d clause in
an initializer list is a message send or a C99 designated initializer.

This implementation of Objective-C++ message sends contains one known
extension beyond GCC's implementation, which is to permit a
typename-specifier as the receiver type for a class message, e.g.,

  [typename compute_receiver_type<T>::type method];

Note that the same effect can be achieved in GCC by way of a typedef,
e.g.,

  typedef typename computed_receiver_type<T>::type Computed;
  [Computed method];

so this is merely a convenience.

Note also that message sends still cannot involve dependent types or
values.

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

14 years agoMigrate the responsibility for turning the receiver name in an
Douglas Gregor [Wed, 21 Apr 2010 20:38:13 +0000 (20:38 +0000)]
Migrate the responsibility for turning the receiver name in an
Objective-C class message expression into a type from the parser
(which was doing so in two places) to Action::getObjCMessageKind()
which, in the case of Sema, reduces the number of name lookups we need
to perform.

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

14 years agoDiagnose access to fields with private constructors.
Anders Carlsson [Wed, 21 Apr 2010 20:28:29 +0000 (20:28 +0000)]
Diagnose access to fields with private constructors.

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

14 years agoEliminate unused code in Sema::ActOnSuperMessage and use early exits
Douglas Gregor [Wed, 21 Apr 2010 20:01:04 +0000 (20:01 +0000)]
Eliminate unused code in Sema::ActOnSuperMessage and use early exits
to reduce nesting. No functionality change.

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

14 years agoRework the Parser-Sema interaction for Objective-C message
Douglas Gregor [Wed, 21 Apr 2010 19:57:20 +0000 (19:57 +0000)]
Rework the Parser-Sema interaction for Objective-C message
sends. Major changes include:

  - Expanded the interface from two actions (ActOnInstanceMessage,
    ActOnClassMessage), where ActOnClassMessage also handled sends to
    "super" by checking whether the identifier was "super", to three
    actions (ActOnInstanceMessage, ActOnClassMessage,
    ActOnSuperMessage). Code completion has the same changes.
  - The parser now resolves the type to which we are sending a class
    message, so ActOnClassMessage now accepts a TypeTy* (rather than
    an IdentifierInfo *). This opens the door to more interesting
    types (for Objective-C++ support).
  - Split ActOnInstanceMessage and ActOnClassMessage into parser
    action functions (with their original names) and semantic
    functions (BuildInstanceMessage and BuildClassMessage,
    respectively). At present, this split is onyl used by
    ActOnSuperMessage, which decides which kind of super message it
    has and forwards to the appropriate Build*Message. In the future,
    Build*Message will be used by template instantiation.
  - Use getObjCMessageKind() within the disambiguation of Objective-C
    message sends vs. array designators.

Two notes about substandard bits in this patch:
  - There is some redundancy in the code in ParseObjCMessageExpr and
  ParseInitializerWithPotentialDesignator; this will be addressed
  shortly by centralizing the mapping from identifiers to type names
  for the message receiver.
  - There is some #if 0'd code that won't likely ever be used---it
  handles the use of 'super' in methods whose class does not have a
  superclass---but could be used to model GCC's behavior more
  closely. This code will die in my next check-in, but I want it in
  Subversion.

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

14 years agoKeep tack of whether a base in an InitializedEntity is an inherited virtual base...
Anders Carlsson [Wed, 21 Apr 2010 19:52:01 +0000 (19:52 +0000)]
Keep tack of whether a base in an InitializedEntity is an inherited virtual base or not. Use this in CheckConstructorAccess.

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

14 years agoABI/x86-32 & x86-64: Alignment on 'byval' must be set when when the alignment
Daniel Dunbar [Wed, 21 Apr 2010 19:49:55 +0000 (19:49 +0000)]
ABI/x86-32 & x86-64: Alignment on 'byval' must be set when when the alignment
exceeds the minimum ABI alignment.

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

14 years agoConvert test to FileCheck.
Daniel Dunbar [Wed, 21 Apr 2010 19:34:17 +0000 (19:34 +0000)]
Convert test to FileCheck.

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

14 years agoConvert test to FileCheck.
Daniel Dunbar [Wed, 21 Apr 2010 19:10:54 +0000 (19:10 +0000)]
Convert test to FileCheck.

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

14 years agoIRgen/x86-32: Factor out getIndirectResult(), to match x86-64 factoring.
Daniel Dunbar [Wed, 21 Apr 2010 19:10:51 +0000 (19:10 +0000)]
IRgen/x86-32: Factor out getIndirectResult(), to match x86-64 factoring.

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

14 years agoIRgen: Add checking that the LLVM and AST record layout offsets agree (for
Daniel Dunbar [Wed, 21 Apr 2010 19:10:49 +0000 (19:10 +0000)]
IRgen: Add checking that the LLVM and AST record layout offsets agree (for
non-bit-fields).

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

14 years agoImprove on source location of diagnostic when default
Fariborz Jahanian [Wed, 21 Apr 2010 18:57:20 +0000 (18:57 +0000)]
Improve on source location of diagnostic when default
property synthesis is using a super class ivar.

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

14 years agoPass the InitializedEntity to Sema::CheckConstructorAccess and use it to report diffe...
Anders Carlsson [Wed, 21 Apr 2010 18:47:17 +0000 (18:47 +0000)]
Pass the InitializedEntity to Sema::CheckConstructorAccess and use it to report different diagnostics depending on which entity is being initialized.

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

14 years agoComment out an assert for now.
Anders Carlsson [Wed, 21 Apr 2010 18:03:05 +0000 (18:03 +0000)]
Comment out an assert for now.

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

14 years agoFix typo.
Fariborz Jahanian [Wed, 21 Apr 2010 17:09:27 +0000 (17:09 +0000)]
Fix typo.

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

14 years agoAdd more const to ConstExprIterator.
Benjamin Kramer [Wed, 21 Apr 2010 12:21:20 +0000 (12:21 +0000)]
Add more const to ConstExprIterator.

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

14 years agoI failed to notice that my last patch wasn't doing as much as it could
John McCall [Wed, 21 Apr 2010 11:18:06 +0000 (11:18 +0000)]
I failed to notice that my last patch wasn't doing as much as it could
because EmitBranch actually clears the insert point.  This version
actually accomplishes what I initially wanted.

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

14 years agoTeach EmitBlock to put the target block immediately after the current block
John McCall [Wed, 21 Apr 2010 10:29:06 +0000 (10:29 +0000)]
Teach EmitBlock to put the target block immediately after the current block
(if there's a current block).  The chief advantage of doing this is that it
lets us pick blocks (e.g. EH blocks) to push to the end of the function so
that fallthrough happens consistently --- i.e. it gives us the flexibility
of ordering blocks as we please without having to change the order in which
we generate code.  There are standard (?) optimization passes which can do some
of that for us, but better to generate reasonable code to begin with.

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

14 years agoMiscellaneous codegen cleanups. Mostly, don't create new basic blocks
John McCall [Wed, 21 Apr 2010 10:05:39 +0000 (10:05 +0000)]
Miscellaneous codegen cleanups.  Mostly, don't create new basic blocks
just to save the current insertion state!  This change significantly
simplifies the IR CFG in exceptions code.

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

14 years agoCXXNamedCastExpr is actually an abstract expression.
Zhongxing Xu [Wed, 21 Apr 2010 06:32:25 +0000 (06:32 +0000)]
CXXNamedCastExpr is actually an abstract expression.

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

14 years agoSink the _GNU_SOURCE definition down into the target configuration,
Douglas Gregor [Wed, 21 Apr 2010 05:52:38 +0000 (05:52 +0000)]
Sink the _GNU_SOURCE definition down into the target configuration,
and only define it where we know we need it---Linux and Cygwin. Thanks
to Chris for the prodding.

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

14 years agoReword the note we emit when suppressing template instantiation contexts, per John...
Douglas Gregor [Wed, 21 Apr 2010 05:40:43 +0000 (05:40 +0000)]
Reword the note we emit when suppressing template instantiation contexts, per John's advice

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

14 years agoThe second check point in the old test case was invalid.
Zhongxing Xu [Wed, 21 Apr 2010 02:22:25 +0000 (02:22 +0000)]
The second check point in the old test case was invalid.

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

14 years agoUse const_cast instead of a C cast. Safer, plus it suppresses a gcc warning.
John McCall [Wed, 21 Apr 2010 02:20:33 +0000 (02:20 +0000)]
Use const_cast instead of a C cast.  Safer, plus it suppresses a gcc warning.

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

14 years agoUse the right predecessor.
Zhongxing Xu [Wed, 21 Apr 2010 02:20:10 +0000 (02:20 +0000)]
Use the right predecessor.

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

14 years agoAdd initial support for C++ delete expr.
Zhongxing Xu [Wed, 21 Apr 2010 02:17:31 +0000 (02:17 +0000)]
Add initial support for C++ delete expr.

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

14 years agoOverhaul the AST representation of Objective-C message send
Douglas Gregor [Wed, 21 Apr 2010 00:45:42 +0000 (00:45 +0000)]
Overhaul the AST representation of Objective-C message send
expressions, to improve source-location information, clarify the
actual receiver of the message, and pave the way for proper C++
support. The ObjCMessageExpr node represents four different kinds of
message sends in a single AST node:

  1) Send to a object instance described by an expression (e.g., [x method:5])
  2) Send to a class described by the class name (e.g., [NSString method:5])
  3) Send to a superclass class (e.g, [super method:5] in class method)
  4) Send to a superclass instance (e.g., [super method:5] in instance method)

Previously these four cases where tangled together. Now, they have
more distinct representations. Specific changes:

  1) Unchanged; the object instance is represented by an Expr*.

  2) Previously stored the ObjCInterfaceDecl* referring to the class
  receiving the message. Now stores a TypeSourceInfo* so that we know
  how the class was spelled. This both maintains typedef information
  and opens the door for more complicated C++ types (e.g., dependent
  types). There was an alternative, unused representation of these
  sends by naming the class via an IdentifierInfo *. In practice, we
  either had an ObjCInterfaceDecl *, from which we would get the
  IdentifierInfo *, or we fell into the case below...

  3) Previously represented by a class message whose IdentifierInfo *
  referred to "super". Sema and CodeGen would use isStr("super") to
  determine if they had a send to super. Now represented as a
  "class super" send, where we have both the location of the "super"
  keyword and the ObjCInterfaceDecl* of the superclass we're
  targetting (statically).

  4) Previously represented by an instance message whose receiver is a
  an ObjCSuperExpr, which Sema and CodeGen would check for via
  isa<ObjCSuperExpr>(). Now represented as an "instance super" send,
  where we have both the location of the "super" keyword and the
  ObjCInterfaceDecl* of the superclass we're targetting
  (statically). Note that ObjCSuperExpr only has one remaining use in
  the AST, which is for "super.prop" references.

The new representation of ObjCMessageExpr is 2 pointers smaller than
the old one, since it combines more storage. It also eliminates a leak
when we loaded message-send expressions from a precompiled header. The
representation also feels much cleaner to me; comments welcome!

This patch attempts to maintain the same semantics we previously had
with Objective-C message sends. In several places, there are massive
changes that boil down to simply replacing a nested-if structure such
as:

  if (message has a receiver expression) {
    // instance message
    if (isa<ObjCSuperExpr>(...)) {
     // send to super
    } else {
     // send to an object
   }
  } else {
    // class message
    if (name->isStr("super")) {
      // class send to super
    } else {
      // send to class
    }
  }

with a switch

  switch (E->getReceiverKind()) {
  case ObjCMessageExpr::SuperInstance: ...
  case ObjCMessageExpr::Instance: ...
  case ObjCMessageExpr::SuperClass: ...
  case ObjCMessageExpr::Class:...
  }

There are quite a few places (particularly in the checkers) where
send-to-super is effectively ignored. I've placed FIXMEs in most of
them, and attempted to address send-to-super in a reasonable way. This
could use some review.

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

14 years agoRemove an unused parameter from isImplicitlyDefined.
Anders Carlsson [Tue, 20 Apr 2010 23:32:58 +0000 (23:32 +0000)]
Remove an unused parameter from isImplicitlyDefined.

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

14 years agoFix comment to reflect recent code change.
John Thompson [Tue, 20 Apr 2010 23:21:17 +0000 (23:21 +0000)]
Fix comment to reflect recent code change.

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

14 years agoFix USRs for 'extern' variables declaration in functions/method bodies.
Ted Kremenek [Tue, 20 Apr 2010 23:15:40 +0000 (23:15 +0000)]
Fix USRs for 'extern' variables declaration in functions/method bodies.
Fix USRs for @synthesize.
Add more USR tests.

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

14 years agoSpecify linkage for Objective-C declarations.
Ted Kremenek [Tue, 20 Apr 2010 23:15:35 +0000 (23:15 +0000)]
Specify linkage for Objective-C declarations.

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

14 years agoFactor some common code out into a separate function.
Anders Carlsson [Tue, 20 Apr 2010 23:11:20 +0000 (23:11 +0000)]
Factor some common code out into a separate function.

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

14 years agoFixes a code gen. bug by removing an assert.
Fariborz Jahanian [Tue, 20 Apr 2010 22:02:31 +0000 (22:02 +0000)]
Fixes a code gen. bug by removing an assert.
It is ok to have c++-ness inside extern "C"
block. Fixes pr6644.

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

14 years agofix the ?: fixit that ted added to recover properly.
Chris Lattner [Tue, 20 Apr 2010 21:33:39 +0000 (21:33 +0000)]
fix the ?: fixit that ted added to recover properly.

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

14 years agoFix crash on invalid code where a @throw statement is not followed by a ';'
Ted Kremenek [Tue, 20 Apr 2010 21:21:51 +0000 (21:21 +0000)]
Fix crash on invalid code where a @throw statement is not followed by a ';'

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

14 years agochange FullSourceLoc to have a *const* SourceManager&, eliminating
Chris Lattner [Tue, 20 Apr 2010 20:49:23 +0000 (20:49 +0000)]
change FullSourceLoc to have a *const* SourceManager&, eliminating
a const_cast.

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

14 years agopush some source location information down through the compiler,
Chris Lattner [Tue, 20 Apr 2010 20:35:58 +0000 (20:35 +0000)]
push some source location information down through the compiler,
into ContentCache::getBuffer.  This allows it to produce
diagnostics on the broken #include line instead of without a
location.

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

14 years agoPatch to support transparent_union types on
Fariborz Jahanian [Tue, 20 Apr 2010 20:28:15 +0000 (20:28 +0000)]
Patch to support transparent_union types on
objective-c methods. Fixes radar 7875968.

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

14 years agoenhance sourcemgr to detect various UTF BOM's and emit a fatal error
Chris Lattner [Tue, 20 Apr 2010 18:14:03 +0000 (18:14 +0000)]
enhance sourcemgr to detect various UTF BOM's and emit a fatal error
about it instead of producing tons of garbage from the lexer.

It would be even better for sourcemgr to dynamically transcode (e.g.
from UTF16 -> UTF8).

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

14 years agoBack out r101911 and see if it makes the bots happy.
Anders Carlsson [Tue, 20 Apr 2010 18:05:10 +0000 (18:05 +0000)]
Back out r101911 and see if it makes the bots happy.

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

14 years agoRemove dead code.
Benjamin Kramer [Tue, 20 Apr 2010 18:01:57 +0000 (18:01 +0000)]
Remove dead code.

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

14 years agoIRgen: Always use i8 arrays to access union bit-fields. This is ugly, but
Daniel Dunbar [Tue, 20 Apr 2010 17:52:30 +0000 (17:52 +0000)]
IRgen: Always use i8 arrays to access union bit-fields. This is ugly, but
matches how we currently handle structs, and this correctly handles
-fno-bitfield-type-align.

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

14 years agoremove some extraneous qualifiers.
Chris Lattner [Tue, 20 Apr 2010 17:13:14 +0000 (17:13 +0000)]
remove some extraneous qualifiers.

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

14 years agoFix a bug which triggered the assertion I added yesterday. Basically, when we initial...
Anders Carlsson [Tue, 20 Apr 2010 16:22:16 +0000 (16:22 +0000)]
Fix a bug which triggered the assertion I added yesterday. Basically, when we initialize the vtable pointer for a virtual base, and there was another path from the most derived class to another base with the same class type, we would use the wrong base.

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

14 years agoMove code to apply a non-virtual and virtual offset out into a separate function.
Anders Carlsson [Tue, 20 Apr 2010 16:03:35 +0000 (16:03 +0000)]
Move code to apply a non-virtual and virtual offset out into a separate function.

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

14 years agoKeep proper source location information for the type in an Objective-C
Douglas Gregor [Tue, 20 Apr 2010 15:39:42 +0000 (15:39 +0000)]
Keep proper source location information for the type in an Objective-C
@encode expression.

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

14 years agoTip of the day: save before commit.
Benjamin Kramer [Tue, 20 Apr 2010 11:55:38 +0000 (11:55 +0000)]
Tip of the day: save before commit.

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

14 years agoFix -Wcast-qual warnings.
Benjamin Kramer [Tue, 20 Apr 2010 11:50:39 +0000 (11:50 +0000)]
Fix -Wcast-qual warnings.

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

14 years agoIntroduce a limit on the depth of the template instantiation backtrace
Douglas Gregor [Tue, 20 Apr 2010 07:18:24 +0000 (07:18 +0000)]
Introduce a limit on the depth of the template instantiation backtrace
we will print with each error that occurs during template
instantiation. When the backtrace is longer than that, we will print
N/2 of the innermost backtrace entries and N/2 of the outermost
backtrace entries, then skip the middle entries with a note such as:

  note: suppressed 2 template instantiation contexts; use
  -ftemplate-backtrace-limit=N to change the number of template
  instantiation entries shown

This should eliminate some excessively long backtraces that aren't
providing any value.

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

14 years agoAdd test cases.
Zhongxing Xu [Tue, 20 Apr 2010 05:48:57 +0000 (05:48 +0000)]
Add test cases.

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

14 years agodon't slap noalias attribute on stret result arguments.
Chris Lattner [Tue, 20 Apr 2010 05:44:43 +0000 (05:44 +0000)]
don't slap noalias attribute on stret result arguments.
This mirror's Dan's patch for llvm-gcc in r97989, and
fixes the miscompilation in PR6525.  There is some contention
over whether this is the right thing to do, but it is the
conservative answer and demonstrably fixes a miscompilation.

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

14 years agoReplace code with a method call. No functionality change.
Zhongxing Xu [Tue, 20 Apr 2010 05:40:40 +0000 (05:40 +0000)]
Replace code with a method call. No functionality change.

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

14 years agoPass the nearest virtual base decl to InitializeVTablePointers. No functionality...
Anders Carlsson [Tue, 20 Apr 2010 05:22:15 +0000 (05:22 +0000)]
Pass the nearest virtual base decl to InitializeVTablePointers. No functionality change right now.

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

14 years agoreapply john's patch, he broke mainline again by changing the test.
Chris Lattner [Tue, 20 Apr 2010 05:19:10 +0000 (05:19 +0000)]
reapply john's patch, he broke mainline again by changing the test.

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

14 years agoAssert that the path from the derived to the base class in CodeGenFunction::GetAddres...
Anders Carlsson [Tue, 20 Apr 2010 05:07:22 +0000 (05:07 +0000)]
Assert that the path from the derived to the base class in CodeGenFunction::GetAddressOfBaseClass is not ambiguous.

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

14 years agoAltivec vector literal initializer count mismatch error removed.
John Thompson [Tue, 20 Apr 2010 05:01:46 +0000 (05:01 +0000)]
Altivec vector literal initializer count mismatch error removed.

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

14 years agoUse GetState() to get the possible cleaned state.
Zhongxing Xu [Tue, 20 Apr 2010 04:53:09 +0000 (04:53 +0000)]
Use GetState() to get the possible cleaned state.

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

14 years agogrr, lit only hates me, not the rest of the world.
Chris Lattner [Tue, 20 Apr 2010 04:33:06 +0000 (04:33 +0000)]
grr, lit only hates me, not the rest of the world.

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

14 years agorevert r101863, whcih is causing Sema/altivec-init.c to fail on a ton
Chris Lattner [Tue, 20 Apr 2010 04:31:55 +0000 (04:31 +0000)]
revert r101863, whcih is causing Sema/altivec-init.c to fail on a ton
of buildbots with:

error: 'error' diagnostics expected but not seen:
  Line 9: too few elements in vector initialization (expected 8 elements, have 2)
1 warning and 1 error generated.

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

14 years agoAltivec vector literal initializer count mismatch error removed.
John Thompson [Tue, 20 Apr 2010 03:58:33 +0000 (03:58 +0000)]
Altivec vector literal initializer count mismatch error removed.

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

14 years agoImprove handling of CXXNewExpr.
Zhongxing Xu [Tue, 20 Apr 2010 03:37:34 +0000 (03:37 +0000)]
Improve handling of CXXNewExpr.

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

14 years agoRestore r101841 without modification. Also mark 'operator delete' as used for
John McCall [Tue, 20 Apr 2010 02:18:25 +0000 (02:18 +0000)]
Restore r101841 without modification.  Also mark 'operator delete' as used for
actual delete expressions, not just new expressions.

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

14 years agoRevert r101841 and follow-up.
John McCall [Tue, 20 Apr 2010 01:42:53 +0000 (01:42 +0000)]
Revert r101841 and follow-up.

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

14 years agoadd __builtin_[r]index. Perhaps all LIBBUILTIN's should get
Chris Lattner [Tue, 20 Apr 2010 01:31:15 +0000 (01:31 +0000)]
add __builtin_[r]index.  Perhaps all LIBBUILTIN's should get
these or something?

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

14 years agoUse __SIZE_TYPE__ as suggested by dgregor.
John McCall [Tue, 20 Apr 2010 01:26:56 +0000 (01:26 +0000)]
Use __SIZE_TYPE__ as suggested by dgregor.

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

14 years agoDon't bother looking for (or diagnosing problems with) the 'operator delete'
John McCall [Tue, 20 Apr 2010 00:22:43 +0000 (00:22 +0000)]
Don't bother looking for (or diagnosing problems with) the 'operator delete'
associated with a new expression if -fno-exceptions is set.

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

14 years agoDo not diagnose unused-parameter errors in template instantiations. We
Douglas Gregor [Mon, 19 Apr 2010 23:56:20 +0000 (23:56 +0000)]
Do not diagnose unused-parameter errors in template instantiations. We
will already have done so when the template is declared.

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

14 years agoKeep track of the actual storage specifier written on a variable or
Douglas Gregor [Mon, 19 Apr 2010 22:54:31 +0000 (22:54 +0000)]
Keep track of the actual storage specifier written on a variable or
function declaration, since it may end up being changed (e.g.,
"extern" can become "static" if a prior declaration was static). Patch
by Enea Zaffanella and Paolo Bolzoni.

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

14 years agoOnly suppress the "extern variable has an initializer" warning when the extern entity...
Douglas Gregor [Mon, 19 Apr 2010 22:34:40 +0000 (22:34 +0000)]
Only suppress the "extern variable has an initializer" warning when the extern entity being initialized is const.

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

14 years agoDisable the "'extern' variable has an initializer" warning in C++,
Douglas Gregor [Mon, 19 Apr 2010 21:31:25 +0000 (21:31 +0000)]
Disable the "'extern' variable has an initializer" warning in C++,
since it makes sense there to have const extern variables. Fixes
PR6495.

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

14 years agoAST: Dump ASTRecordLayout objects when they are created with -fdump-record-layouts.
Daniel Dunbar [Mon, 19 Apr 2010 20:44:53 +0000 (20:44 +0000)]
AST: Dump ASTRecordLayout objects when they are created with -fdump-record-layouts.

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

14 years agoIRgen: Kill unused function and move the type match assert to after record dumping.
Daniel Dunbar [Mon, 19 Apr 2010 20:44:47 +0000 (20:44 +0000)]
IRgen: Kill unused function and move the type match assert to after record dumping.

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

14 years agoadd a PPCallback handler for a skipped #include, patch by
Chris Lattner [Mon, 19 Apr 2010 20:44:31 +0000 (20:44 +0000)]
add a PPCallback handler for a skipped #include, patch by
Zhanyong Wan!

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

14 years agoWhen normal name lookup to disambiguiate an Objective-C message send
Douglas Gregor [Mon, 19 Apr 2010 20:09:36 +0000 (20:09 +0000)]
When normal name lookup to disambiguiate an Objective-C message send
fails to find anything,  perform ivar lookup and, if we find one,
consider this an instance message.

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

14 years agoMore tests for Objective-C-related name lookup weirdness. Yes, it's
Douglas Gregor [Mon, 19 Apr 2010 19:10:40 +0000 (19:10 +0000)]
More tests for Objective-C-related name lookup weirdness. Yes, it's
weird; yes, it's what GCC does. Almost.

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

14 years agoAdd a testcase for PR6501 (too many/too few arguments to a function call).
Eric Christopher [Mon, 19 Apr 2010 18:39:43 +0000 (18:39 +0000)]
Add a testcase for PR6501 (too many/too few arguments to a function call).

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

14 years agoCheck for darwin befoer cheking for version.
Fariborz Jahanian [Mon, 19 Apr 2010 18:38:31 +0000 (18:38 +0000)]
Check for darwin befoer cheking for version.
(related to radar 7866951).

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

14 years agoMake this test darwin10 specific.
Fariborz Jahanian [Mon, 19 Apr 2010 18:27:05 +0000 (18:27 +0000)]
Make this test darwin10 specific.

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

14 years agoTemporarily XFAIL this test on windows.
Eric Christopher [Mon, 19 Apr 2010 18:26:40 +0000 (18:26 +0000)]
Temporarily XFAIL this test on windows.

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

14 years agoRemove the argument number from the constant integer diagnostic.
Eric Christopher [Mon, 19 Apr 2010 18:23:02 +0000 (18:23 +0000)]
Remove the argument number from the constant integer diagnostic.
Update all of the testcases accordingly.

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