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

1987 Коммитов

Автор SHA1 Сообщение Дата
David Blaikie d8180cf987 PR14573: Unnamed parameters in debug info, Part 2
Catch some cases I'd missed in r171605 related to unnamed parameters of record
type. This resolves all remaining cases of PR14573 suppression in the GDB 7.5
test suite. Fix to the test suite to follow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171633 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-05 20:03:07 +00:00
David Blaikie 436653be0c Emit debug info for unnamed parameters.
LLVM ignores this data for now - patch for that to follow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171605 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-05 05:58:35 +00:00
David Blaikie 5f2bd16310 Change test/CodeGenCXX/debug-info-method.cpp an IR (rather than asm) test.
Referring back to the original commit (r115090) which was a frontend only test
I adjusted this test to verify the frontend change that was made, to emit the
protected access value in the flags metadata field.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171604 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-05 05:48:08 +00:00
David Blaikie 42368b5f28 FileCheck-ize test/CodeGenCXX/debug-info-method.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171602 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-05 05:39:21 +00:00
Eli Friedman 89e19b43b8 Don't assert/crash on reference variables in lambdas bound to a
static local variable from the parent scope.  PR14773.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171433 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-03 00:39:26 +00:00
Will Dietz 2d382d149b [ubsan] Recover by default, use -fno-sanitize-recover to disable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171264 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-30 20:53:28 +00:00
Rafael Espindola 140aadf5b9 Add 171048 back but invalidate the cache of all redeclarations when setting
the body of a functions. The problem was that hasBody looks at the entire chain
and causes problems to -fvisibility-inlines-hidden if the cache was not
invalidated.

Original message:

Cache visibility of decls.

This unifies the linkage and visibility caching. I first implemented this when
working on pr13844, but the previous fixes removed the performance advantage of
this one.
This is still a step in the right direction for making linkage and visibility
cheap to use.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171053 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-25 07:31:49 +00:00
Richard Smith 0dbe2fb775 Reinstate r170806, reverted in r170835, with a fix use i1 instead of i8 for a value-initialized bool!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170837 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-21 03:17:28 +00:00
NAKAMURA Takumi 98ab776a8a Revert r170806, "Fix some bugs where we would sometimes use 0, not -1, when emitting a null constant of type pointer-to-data-member."
It broke stage2.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170835 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-21 02:50:38 +00:00
Richard Smith d8af340e27 Fix some bugs where we would sometimes use 0, not -1, when emitting a null constant of type pointer-to-data-member.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170806 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-20 23:49:09 +00:00
Eli Friedman e538d48957 Make sure CodeGen uses a value of the correct type as the result of
of assignment to a bool bitfield.  PR14638.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170480 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 00:26:58 +00:00
Richard Smith 073fec91b7 Rein ubsan's vptr sanitizer back a bit. Per core issue 453, binding a reference
to an object outside its lifetime does not have undefined behavior.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170387 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18 00:22:45 +00:00
Argyrios Kyrtzidis 4ae711b5ef Don't hit an assertion failure when calculating the __PRETTY_FUNCTION__
of a member function with parenthesized declarator.

Like this test case:

class Foo {
  const char *(baz)() {
    return __PRETTY_FUNCTION__;
  }
};

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170233 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-14 19:44:11 +00:00
NAKAMURA Takumi 457d65ae10 clang/test/CodeGenCXX/lambda-expressions.cpp: Relax expression for -Asserts.
"entry:" is not met in -Asserts build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170175 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-14 02:35:04 +00:00
Nadav Rotem 877efce7a8 Make the test less sensitive to the inline threshold.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170164 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-14 00:26:15 +00:00
Eli Friedman 50f089a6e1 Make sure the __invoke function for lambdas returns properly. Per bug report on IRC>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170160 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-13 23:37:17 +00:00
David Blaikie c9a9177e69 Debug Info: Emit vtables pointer members as artificial.
I wasn't sure where to put the test case for this, but this seemed like as good
a place as any. I had to reorder the tests here to make them legible while
still matching the order of metadata output in the IR file (for some reason
making it virtual changed the ordering).

Relevant commit to fix up LLVM to actually respect 'artificial' member
variables is coming once I write up a test case for it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170154 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-13 22:29:06 +00:00
Richard Smith 463b48ba7e ubsan: Add -fsanitize=bool and -fsanitize=enum, which check for loads of
bit-patterns which are not valid values for enumerated or boolean types.
These checks are the ubsan analogue of !range metadata.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170108 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-13 07:11:50 +00:00
Chandler Carruth baab683a5a Add a triple to this test. It depends on little-endian bitfield layout.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169696 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-09 10:39:18 +00:00
Chandler Carruth 5588a6903e Add a test case that I've been using to clarify the bitfield layout for
both LE and BE targets.

AFAICT, Clang get's this correct for PPC64. I've compared it to GCC 4.8
output for PPC64 (thanks Roman!) and to my limited ability to read power
assembly, it looks functionally equivalent. It would be really good to
fill in the assertions on this test case for x86-32, PPC32, ARM, etc.,
but I've reached the limit of my time and energy... Hopefully other
folks can chip in as it would be good to have this in place to test any
subsequent changes.

