Commit Graph

1078 Commits

Author SHA1 Message Date
Charles Davis 99202b358f Use the right calling convention when mangling names in the Microsoft C++
mangler. Now member functions and pointers thereof have their calling
convention mangled as __thiscall if they have the default CC (even though,
they technically still have the __cdecl CC).

llvm-svn: 118598
2010-11-09 18:04:24 +00:00
John McCall 478382521e When re-using a vtable slot for the nearest overridden method, just because
there's no return adjustment from the overridden to the overrider doesn't
mean there isn't a return adjustment from the overrider to the final
overrider.  This matters if we're emitting a virtual this-adjustment thunk
because the overrider virtually inherits from the class providing the
nearest overridden method.  Do the appropriate return adjustment in this case.

Fixes PR7611.

llvm-svn: 118466
2010-11-09 01:18:05 +00:00
NAKAMURA Takumi 2fbf57a949 test/CodeGenCXX/rtti-linkage.cpp: Get rid of sort(1) to remove XFAIL: win32.
On the certain system, bogus SORT.EXE is picked up. Its sort-order is incompatible to POSIX.

llvm-svn: 118391
2010-11-08 01:05:10 +00:00
John McCall cdf7ef5437 Simplify the logic for emitting guard variables for template static
data members by delaying the emission of the initializer until after
linkage and visibility have been set on the global.  Also, don't
emit a guard unless the variable actually ends up with vague linkage,
and don't use thread-safe statics in any case.

llvm-svn: 118336
2010-11-06 09:44:32 +00:00
Anders Carlsson 898b1fb1e2 Pass a -I flag when compiling nullptr.cpp so the typeinfo header can be found. This should fix the errors seen on the bot.
llvm-svn: 118246
2010-11-04 12:18:32 +00:00
Anders Carlsson ba37e1eb49 std::nullptr_t is a fundamental type for RTTI purposes.
llvm-svn: 118238
2010-11-04 05:28:09 +00:00
Anders Carlsson 2683fd6f8c Mangle std::nullptr_t as specified by the Itanium C++ ABI.
llvm-svn: 118236
2010-11-04 04:31:32 +00:00
Argyrios Kyrtzidis 9a94d9b876 Don't instantiate members not belonging in the semantic context of the template.
e.g. for:

    template <int i> class A {
      class B *g;
    };

'class B' has the template as lexical context but semantically it is
introduced in namespace scope.

Fixes rdar://8611125 & http://llvm.org/PR8505

llvm-svn: 118235
2010-11-04 03:18:57 +00:00
Fariborz Jahanian dba351df64 Fixes an assertion violation when bind to temporary
expression is a dependent expression. 
// rdar: // 8620524 and PR7851

llvm-svn: 118066
2010-11-02 21:05:53 +00:00
John McCall 8e7cb6dcfa Ensure that static local variables in function templates inherit the
visibility of their function.

llvm-svn: 118065
2010-11-02 21:04:24 +00:00
Fariborz Jahanian dc9bc5aeb8 Fix a crash mangling decayed val argument-typed function.
// rdar: //8620510 and PR7666

llvm-svn: 118019
2010-11-02 16:54:00 +00:00
Argyrios Kyrtzidis 3050d9bdb8 Properly handle temporaries that are created in a AsmStmt.
Previously the temporaries would get destroyed before the asm call.

llvm-svn: 118001
2010-11-02 02:33:08 +00:00
John McCall 07072664c4 Ignore attributes on classes when calculating visibility for members
with their own explicit visibility attributes.  Basically we only want to
apply a single visibility attribute from any particular ancestry.

llvm-svn: 117998
2010-11-02 01:45:15 +00:00
John McCall e6e622e789 Only apply -fvisibility-inlines-hidden to definitions. Apparently
isInlined() just gives meaningless results for non-definitions.

Fixes rdar://problem/8614470

