Commit Graph

1957 Commits

Author SHA1 Message Date
Will Dietz 11d0a9f278 [ubsan] Emit single check for left shift.
Avoids warning twice on same shift.

llvm-svn: 176056
2013-02-25 22:37:49 +00:00
Anna Zaks 0f424b029b Revert "Add more attributes from the command line to functions."
This reverts commit 176009.

The commit is a likely cause of several buildbot failures.

llvm-svn: 176044
2013-02-25 19:51:03 +00:00
Bill Wendling 87869db5f5 Add more attributes from the command line to functions.
This is an ongoing process. Any command line option which a back-end cares about
should be added here.

llvm-svn: 176009
2013-02-25 07:15:16 +00:00
Richard Smith 2847b22029 PR15338: Don't assert if -fsanitize=bounds sees array indexing on an incomplete
array type.

llvm-svn: 175982
2013-02-24 01:56:24 +00:00
Richard Smith 539e4a77bb ubsan: Emit bounds checks for array indexing, vector indexing, and (in really simple cases) pointer arithmetic. This augments the existing bounds checking with language-level array bounds information.
llvm-svn: 175949
2013-02-23 02:53:19 +00:00
Rafael Espindola 16c8cf0e11 Remove the hack that avoided mangling static functions in extern C contexts.
Weather we should give C language linkage to functions and variables with
internal linkage probably depends on how much code assumes it. The standard
says they should have no language linkage, but gcc and msvc assign them
C language linkage.

This commit removes the hack that was preventing the mangling on static
functions declare in extern C contexts. It is an experiment to see if we
can implement the rules in the standard.

If it turns out that many users depend on these functions and variables
having C language linkage, we should change isExternC instead and try
to convince the CWG to change the standard.

llvm-svn: 175937
2013-02-23 00:26:28 +00:00
Bill Wendling 19457e282e Update tests so that we don't test for function-only attributes on call sites.
llvm-svn: 175921
2013-02-22 21:12:51 +00:00
Bill Wendling e1c4a1babd Update to use references to attribute groups instead of listing the attributes on the call/invoke instructions.
llvm-svn: 175878
2013-02-22 09:10:20 +00:00
John McCall 5f46c48514 Ignore visibility from enclosing template arguments
for explicit member specializations.

llvm-svn: 175827
2013-02-21 23:42:58 +00:00
Bill Wendling 4467d79ad4 Attempt to clean up tests for non-X86 platforms.
llvm-svn: 175652
2013-02-20 19:30:01 +00:00
Bill Wendling c33fc4c004 Modify the tests to use attribute group references instead of listing the
function attributes.

llvm-svn: 175606
2013-02-20 07:22:19 +00:00
John McCall d041a9bf2d Add a new 'type_visibility' attribute to allow users to
control the visibility of a type for the purposes of RTTI
and template argument restrictions independently of how
visibility propagates to its non-type member declarations.

Also fix r175326 to not ignore template argument visibility
on a template explicit instantiation when a member has
an explicit attribute but the instantiation does not.

The type_visibility work is rdar://11880378

llvm-svn: 175587
2013-02-20 01:54:26 +00:00
Timur Iskhodzhanov 2e9bd807e2 Add the missing 'static' keyword to the test
llvm-svn: 175502
2013-02-19 10:50:44 +00:00
John McCall b4a99d3194 Add support for -fvisibility-ms-compat.
We treat this as an alternative to -fvisibility=<?>
which changes the default value visibility to "hidden"
and the default type visibility to "default".

Expose a -cc1 option for changing the default type
visibility, repurposing -fvisibility as the default
value visibility option (also setting type visibility
from it in the absence of a specific option).

rdar://13079314

llvm-svn: 175480
2013-02-19 01:57:35 +00:00
Lang Hames 01248e4cdc Remove block names from test case to unbreak release builds.
Thanks Chandler. :)

llvm-svn: 175392
2013-02-17 10:18:28 +00:00
Lang Hames bf122744e5 Re-apply r174919 - smarter copy/move assignment/construction, with fixes for
bitfield related issues.

The original commit broke Takumi's builder. The bug was caused by bitfield sizes
being determined by their underlying type, rather than the field info. A similar
issue with bitfield alignments showed up on closer testing. Both have been fixed
in this patch.

llvm-svn: 175389
2013-02-17 07:22:09 +00:00
Richard Smith 65fd2a4e90 Emit vtables for an extern template class as available_externally, not as
linkonce_odr. Emit construction vtables as internal in this case, since the ABI
does not guarantee that they will be availble externally.

llvm-svn: 175330
2013-02-16 00:51:21 +00:00
John McCall df25c43599 Rework the visibility computation algorithm in preparation
for distinguishing type vs. value visibility.

The changes to the visibility of explicit specializations
are intentional.  The change to the "ugly" test case is
a consequence of a sensible implementation, and I am happy
to argue that this is better behavior.  Other changes may
or may not be intended;  it is quite difficult to divine
intent from some of the code I altered.