To those who care about PPC64 performance, a side note: there is some
*obnoxiously* bad code generated for these test cases. It would be worth
someone's time to sit down and teach the PPC backend to pattern match
these IR constructs better. It appears that things like '(shr %foo,
<imm>)' turn into 'rldicl R, R, 64-<imm>, <imm>' or some such. They
don't even get combined with other 'rldicl' instructions *immediately
adjacent*. I'll add a couple of these patterns to the README, but
I think it would be better to look at all the patterns produced by this
and other bitfield access code, and systematically build up a collection
of patterns that efficiently reduce them to the minimal code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169693 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-09 10:08:22 +00:00
Chandler Carruth ef8d516e7e Fix the bitfield record layout in codegen for big endian targets.
This was an egregious bug due to the several iterations of refactorings
that took place. Size no longer meant what it original did by the time
I finished, but this line of code never got updated. Unfortunately we
had essentially zero tests for this in the regression test suite. =[

I've added a PPC64 run over the bitfield test case I've been primarily
using. I'm still looking at adding more tests and making sure this is
the *correct* bitfield access code on PPC64 linux, but it looks pretty
close to me, and it is *worlds* better than before this patch as it no
longer asserts! =] More commits to follow with at least additional tests
and maybe more fixes.

Sorry for the long breakage due to this....

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169691 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-09 07:26:04 +00:00
Chandler Carruth 72d2dab605 Rework the bitfield access IR generation to address PR13619 and
generally support the C++11 memory model requirements for bitfield
accesses by relying more heavily on LLVM's memory model.

The primary change this introduces is to move from a manually aligned
and strided access pattern across the bits of the bitfield to a much
simpler lump access of all bits in the bitfield followed by math to
extract the bits relevant for the particular field.

This simplifies the code significantly, but relies on LLVM to
intelligently lowering these integers.

I have tested LLVM's lowering both synthetically and in benchmarks. The
lowering appears to be functional, and there are no really significant
performance regressions. Different code patterns accessing bitfields
will vary in how this impacts them. The only real regressions I'm seeing
are a few patterns where the LLVM code generation for loads that feed
directly into a mask operation don't take advantage of the x86 ability
to do a smaller load and a cheap zero-extension. This doesn't regress
any benchmark in the nightly test suite on my box past the noise
threshold, but my box is quite noisy. I'll be watching the LNT numbers,
and will look into further improvements to the LLVM lowering as needed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169489 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-06 11:14:44 +00:00
Bill Wendling 5e45385ba7 Fix name. The array is unboundED.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169429 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 21:43:37 +00:00
Bill Wendling 9d05986cc5 Use the 'count' attribute to calculate the upper bound of an array.
The count attribute is more accurate with regards to the size of an array. It
also obviates the upper bound attribute in the subrange. We can also better
handle an unbound array by setting the count to -1 instead of the lower bound to
1 and upper bound to 0.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169311 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 21:33:58 +00:00
Bill Wendling c4475eee42 Don't test for ASM output but for IR output.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169232 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 07:33:40 +00:00
NAKAMURA Takumi 1fec8fcfff clang/test/CodeGenCXX/debug-info-zero-length-arrays.cpp: Add explicit triple, x86_64-unknown-unknown. It was incompatible to i686.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169220 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 06:58:05 +00:00
Bill Wendling 003ec237ad Add a 'count' field to the DWARF subrange.
The count field is necessary because there isn't a difference between the 'lo'
and 'hi' attributes for a one-element array and a zero-element array. When the
count is '0', we know that this is a zero-element array. When it's >=1, then
it's a normal constant sized array. When it's -1, then the array is unbounded.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169219 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 06:21:27 +00:00
Will Dietz ad95481b27 [ubsan] Add flag to enable recovery from checks when possible.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169114 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-02 19:50:33 +00:00
Douglas Gregor 464a01a67c Fix the determination of whether a capture refers to an enclosing
scope when dealing with nested blocks. Fixes <rdar://problem/12778708>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169065 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-01 01:01:09 +00:00
Eli Bendersky 2ec5f551cc Make the test less sensitive to DWARF emission implementation details.
Note: the ":" goes into the regex because FileCheck wrongly complains about
unbalanced brackets otherwise.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168934 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 20:01:14 +00:00
Timur Iskhodzhanov 53c61c5c0c [-cxx-abi microsoft] Also spill the argument-back-references context when mangling templates
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168862 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 08:58:47 +00:00
Richard Smith 21173b1080 PR14388: An array or function type in an exception specification should be
decayed to a pointer type. Patch by WenHan Gu, with a little tweaking and
additional testcases by me.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168822 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 22:33:28 +00:00
Will Dietz b85403658a Add -fsanitize=integer for reporting suspicious integer behaviors.
Introduces new sanitizer "unsigned-integer-overflow".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168701 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 15:01:55 +00:00
Timur Iskhodzhanov 5e7b43ed30 Remove outdated FIXME; should have removed that in r160782
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168698 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 12:55:47 +00:00
Timur Iskhodzhanov 79b7cc5965 Fix PR14413 - incorrect mangling of anonymous namespaces with -cxx-abi microsoft
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168583 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-26 08:55:48 +00:00
Richard Smith 93af2b8392 PR14279: Work around this major miscompilation by treating move operations as
non-trivial if they would not call a move operation, even if they would in fact
call a trivial copy operation. A proper fix is to follow, but this small
directed fix is intended for porting to the 3.2 release branch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167920 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 07:36:28 +00:00
David Blaikie 66cff72576 Provide the correct mangling and linkage for certain unnamed nested classes.
This corrects the mangling and linkage of classes (& their member functions) in
cases like this:

  struct foo {
    struct {
      void func() { ... }
    } x;
  };