llvm-svn: 117887
2010-11-01 01:29:57 +00:00
Anders Carlsson 1827509176 Teach the constant expr evaluator about derived-to-base casts when no virtual bases are involved. Fixes PR5974.
llvm-svn: 117868
2010-10-31 20:41:46 +00:00
Anders Carlsson a5df61a341 Don't try to evaluate the LHS or RHS of a member pointer binary operation. Fixes PR8507.
llvm-svn: 117850
2010-10-31 01:21:47 +00:00
John McCall c273f24196 Better solution: calculate the visibility of functions and variables
independently of whether they're definitions, then teach IR generation to
ignore non-explicit visibility when emitting declarations.  Use this to
make sure that RTTI, vtables, and VTTs get the right visibility.

More of rdar://problem/8613093

llvm-svn: 117781
2010-10-30 11:50:40 +00:00
John McCall 36cd5cc150 GCC faithfully calculates visibility for variables independently of
whether it's a declaration or not, then ignores that information for
declarations unless it was explicitly given.  It's not totally clear
how that should be mapped into a sane system, but make an effort.

llvm-svn: 117780
2010-10-30 09:18:49 +00:00
John McCall 37bb6c9832 Restore r117644, this time properly ignoring -fvisibility and type visibility
for namespace-scope variable declarations.

Apply visibility in IR gen to variables that are merely declared
and never defined.  We were previously emitting these with default
visibility unless they were declared with private_extern.

Ignore global visibility settings when computing visibility for
a declaration's context, and key several conditions on whether a
visibility attribute exists anywhere in the hierarchy as opposed
to whether it exists at the current level.

llvm-svn: 117729
2010-10-29 22:22:43 +00:00
Rafael Espindola 5275559c2e Update tests to not search of as.
llvm-svn: 117711
2010-10-29 21:18:11 +00:00
Daniel Dunbar df8792128f Revert r117644, "Apply visibility in IR gen to variables that are merely
declared", it breaks things.

llvm-svn: 117653
2010-10-29 15:19:36 +00:00
John McCall 077dc60540 Don't assert on attempts to throw 'bool'. I wonder if in the history of C++
anyone has ever intentionally done this outside of a compiler test case.

llvm-svn: 117645
2010-10-29 08:14:02 +00:00
John McCall 4af6bf1fdc Apply visibility in IR gen to variables that are merely declared
and never defined.  We were previously emitting these with default
visibility unless they were declared with private_extern.

Ignore global visibility settings when computing visibility for
a declaration's context, and key several conditions on whether a
visibility attribute exists anywhere in the hierarchy as opposed
to whether it exists at the current level.

llvm-svn: 117644
2010-10-29 07:49:41 +00:00
John McCall 033caa5895 When computing the visibility of a class member, calculate the visibility
of its context without considering global settings like -fvisibility=hidden.
Fixes PR8492.

llvm-svn: 117628
2010-10-29 00:29:13 +00:00
John McCall 62b6862c5e Don't apply -fvisibility-inlines-hidden to extern templates.
Part 2 of rdar://problem/8595231

llvm-svn: 117567
2010-10-28 18:10:36 +00:00
John McCall 2efaf11695 Abandon the type-visibility optimization for functions. GCC doesn't do it,
and it's too much trouble to push for.  Fixes PR8478.

llvm-svn: 117532
2010-10-28 07:07:52 +00:00
Stuart Hastings c6d136cba1 Test passes on Darwin; try to XFAIL on freebsd, linux, xp/msvc9.
llvm-svn: 117515
2010-10-28 00:47:58 +00:00
Devang Patel 1bee63f325 Fix context info for enums.
Radar 8595129

llvm-svn: 117507
2010-10-27 23:23:58 +00:00
Fariborz Jahanian 5701585780 patch to do array-to-pointer conversion in a
statement-expression. // rdar: //8600553

llvm-svn: 117479
2010-10-27 20:10:28 +00:00
Anders Carlsson b00c2144b3 Also devirtualize calls to a member functions where the containing class has been marked final.
llvm-svn: 117445
2010-10-27 13:34:43 +00:00
Anders Carlsson a7911fa3d7 If a virtual member function has the 'final' attribute, we can devirtualize calls to it.
llvm-svn: 117444
2010-10-27 13:28:46 +00:00
Fariborz Jahanian 67ca8c4c7b Patch to provide guard when initializing instances
of static data member of a class template.
Fixes //rdar :// 8562966 and pr8409.