I've left behind a comment which I hope explains the
philosophy behind visibility computation.

llvm-svn: 175326
2013-02-16 00:17:33 +00:00
Bill Wendling 985d1c5d15 Add the 'target-cpu' and 'target-features' attributes to functions.
The back-end will use these values to reconfigure code generation for different
features.

llvm-svn: 175308
2013-02-15 21:30:01 +00:00
Timur Iskhodzhanov d619711c64 Abstract out emitting the vdtor calls and do it properly when using -cxx-abi microsoft; also fix vdtor calls for the ARM ABI
llvm-svn: 175271
2013-02-15 14:45:22 +00:00
Bill Wendling 48939ced20 Update testcases due to Attribute sorting improvements.
llvm-svn: 175253
2013-02-15 05:25:49 +00:00
Rafael Espindola 3e0e33d7e5 Mangle extern "C" functions whose names are not simple identifiers.
llvm-svn: 175166
2013-02-14 15:38:59 +00:00
Rafael Espindola 46d2b6bacf Partially revert r175117 so that we don't break assumptions about how
static functions in extern "C" contexts are mangled. Should fix the
bootstrap.

llvm-svn: 175132
2013-02-14 03:31:26 +00:00
Rafael Espindola f4187658fa Add a getLanguageLinkage method to VarDecls and FunctionDecls. Use it to fix
some cases where functions with no language linkage were being treated as having
C language linkage. In particular, don't warn in

extern "C" {
  static NonPod foo();
}

Since getLanguageLinkage checks the language linkage, the linkage computation
cannot use the language linkage. Break the loop by checking just the context
in the linkage computation.

llvm-svn: 175117
2013-02-14 01:18:37 +00:00
Richard Smith 2c5868c334 ubsan: Add checking for invalid downcasts. Per [expr.static.cast]p2 and p11,
base-to-derived casts have undefined behavior if the object is not actually an
instance of the derived type.

llvm-svn: 175078
2013-02-13 21:18:23 +00:00
Timur Iskhodzhanov 753875d324 ... and now fix the +Asserts build
llvm-svn: 175054
2013-02-13 12:24:19 +00:00
Timur Iskhodzhanov 6d5dbc6464 Fix the microsoft-abi-structors test expectations to match both Release and Release+Asserts builds
llvm-svn: 175053
2013-02-13 12:14:25 +00:00
Timur Iskhodzhanov ee6bc53365 Emit virtual/deleting destructors properly with -cxx-abi microsoft, PR15058
llvm-svn: 175045
2013-02-13 08:37:51 +00:00
Timur Iskhodzhanov 584248cf3c Rename -constructors test to just -structors as in fact it tests dtors too. Also, fix a minor typo in the test.
llvm-svn: 174966
2013-02-12 13:22:47 +00:00
John McCall e142ad50f1 Call __cxa_begin_catch with the current exception before
calling std::terminate().  rdar://11904428

llvm-svn: 174940
2013-02-12 03:51:46 +00:00
Lang Hames 697b004219 Backing out r174919 while I investigate a self-host bug on Takumi's builder.
llvm-svn: 174925
2013-02-12 00:44:43 +00:00
Lang Hames 5824a4f1b0 When generating IR for default copy-constructors, copy-assignment operators,
move-constructors and move-assignment operators, use memcpy to copy adjacent
POD members.

Previously, classes with one or more Non-POD members would fall back on
element-wise copies for all members, including POD members. This often
generated a lot of IR. Without padding metadata, it wasn't often possible
for the LLVM optimizers to turn the element-wise copies into a memcpy.

This code hasn't yet received any serious tuning. I didn't see any serious
regressions on a self-hosted clang build, or any of the nightly tests, but
I think it's important to get this out in the wild to get more testing.
Insights, feedback and comments welcome.

Many thanks to David Blaikie, Richard Smith, and especially John McCall for
their help and feedback on this work.

llvm-svn: 174919
2013-02-11 23:44:11 +00:00
Tanya Lattner 60e93a6390 Use the target address space value when mangling names.
llvm-svn: 174688
2013-02-08 01:07:32 +00:00
Tim Northover dd9809dd72 Permit ABIs where the caller extends the result (test change).
This test was written to make sure *something* sane is generated, not
to test any ABI's signedness semantics.

This should allow the test to pass if AArch64 is the default target.

llvm-svn: 174618
2013-02-07 15:11:36 +00:00
Benjamin Kramer 96951253bf Drop value names from test to get -Asserts builds back to green.
llvm-svn: 174294
2013-02-03 20:22:35 +00:00
Benjamin Kramer d9c8455adf CodeGen: Implement hint values for dynamic_cast as described in the Itanium C++ ABI.
This can yield dramatic speedups of dynamic_cast for simple inheritance trees,
at least with libsupc++. Neither libcxxabi nor libcxxrt make use of this
hint currently, it was never implemented because clang didn't support it.