we were accidentally giving this nested unnamed struct 'no' linkage where it
should've had the linkage of the outer class. The mangling was incorrecty too,
mangling as TU-wide unnamed type mangling of $_X rather than class-scoped
mangling of UtX_.

This also fixes -Wunused-member-function which would incorrectly diagnose
'func' as unused due to it having no linkage & thus appearing to be TU-local
when in fact it might be correctly used in another TU.

Similar mangling should be applied to function local classes in similar cases
but I've deferred that for a subsequent patch.

Review/discussion by Richard Smith, John McCall, & especially Eli Friedman.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167906 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 01:52:05 +00:00
Richard Smith 8c88953ff0 Remove another questionable use of hasTrivial*. The relevant thing for this
test was whether the /selected/ operator= was trivial, not whether the class
had any trivial (or any non-trivial) operator=s.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167897 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 00:50:40 +00:00
Eric Christopher 0c949efad5 Revert "Use the 'count' attribute instead of the 'upper_bound' attribute."
temporarily since it breaks the gdb bots.

This reverts commit r167807/30305bec25cac981c6d4a3b8be004401310a82a7.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167887 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 23:30:57 +00:00
Bill Wendling 30305bec25 Use the 'count' attribute instead of the 'upper_bound' attribute.
If we have a type 'int a[1]' and a type 'int b[0]', the generated DWARF is the
same for both of them because we use the 'upper_bound' attribute. Instead use
the 'count' attrbute, which gives the correct number of elements in the array.
<rdar://problem/12566646>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167807 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 02:31:58 +00:00
Richard Smith 044c8aa39d Fix some wrong-code bugs in implicitly-defined assignment operators:
- In C++11, perform overload resolution over all assignment operators, rather than just looking for copy/move assignment operators.
 - Clean up after temporaries produced by operator= immediately, rather than accumulating them until the end of the function.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167798 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 00:54:12 +00:00
Rafael Espindola 882995be7c Remove duplicated line.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167767 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 22:29:43 +00:00
Richard Smith 5f9a7e31d0 Remove abuse of hasTrivial*, and fix miscompile wherein global arrays with
internal linkage, no uses, trivial construction, and nontrivial destruction
were not emitted.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167756 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 21:38:00 +00:00
Nico Weber e95b46bf50 [Windows] Fix mangling of number literal '0'
Do this by making the mangleNumber(APSInt) overload look like
the int64_t version. (The latter should probably just delegate
to the former).