llvm-svn: 117410
2010-10-26 22:47:47 +00:00
John McCall 5fe84129e2 A couple of tweaks to the visibility rules:
- tags with C linkage should ignore visibility=hidden
  - functions and variables with explicit visibility attributes should
    ignore the linkage of their types
Either of these should be sufficient to fix PR8457.

Also, FileCheck-ize a test case.

llvm-svn: 117351
2010-10-26 04:59:26 +00:00
Fariborz Jahanian 56143ae715 Patch for mis-compile of statement expressions with
non-trivial copy constructors. // rdar: //8540501.
A test will be added to llvm nightly tests.

llvm-svn: 117324
2010-10-25 23:27:26 +00:00
Fariborz Jahanian 059fe5ba09 Test emoved.
llvm-svn: 117160
2010-10-22 22:05:40 +00:00
Fariborz Jahanian c123623d28 After discussion with Doug and John, I am reverting
the patch. 

llvm-svn: 117159
2010-10-22 22:05:03 +00:00
John McCall 457a04e3ce Substantially revise how clang computes the visibility of a declaration to
more closely parallel the computation of linkage.  This gets us to a state
much closer to what gcc emits, modulo bugs, which will undoubtedly arise in
abundance.

llvm-svn: 117147
2010-10-22 21:05:15 +00:00
Fariborz Jahanian 0196aa28ec Patch fixes miscompile with non-trivial copy constructors and
statement expressions, //rdar: //8540501

llvm-svn: 117146
2010-10-22 21:01:02 +00:00
John McCall 18e4edae82 Fix some bugs in local class mangling brought up in PR8355.
Patch by Richard Smith!

llvm-svn: 116752
2010-10-18 21:28:44 +00:00
John McCall 2c2eb12d9c White-listing templated-scope friend decls is a good idea, but doing it
by marking the decl invalid isn't.  Make some steps towards supporting these
and then hastily shut them down at the last second by marking them as
unsupported.

llvm-svn: 116661
2010-10-16 06:59:13 +00:00
Chandler Carruth dc689c4156 Not really sure how this worked, but it seems like a clear typo. =]
llvm-svn: 116650
2010-10-16 00:24:52 +00:00
Argyrios Kyrtzidis 8c64bbe032 Embrace C++ ABI 5.2.6 and consider that template instantiations don't have key functions (same as GCC).
llvm-svn: 116391
2010-10-13 02:39:41 +00:00
Argyrios Kyrtzidis 0c34b138df Make sure the VTables for template instantiations are emitted even if the key function doesn't have a body.
llvm-svn: 116186
2010-10-11 03:25:57 +00:00
Argyrios Kyrtzidis f0e31c8b9c Don't let typeinfo name symbols be 'internal hidden', it can lead to linker conflicts
with similarly named classes in anonymous namespaces.

llvm-svn: 116185
2010-10-11 03:25:53 +00:00
John McCall c8fd6a48cf Secure this test against slightly different number formatters.
llvm-svn: 116141
2010-10-09 02:28:39 +00:00
John McCall a2fabff4f6 Permit constant evaluation of const floating-point variables with
constant initializers.

llvm-svn: 116138
2010-10-09 01:34:31 +00:00
John McCall 09d1369964 When instantiating a new-expression, force a rebuild if there were default
arguments in either the placement or constructor arguments.  This is
important if the default arguments refer to a declaration or create a
temporary.

llvm-svn: 115700
2010-10-05 22:36:42 +00:00
John McCall 46b4dc32df ...without leaving a temporary file behind.
llvm-svn: 115671
2010-10-05 20:53:58 +00:00
John McCall 0ec01b0ca4 Er, this test should actually run IR generation.
llvm-svn: 115670
2010-10-05 20:53:00 +00:00
John McCall e5dd32da11 Teach PopCleanupBlock to correctly handle the possibility of branching through
a EH-only cleanup as part of a fallthrough branch-through.  That this happens
for this test case is actually a separate bug.

llvm-svn: 115668
2010-10-05 20:48:15 +00:00