There was some concern about the number of class hierarchy walks this change
introduces. If it turns out to be an issue we can add caching either at the cast
pair level or even deeper, but we also do a lot of walks in Sema so this
codepath is probably fairly optimized already.

llvm-svn: 174293
2013-02-03 19:59:25 +00:00
Benjamin Kramer b520633048 CodeGen: Mark the runtime function __dynamic_cast as readonly & nounwind.
This allows the optimizer to CSE dynamic_casts.

llvm-svn: 174289
2013-02-03 17:44:25 +00:00
NAKAMURA Takumi 2209f97d19 clang/test/CodeGenCXX/debug-info-class.cpp: Tweak to unbreak test for a few targets.
- Relax a expression for arm-gnueabi.
  - Exclude msvc to limit target triplets to add limited a few targets.
    Feel free to remove actions if guys thought they redundant.

llvm-svn: 174278
2013-02-03 12:52:54 +00:00
Richard Smith c084bd2888 PR15132: Replace "address expression must be an lvalue or a function
designator" diagnostic with more correct and more human-friendly "cannot take
address of rvalue of type 'T'".

For the case of & &T::f, provide a custom diagnostic, rather than unhelpfully
saying "cannot take address of rvalue of type '<overloaded function type>'".

For the case of &array_temporary, treat it just like a class temporary
(including allowing it as an extension); the existing diagnostic wording
for the class temporary case works fine.

llvm-svn: 174262
2013-02-02 02:14:45 +00:00
Richard Smith d712d0dbdd Don't forget to run destructors when we create an array temporary of class type.
llvm-svn: 174257
2013-02-02 01:13:06 +00:00
David Blaikie f85744235b Generalize DebugInfo tests by avoiding explicit metadata numbers
This addresses several (not all) debug info tests that use explicit metadata
numbers. Wherever the same number appeared more than once in a test I used
a named match to ensure the same number appeared in all those cases (this may
still be overly constraining test cases as they may not have actually cared
about that relationship). For one-off numbers I just replaced them with an
unnamed regex.

This may underconstrain poorly written test cases that were interested in
checking that certain metadata nodes were related but didn't actually match
on all the related nodes numbers.

llvm-svn: 174247
2013-02-02 00:34:26 +00:00
NAKAMURA Takumi a7c84e6050 clang/test/CodeGenCXX/debug-info-class.cpp: Fixup for -Asserts.
llvm-svn: 174229
2013-02-01 22:53:19 +00:00
David Blaikie 357aafb566 Fix exception handling line table problems introduced by r173593
r173593 made us a little too eager to associate all code at the end of a
function with the user-written 'return' line. This caused problems with
breakpoints as they'd be set in exception handling code preceeding the
actual non-exception return handling code, leading to the breakpoint never
being hit in non-exceptional execution.

This change restores the pre-r173593 exception handling line information where
the cleanup code is associated with the '}' not the return line.

llvm-svn: 174206
2013-02-01 19:09:49 +00:00
John McCall 12cc42aa1b Destroy arrays and ARC fields when throwing out of ctors.
Previously we were only handling non-array fields of class type.

Testcases derived from a patch by WenHan Gu.

llvm-svn: 174146
2013-02-01 05:11:40 +00:00
Bill Wendling 85ab57ac5d Update the tests.
This update coincides with r174110. That change ordered the attributes
alphabetically.

llvm-svn: 174111
2013-01-31 23:17:12 +00:00
Tim Northover 9bb857a4f1 Add support for AArch64 target.
In cooperation with the LLVM patch, this should implement all scalar front-end
parts of the C and C++ ABIs for AArch64.

This patch excludes the NEON support also reviewed due to an outbreak of
batshit insanity in our legal department. That will be committed soon bringing
the changes to precisely what has been approved.

Further reviews would be gratefully received.

llvm-svn: 174055
2013-01-31 12:13:10 +00:00
Douglas Gregor 6153500517 When we're emitting a constructor or destructor call from a delegating
constructor, retrieve our VTT parameter directly. Fixes PR14588 /
<rdar://problem/12867962>.

llvm-svn: 174042
2013-01-31 05:50:40 +00:00
Bill Wendling 9806806f39 Modify the tests for the (sorted) order that the attributes come out as now.
llvm-svn: 173762
2013-01-29 03:21:00 +00:00
Dmitri Gribenko 35630ec93a FileCheck'ize tests
llvm-svn: 173720
2013-01-28 21:43:46 +00:00
Tim Northover 20122ad27d Specify non-GNU-ARM triples for key-function test.
Since ARM has diverging ABIs on this detail, it's probably worth
testing both it and a "normal" Itanium system.

llvm-svn: 173576
2013-01-26 15:27:54 +00:00