Test from Evgeny Eltsin!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167599 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-08 23:38:59 +00:00
Richard Smith e938536306 When deciding whether to convert an array construction loop into a memcpy, look
at whether the *selected* constructor would be trivial rather than considering
whether the array's element type has *any* non-trivial constructors of the
relevant kind.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167562 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-07 23:56:21 +00:00
Anton Korobeynikov 4179ddd575 Implement codegen for init_priority attribute properly - make sure it
works between the modules.
No functionality change on Darwin/Windows.
This fixes PR11480.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167496 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-06 22:44:45 +00:00
Richard Smith d6396a681c Use the individual -fsanitize=<...> arguments to control which of the UBSan
checks to enable. Remove frontend support for -fcatch-undefined-behavior,
-faddress-sanitizer and -fthread-sanitizer now that they don't do anything.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167413 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-05 22:21:05 +00:00
David Blaikie 70ae1226d9 Emit debug info for C++ struct definitions as DW_TAG_structure_type (instead of class_type).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167336 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-02 23:40:00 +00:00
David Blaikie 9417b05ef9 Fix debug tag type of forward declarations of struct/class in C++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167308 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-02 20:49:01 +00:00
Bill Schmidt 5d1ae38282 This patch removes the XFAIL for powerpc for
test/CodeGenCXX/member-alignment.cpp.  The test succeeds for
powerpc64-unknown-linux-gnu.  If other flavors of powerpc are
shown by buildbots to still be broken, we can adjust the test
at that time.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167143 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-31 17:31:46 +00:00
Douglas Gregor f596760aab When an externally-supplied record layout has a size that clearly
doesn't include padding up to the alignment of the record, take this
as a cue that the alignment of the record should (conservatively) be
set to 1. This is similar to other the other cues we use to determine
that the record has a lower alignment, e.g., that the
externally-supplied layout places fields at lower offsets than we
would. Fixes <rdar://problem/12582052>; test case in LLDB.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166824 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-26 22:31:14 +00:00
Alexey Samsonov c01526e39e Fix test suppressed in r166683 on 32-bit Linux
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166758 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-26 07:01:51 +00:00
Richard Smith d6f833091f Fix the other occurrence of the problem fixed by r166731.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166735 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-25 23:05:00 +00:00
Richard Smith ca53087029 LLVM's hashing routines produce a size_t, and thus generate different values for 32- and 64-bit host compilers. This really needs to be fixed -- the IR generated should not depend on the host -- but this change will get the bots green again. Proper fix to follow.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166731 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-25 22:27:30 +00:00
Richard Smith 0848333c39 Add a more direct test for r166661.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166727 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-25 21:59:45 +00:00
NAKAMURA Takumi 37c94bfdc8 clang/test/CodeGenCXX/debug-info-thunk.cpp: Suppress it for now with XFAIL:*, due to failing on i686-*-*.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166683 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-25 14:43:34 +00:00
David Tweed a0d5878b7e Correct test inovocations to use %clang_cc1 rather than direct invocation (so that it can have additional options set when trying to debug issues causing regressions).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166681 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-25 13:56:30 +00:00
Alexey Samsonov 34b41f80aa Initialize debug info for special cases of functions that lack declarations and are generated by Clang (global initializers/destructors, thunks) . Fixes PR13942.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166676 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-25 10:18:50 +00:00
Eli Friedman 465e89e094 When we're devirtualizing a method call, make sure the method has the correct IR type.
Reported in the thread "devirtualisation appears to crash clang on covariant functions on ARM" on cfe-dev.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166651 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-25 00:12:49 +00:00
Ulrich Weigand 923099773f A number of test cases assume that an "int" parameter or return value
will be represented in the IR as a plain "i32" type.  This causes the
tests to spuriously fail on platforms where int is not a 32-bit type,
or where the ABI requires attributes like "signext" or "zeroext" to
be used.

This patch adds -triple or -target parameters to force those tests
to use the i386-unknown-unknown target.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166551 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-24 12:22:56 +00:00
Rafael Espindola b693269223 Add inreg markers with the x86_fastcallcc calling convention.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166537 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-24 01:58:58 +00:00
Rafael Espindola 5f14fcbd45 Don't try to use inreg with 0 sized structs. Thanks to Eli for reporting the
regression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166461 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-23 02:04:01 +00:00
Richard Smith 5016a70c18 DR1472: A reference isn't odr-used if it has preceding initialization,
initialized by a reference constant expression.

Our odr-use modeling still needs work here: we don't yet implement the 'set of
potential results of an expression' DR.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166361 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-20 01:38:33 +00:00
Andy Gibbs 8e8fb3be5b Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166280 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-19 12:44:48 +00:00
Richard Smith 820e9a7e29 DR1511: A const volatile global does not implicitly get internal linkage like a
const non-volatile global does.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166269 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-19 06:37:48 +00:00
Rafael Espindola 0b4cc950c5 Fix handling of the regparm attribute in the presence of classes with copy
constructors.

When I first moved regparm support to TargetInfo.cpp I tried to isolate it
in classifyArgumentTypeWithReg, but it is actually a lot easier to flip the
code around and check for regparm at the end of the decision tree.

Without this refactoring classifyArgumentTypeWithReg would have to duplicate
the logic about when to use non-byval indirect arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166266 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-19 05:04:37 +00:00
Eric Christopher da3301eec8 Add a new option for and disable column number information as there
are no known current users of column info. Robustify and fix up
a few tests in the process. Reduces the size of debug information
by a small amount.

Part of PR14106

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166236 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 21:52:18 +00:00
Richard Smith b1502bcd67 DR1442: In a range-based for statement, namespace 'std' is not an associated
namespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166194 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 17:56:02 +00:00
Richard Smith 9be36ab27b DR1535: only potentially-evaluated typeid expressions are disallowed in constant
expressions, not *any* typeid on a polymorphic class type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166156 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 23:52:07 +00:00
Eric Christopher 9556b39109 Revert r158009 since there are some uses of artificial functions in
debug info.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166109 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 17:37:17 +00:00
David Blaikie 2eb9a959d2 PR13684: Emit vtable entries for deleted functions as __cxa_deleted_function.
This is consistent/interoperable with GCC 4.7 (& __cxa_deleted_function isn't
present in 4.4 - not sure when it got added, but you'll need something with
that function available for this to work).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166069 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-16 22:56:05 +00:00
David Blaikie 4d283e1f49 Test pure virtual vtable entries in the Itanium ABI.
(original functionality committed in r99807, refactored in r160373)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166059 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-16 21:03:19 +00:00
David Blaikie d954ab47c6 Note deleted functions when dumping vtables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166056 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-16 20:25:33 +00:00
Richard Smith 802cd5b197 At -O0, emit an @llvm.trap() call at the end of a value-returning function which
fails to return a value, to make debugging this issue easier.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165914 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-15 00:23:07 +00:00
Rafael Espindola 0142f0cf08 Handle gnu_inline in c++ in a gcc compatible way. Original patch by Tobias
Grosser.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165720 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-11 16:32:25 +00:00
NAKAMURA Takumi a2cdd4d66a clang/test/CodeGenCXX/microsoft-uuidof.cpp: Fix for -Asserts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165712 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-11 11:20:31 +00:00
Nico Weber c5f804636e Add codegen support for __uuidof().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165710 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-11 10:13:44 +00:00
Logan Chien eae5a820bc Fix PR 11709: Change the definition of va_list to meet AAPCS requirement
AAPCS ABI Section 7.1.4 [1] specifies that va_list
should be defined as struct __va_list { void *__ap;};
And in C++, it is defined in namespace std.

[1] http://infocenter.arm.com/help/topic
         /com.arm.doc.ihi0042d/IHI0042D_aapcs.pdf

Patch by Weiming Zhao.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165609 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-10 06:56:20 +00:00
Richard Smith 4def70d304 -fcatch-undefined-behavior: emit calls to the runtime library whenever one of the checks fails.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165536 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-09 19:52:38 +00:00
Eli Friedman e6b39bcee0 Make sure to generate the right kind of MDNode for enum forward declarations.
PR14029, clang part.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165289 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-05 01:49:33 +00:00
Richard Smith 36ef0d54cf If we flow off the end of a value-returning function:
- outside C++, return undef (behavior is not undefined unless the value is used)
 - in C++, with -fcatch-undefined-behavior, perform an appropriate trap
 - in C++, produce an 'unreachable' (behavior is undefined immediately)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165273 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-04 23:52:29 +00:00
Nico Weber 385b91f2f4 When mangling an APSInt with the ms abi, make sure to look at all nibbles.
Currently, it's ignored if the number of set bits isn't divisible by 4.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165116 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-03 13:39:49 +00:00
Aaron Ballman 82bfa19fe3 Allowing individual targets to determine whether a given calling convention is allowed or ignored with warning. This allows for correct name mangling for x64 targets on Windows, which in turn allows for linking against the Win32 APIs.
Fixes PR13782

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165015 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-02 14:26:08 +00:00
Nico Weber 6e208dbcbd Mark two Clang tests as passing on ARM
Also move one of them from grep to FileCheck.
Patch from Joey Gouly <joey.gouly@arm.com>!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164929 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-01 08:44:54 +00:00
Benjamin Kramer 6cacae8bf9 CodeGen: Copy tail padding when we're not dealing with a trivial copy assign or move assign operator.
This fixes a regression from r162254, the optimizer has problems reasoning
about the smaller memcpy as it's often not safe to widen a store but making it
smaller is.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164917 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-30 12:43:37 +00:00
Richard Smith ef4d5ced04 PR13941: Mark all virtual functions as unnamed_addr. It's not possible to
observe their addresses (taking their address gives the vtable slot) so we are
free to merge their definitions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164864 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-28 22:46:07 +00:00
Eli Friedman 80bfa3d125 Fix an edge case of mangling involving the combination of a lambda and typeid.
typeid (and a couple other non-standard places where we can transform an
unevaluated expression into an evaluated expression) is special
because it introduces an an expression evaluation context,
which conflicts with the mechanism to compute the current
lambda mangling context.  PR12123.

I would appreciate if someone would double-check that we get the mangling
correct with this patch.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164658 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-26 04:34:21 +00:00
Eli Friedman d7a6b1640e Fix the AST representation for non-type template arguments to encode
enough information so we can mangle them correctly in cases involving
dependent parameter types. (This specifically impacts cases involving
null pointers and cases involving parameters of reference type.)
Fix the mangler to use this information instead of trying to scavenge
it out of the parameter declaration.

<rdar://problem/12296776>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164656 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-26 02:36:12 +00:00
John McCall ecd03b447b When performing a ::delete of an object with a virtual destructor,
be sure to delete the complete object pointer, not the original
pointer.  This is necessary if the base being deleted is at a
non-zero offset in the complete object.  This is only required
for objects with virtual destructors because deleting an object
via a base-class subobject when the base does not have a virtual
destructor is undefined behavior.

Noticed while reviewing the last four years of cxx-abi-dev
activity.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164597 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-25 10:10:39 +00:00
NAKAMURA Takumi 0e33dcda5c clang/test/CodeGenCXX/microsoft-*: Fix for -Asserts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164594 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-25 09:53:18 +00:00
John McCall 9653ab52b9 Implement Mike Herrick's proposed noexcept mangling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164593 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-25 09:10:17 +00:00
John McCall bd31574a0f In the MS ABI, ctors return 'this'. Patch by Dmitry Sokolov.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164592 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-25 08:00:39 +00:00
John McCall e402e72273 Fix for r163013 regression and further __interface enhancement.
Patch by Andy Gibbs!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164590 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-25 07:32:39 +00:00
John McCall 9f357de8d5 During jump-scope checking, build an ExprWithCleanups immediately
into the enclosing scope;  this is a more accurate model but is
(I believe) unnecessary in my test case due to other flaws.
However, one of those flaws is now intentional:  blocks which
appear in return statements can be trivially observed to not
extend in lifetime past the return, and so we can allow a jump
past them.  Do the necessary magic in IR-generation to make
this work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164589 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-25 06:56:03 +00:00
Rafael Espindola 022301b858 Call CGM.SetLLVMFunctionAttributesForDefinition on thunks so that they get
attributes like uwtable. Without uwtable a stack unwinder would be unable
to go past the thunks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164411 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-21 20:39:32 +00:00
Eric Christopher 28e3c99825 Handle a captured this for the debug information as well.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164253 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-19 21:47:34 +00:00
David Blaikie 1deeedb680 Fix ABI dependent tests by providing an explicit target triple.
Patch by Joey Gouly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164239 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-19 18:46:03 +00:00
Eli Friedman 11267a3202 Test for r164186.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164187 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-19 01:35:20 +00:00
Eli Friedman 82bad6bbb6 Fix thunk emission for covariant virtual functions in cases which require
both a virtual and a non-virtual offset. PR13832.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163866 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-14 01:45:09 +00:00
Richard Smith 2bcb984df9 Revert r163829. The world (or libstdc++, at least) is not ready.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163846 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-13 22:00:12 +00:00
Richard Smith ceb07622ba Remove speculative fix for C++ core issue 1407, since it was resolved as NAD.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163829 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-13 19:55:13 +00:00
Eric Christopher d5a73dca62 Reapply:
Make clang emit a flag for DW_AT_object_pointer for the artificial
    args where it should (implicit first arguments). FileCheck-ize a
    test as well and update tests to take into account the object
    pointer flag.

    rdar://9797999

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163755 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-12 23:36:49 +00:00
Eric Christopher 22b617fbfd Revert "Make clang emit a flag for DW_AT_object_pointer for the artificial"
this should be done on the subprogram, not the variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163733 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-12 18:42:10 +00:00
NAKAMURA Takumi b774d73540 clang/test: [PR8833] Introduce the feature "LP64" to suppress LLP64-incompatible tests.
I think some of them could be rewritten to fit also LLP64.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163699 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-12 10:45:40 +00:00
Eric Christopher 2b6eb9db86 Make clang emit a flag for DW_AT_object_pointer for the artificial
args where it should (implicit first arguments). FileCheck-ize a
test as well and update tests to take into account the object
pointer flag.

rdar://9797999

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163668 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-12 00:27:32 +00:00
David Blaikie 1b76fbc5b7 Provide fixed target triples to make test results consistent across ARM hosts.
Patch by David Tweed, review by myself and John McCall.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163564 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-10 23:06:08 +00:00
Timur Iskhodzhanov e972cb4a4c Follow-up on r163110 - forgot to commit some new tests...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163111 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-03 09:20:57 +00:00
Timur Iskhodzhanov a04ca5c4e0 Fix PR13444 - wrong mangling of "const char * const *" and friends with "-cxx-abi microsoft"
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163110 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-03 09:08:10 +00:00
Eli Friedman a6c66cedc0 Change the representation of builtin functions in the AST
(__builtin_* etc.) so that it isn't possible to take their address.
Specifically, introduce a new type to represent a reference to a builtin
function, and a new cast kind to convert it to a function pointer in the
operand of a call.  Fixes PR13195.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162962 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-31 00:14:07 +00:00
Eli Friedman b41ba1aa47 Fix a CodeGen bug where we would skip zero-initialization for
array new with a non-trivial constructor. Pointed out in PR13380.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162643 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-25 07:11:29 +00:00
John McCall fb60914137 Fix the CC-matching logic for instance methods in the MS ABI.
Patch by Timur Iskhodzhanov!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162639 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-25 02:00:03 +00:00
John McCall 2612e9f1d0 Fix the mangling of function pointers in the MS ABI.
Patch by Timur Iskhodzhanov!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162638 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-25 01:12:56 +00:00
Richard Smith 9d3e226aca -fcatch-undefined-behavior: add the -ftrapv checks to the set of things caught
by this mode, and also check for signed left shift overflow. The rules for the
latter are a little subtle:

 * neither C89 nor C++98 specify the behavior of a signed left shift at all
 * in C99 and C11, shifting a 1 bit into the sign bit has undefined behavior
 * in C++11, with core issue 1457, shifting a 1 bit *out* of the sign bit has
   undefined behavior

As of this change, we use the C99 rules for all C language variants, and the
C++11 rules for all C++ language variants. Once we have individual
-fcatch-undefined-behavior= flags, this should be revisited.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162634 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-25 00:32:28 +00:00
Richard Smith 2c9f87ca5c New -fcatch-undefined-behavior features:
* when checking that a pointer or reference refers to appropriate storage for a type, also check the alignment and perform a null check
 * check that references are bound to appropriate storage
 * check that 'this' has appropriate storage in member accesses and member function calls


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162523 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 00:54:33 +00:00
John McCall 54c86f746f When mangling a negative number, remember that negating it does not
always yield a positive number.  Just print the negated result as an
unsigned number.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162163 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-18 04:51:52 +00:00
Richard Smith ac45293276 Devirtualize calls on glvalues produced by class member access expressions.
Based on a patch by Yin Ma!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161998 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-15 22:59:28 +00:00
Richard Smith 7657fd7d34 PR13570: When an unresolved overloaded call appeared in a dependent context, we
forgot to set it as being instantiation-dependent as well as being type- and
value-dependent.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161791 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-13 21:29:18 +00:00
Eli Friedman 859c65cdbe Fix an assertion failure with a C++ constructor initializing a
member of reference type in an anonymous struct.  PR13154.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161473 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08 03:51:37 +00:00
Richard Smith 60b70388e4 Update documentation of HasSideEffects to match its callers' expectations, and
update implementation to match. An elidable, non-trivial constructor call is a
side-effect under this definition, but wasn't under the old one, because we are
not required to evaluate it even though it may have an effect.

Also rationalize checking for volatile reads: just look for lvalue-to-rvalue
conversions on volatile glvalues, and ignore whether a DeclRefExpr etc is for
a volatile variable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161393 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 05:18:29 +00:00
Eric Christopher 387611eaf8 Fix the test RUN line for this better.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161390 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 05:04:19 +00:00
Richard Smith 8ae4ec2845 Teach Expr::HasSideEffects about all the Expr types, and fix a bug where it
was mistakenly classifying dynamic_casts which might throw as having no side
effects.

Switch it from a visitor to a switch, so it is kept up-to-date as future Expr
nodes are added. Move it from ExprConstant.cpp to Expr.cpp, since it's not
really related to constant expression evaluation.

Since we use HasSideEffect to determine whether to emit an unused global with
internal linkage, this has the effect of suppressing emission of globals in
some cases.

I've left many of the Objective-C cases conservatively assuming that the
expression has side-effects. I'll leave it to someone with better knowledge
of Objective-C than mine to improve them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161388 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 04:16:51 +00:00
Eric Christopher c7fb748061 If we don't have a complete type for the array type yet either then
just let the alignment be zero.

PR13531

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161379 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 00:48:43 +00:00
Eric Christopher b3f46ec9a4 Specify a triple on this to make it easier to test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161372 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 00:28:23 +00:00
Eric Christopher 363e5acfd9 Make sure when we get the replacement type for a template argument
that we attach the lost qualifiers.

Fixes rdar://11882155

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161368 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 00:14:25 +00:00
Benjamin Kramer c23aca4475 Flesh out test for defaulted key functions a bit more.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161243 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-03 15:43:22 +00:00
Benjamin Kramer f3fce80bb2 Fix failed to generate vtables in certain cases.
By C++ standard, the vtable should be generated if the first non-inline
virtual function is defined in the TU.  Current version of clang doesn't
generate vtable if the first virtual function is defaulted, because the
key function is regarded as the defaulted function.

Patch by Li Kan!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161236 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-03 08:39:58 +00:00
Eli Friedman ea66f9f9e1 Make sure we don't emit IR for unused EH cleanups. PR13359.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161148 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-02 00:10:24 +00:00
John McCall 7916c99712 When devirtualizing the conversion to a virtual base subobject,
don't explode if the offset we get is zero.  This can happen if
you have an empty virtual base class.

While I'm at it, remove an unnecessary block from the IR-generation
of the null-check, mark the eventual GEP as inbounds, and generally
prettify.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161100 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-01 05:04:58 +00:00
Rafael Espindola 98499013bd Consider the visibility of template template arguments. GCC doesn't, but it also
fails to consider the linkage, which we were already considering.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161070 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-31 19:02:02 +00:00
Rafael Espindola b48280ba17 Handle functions with struct arguments or return types and the regparm
attribute. It is a variation of the x86_64 ABI:

* A struct returned indirectly uses the first register argument to pass the
  pointer.
* Floats, Doubles and structs containing only one of them are not passed in
  registers.
* Other structs are split into registers if they fit on the remaining ones.
  Otherwise they are passed in memory.
* When a struct doesn't fit it still consumes the registers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161022 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-31 02:44:24 +00:00
Rafael Espindola a78a640c5f Attributes preceding a function declaration are first applied to the return
type and then propagated to the function. This was failing for destructors,
constructors and constructors templates since they don't have a return type.

Fix that by directly calling processTypeAttrs on the dummy type we use as the
return type in these cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161020 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-31 01:54:04 +00:00
Richard Smith dd25e80a6d PR13479: If we see the definition of an out-of-line destructor in C++11, be
sure to update the exception specification on the declaration as well as the
definition. If we're building in -fno-exceptions mode, nothing else will
trigger it to be updated.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161008 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-30 23:48:14 +00:00
Rafael Espindola 6d4a40edb5 Add a missing testcase for merging the visibility of two declarations used
as arguments of a template.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160911 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-28 02:51:03 +00:00
Richard Smith b9d0b76e42 Final piece of core issue 1330: delay computing the exception specification of
a defaulted special member function until the exception specification is needed
(using the same criteria used for the delayed instantiation of exception
specifications for function temploids).

EST_Delayed is now EST_Unevaluated (using 1330's terminology), and, like
EST_Uninstantiated, carries a pointer to the FunctionDecl which will be used to
resolve the exception specification.

This is enabled for all C++ modes: it's a little faster in the case where the
exception specification isn't used, allows our C++11-in-C++98 extensions to
work, and is still correct for C++98, since in that mode the computation of the
exception specification can't fail.

The diagnostics here aren't great (in particular, we should include implicit
evaluation of exception specifications for defaulted special members in the
template instantiation backtraces), but they're not much worse than before.

Our approach to the problem of cycles between in-class initializers and the
exception specification for a defaulted default constructor is modified a
little by this change -- we now reject any odr-use of a defaulted default
constructor if that constructor uses an in-class initializer and the use is in
an in-class initialzer which is declared lexically earlier. This is a closer
approximation to the current draft solution in core issue 1351, but isn't an
exact match (but the current draft wording isn't reasonable, so that's to be
expected).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160847 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-27 04:22:15 +00:00
Timur Iskhodzhanov bae11d8f82 Remove an outdated comment; add one test to compare function pointer and block mangling
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160783 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-26 13:41:30 +00:00
Timur Iskhodzhanov f58d01a025 Add more tests for PR13207 (Mangling of template back references with -cxx-abi microsoft) now that PR13389 is fixed (mangling of return types)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160782 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-26 11:01:05 +00:00
Timur Iskhodzhanov dc6dabcabd Fix PR13389 (Wrong mangling of return type qualifiers with -cxx-abi microsoft)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160780 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-26 10:41:15 +00:00
Timur Iskhodzhanov f5e0b225b4 Fix PR13207 (Mangling of templates with back references when using -cxx-abi microsoft)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160667 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-24 09:37:54 +00:00
NAKAMURA Takumi 9a29d74fb7 clang/test/CodeGenCXX/debug-info-globalinit.cpp: Fix for -Asserts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160660 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-24 02:03:39 +00:00
Nick Lewycky 78d1a10e13 Emit debug info for dynamic initializers. Permit __attribute__((nodebug)) on
variables that have static storage duration, it removes debug info on the
emitted initializer function but not all debug info about this variable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160659 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-24 01:40:49 +00:00
Timur Iskhodzhanov 1cc9be04bd Follow-up: fix the quotes
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160626 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-23 09:43:03 +00:00
Timur Iskhodzhanov a5427447a3 Replace wrong CHECK array mangling expectations with correct CHECK-NOT+FIXME (PR13182)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160625 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-23 09:32:54 +00:00
Richard Smith adb1d4c18e PR12917: Remove incorrect assumption that lambda mangling information cannot
change once it's been assigned. It can change in two ways:
 1) In a template instantiation, the context declaration should be the
    instantiated declaration, not the declaration in the template.
 2) If a lambda appears in the pattern of a variadic pack expansion, the
    mangling number will depend on the pack length.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160614 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-22 23:45:10 +00:00
Rafael Espindola 71adc5b587 Merge visibility from previous decls before looking at visibility pragma. This
is a bit fuzzy, but matches gcc behavior and existing code bases seem to
depend on it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160364 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-17 15:14:47 +00:00
Rafael Espindola becfc2325c Record visibility pragmas when we see a tag declaration. We might use it
to build a type before seeing the definition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160339 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-17 04:22:25 +00:00
Rafael Espindola 6b60370ddb Apply visibility pragmas to class template declarations. This is needed because
we might use the declaration to build a type before seeing the definition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160176 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-13 18:04:45 +00:00
Rafael Espindola b04b731220 Use -fvisibility-inlines-hidden in inline functions too. This matches gcc
behavior since gcc pr30066. Thanks to Benjamin Kramer for pointing it out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160174 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-13 14:25:36 +00:00
Rafael Espindola d3d02dd0ae Fix a bug in my previous commit. The problem is not that we were not using the
canonical decl for the template, but that we were not merging attributes for
templates at all!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160157 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-13 01:19:08 +00:00
Rafael Espindola 23458208b2 Use the canonical template decl when trying to find if it has a visibility
attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160139 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 20:05:04 +00:00
Timur Iskhodzhanov f9aed96537 [Windows] Split the back reference tests into two separate files as the templates are getting hairy
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160131 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 14:33:58 +00:00