Commit Graph

57780 Commits

Author SHA1 Message Date
Richard Trieu 20abd6bc04 Use concrete type instead of auto in for-loop. No functionality change.
llvm-svn: 234976
2015-04-15 03:48:48 +00:00
Duncan P. N. Exon Smith fda02091e6 uselistorder: Remove dead include
Forgot to remove the include in r234970

llvm-svn: 234972
2015-04-15 03:04:45 +00:00
Duncan P. N. Exon Smith bb9cadf4eb uselistorder: -mllvm -preserve-ll-use-list-order => -emit-llvm-uselists
Follow up to r234962, start respecting `-emit-llvm-uselists even for
LLVM assembly.  Note that the driver never passes this flag; this is
just a interface convenience/consistency for those using `-cc1`
directly.  This required LLVM r234969 (and predecessors).

llvm-svn: 234970
2015-04-15 02:45:28 +00:00
Richard Trieu b58413323d Change range-based for-loops to be -Wrange-loop-analysis clean.
No functionality change.

llvm-svn: 234964
2015-04-15 01:21:42 +00:00
Duncan P. N. Exon Smith bb61825cd5 uselistorder: -mllvm -preserve-bc-use-list-order => -emit-llvm-uselists
Stop relying on `cl::opt` to pass along the driver's decision to
preserve use-lists.  Create a new `-cc1` option called
`-emit-llvm-uselists` that does the right thing (when -emit-llvm-bc).
Note that despite its generic name, it *doesn't* do the right thing when
-emit-llvm (LLVM assembly) yet.  I'll hook that up soon.

This doesn't really change the behaviour of the driver.  The default is
still to preserve use-lists for `clang -emit-llvm` and `clang
-save-temps`, and nothing else.  But it stops relying on global state
(and also is a nicer interface for hackers using `clang -cc1`).

llvm-svn: 234962
2015-04-15 01:16:18 +00:00
Reid Kleckner e07140eb3f Move the logic to avoid double global emission from Sema to CodeGen
Reverts the code changes from r234675 but keeps the test case.

We were already maintaining a DenseMap of globals with dynamic
initializers anyway.

Fixes the test case from PR23234.

llvm-svn: 234961
2015-04-15 01:08:06 +00:00
Duncan P. N. Exon Smith 58927f1aa2 uselistorder: Update for LLVM API change in r234959
Now that `addBitcodeWriterPass()` requires an explicit bit to preserve
use-list order, send it in from `clang`.  It looks like I'll be able to
push this up to the `-cc1` options.

llvm-svn: 234960
2015-04-15 00:36:14 +00:00
Reid Kleckner ebaf28d13d Reland r234613 (and follow-ups 234614, 234616, 234618)
The frameescape intrinsic cannot be inlined, so I fixed the inliner in
r234937. This should address PR23216.

llvm-svn: 234942
2015-04-14 20:59:00 +00:00
Duncan P. N. Exon Smith d863f6f250 IR: Change clang to set -preserve-bc-uselistorder
Change `clang` to set `-preserve-bc-uselistorder` for the driver options
`-emit-llvm` and `-save-temps`.  The former is useful for reproducing
results from `clang` in `opt` or `llc`, while the latter prevents
`-save-temps` from affecting the output.  This is part of PR5680.

`-preserve-bc-uselistorder=true` is currently on by default, but a
follow-up commit in LLVM will reverse it.

llvm-svn: 234920
2015-04-14 18:30:13 +00:00
Fariborz Jahanian dcf06f4232 [SemaCXX patch] Patch to fix a crash when a 'delete' constructor
is being accessed. Reviewed by Richard Smith.
rdar://20281011

llvm-svn: 234912
2015-04-14 17:21:58 +00:00
Rafael Espindola 2f16bc1095 Use raw_pwrite_stream in clang.
This is a small improvement to -emit-pth and allows llvm to start requiring it.

llvm-svn: 234897
2015-04-14 15:15:49 +00:00
Tom Stellard 7b1059bb2d R600: Add GCC reg names
llvm-svn: 234892
2015-04-14 14:36:56 +00:00
Anton Yartsev b50f4ba461 [analyzer] This implements potential undefbehavior.ZeroAllocDereference checker.
TODO: support realloc(). Currently it is not possible due to the present realloc() handling. Currently RegionState is not being attached to realloc() in case of a zero Size argument. 
llvm-svn: 234889
2015-04-14 14:18:04 +00:00
Petar Jovanovic 1dbc317736 [Mips] Generate warning for invalid '-mnan' and '-march' combinations
This patch generates a warning for invalid combination of '-mnan' and
'-march' options, it properly sets NaN encoding for a given '-march',
and it passes a proper NaN encoding to the assembler.

Patch by Vladimir Radosavljevic.

Differential Revision: http://reviews.llvm.org/D8170

llvm-svn: 234882
2015-04-14 12:49:08 +00:00
Nikola Smiljanic 879d1be643 Remove useless statement.
llvm-svn: 234881
2015-04-14 12:33:33 +00:00
Alexey Bataev 420d45b2dd [OPENMP] Fixed codegen for arrays in 'copyprivate' clause.
Fixed a bug with codegen of variables with array types specified in 'copyprivate' clause of 'single' directive.
Differential Revision: http://reviews.llvm.org/D8914

llvm-svn: 234856
2015-04-14 05:11:24 +00:00
Alexey Bataev 68adb7da1a [OPENMP] Initial codegen for 'parallel sections' directive.
Emits code for outlined 'parallel' directive with the implicitly inlined 'sections' directive:

...
call __kmpc_fork_call(..., outlined_function, ...);
...

define internal void outlined_function(...) {
    <code for implicit sections directive>;
}
Differential Revision: http://reviews.llvm.org/D8997

llvm-svn: 234849
2015-04-14 03:29:22 +00:00
Duncan P. N. Exon Smith 87afdeb8f5 DebugInfo: Prepare for DISubprogram/DILexicalBlock* to be gutted
An upcoming LLVM commit will remove this API, so stop using it.  Just
access the raw pointers using `operator->()`.

llvm-svn: 234848
2015-04-14 03:24:14 +00:00
Richard Trieu 3e1d483e0e Add new warning -Wrange-loop-analysis to warn on copies during loops.
-Wrange-loop-analysis is a subgroup of -Wloop-analysis and will warn when
a range-based for-loop makes copies of the elements in the range.  If possible,
suggest the proper type to prevent copies, or the non-reference to help
distinguish copy versus non-copy forms.  Existing warnings in -Wloop-analysis
are moved to -Wfor-loop-analysis, also a subgroup of -Wloop-analysis.

Differential Revision: http://reviews.llvm.org/D4169

llvm-svn: 234804
2015-04-13 22:08:55 +00:00
Nico Weber ad108337cf Revert r234613 (and follow-ups 234614, 234616, 234618), it caused PR23216.
llvm-svn: 234789
2015-04-13 20:04:22 +00:00
Nico Weber f2a39a7b4e Revert r234786, it contained a bunch of stuff I did not mean to commit.
llvm-svn: 234787
2015-04-13 20:03:03 +00:00
Nico Weber b31abb05fb Revert r234613 (and follow-ups 234614, 234616, 234618), it caused PR23216.
llvm-svn: 234786
2015-04-13 20:01:20 +00:00
Argyrios Kyrtzidis 6f1fadf989 [CodeGen] Fix crash with duplicated mangled name.
Patch by Yunzhong Gao!

llvm-svn: 234767
2015-04-13 17:40:46 +00:00
Argyrios Kyrtzidis 2bff5161c4 [libclang] Add functions to get information about fields.
Patch by Loïc Jaquemet!

llvm-svn: 234762
2015-04-13 16:55:04 +00:00
Daniel Jasper d9309774a6 clang-format: [JS] Support index signature types.
Patch by Martin Probst.

llvm-svn: 234754
2015-04-13 15:03:30 +00:00
Daniel Jasper a74f5072e1 clang-format: [JS] support optionality markers in JS types.
Patch by Martin Probst. Thank you.

llvm-svn: 234753
2015-04-13 15:01:40 +00:00
Daniel Jasper 6a5d38d2ee clang-format: [JS] Allow periods and commata in class declarations.
Patch by Martin Probst. Thank you.

llvm-svn: 234752
2015-04-13 14:56:54 +00:00
Justin Bogner 1c21c28b9e InstrProf: Simplify getStmtCount by using an Optional
llvm-svn: 234750
2015-04-13 12:23:19 +00:00
Rafael Espindola 463d4dd6c6 Bring r234620 back now that llvm is fixed.
LLVM can now detect if a fd is seekable on windows.

Original commit message:

Actually check if lseek works instead of using a filename based heuristic.

llvm-svn: 234738
2015-04-13 11:14:39 +00:00
NAKAMURA Takumi 5594d7926d Reformat.
llvm-svn: 234731
2015-04-13 08:43:40 +00:00
NAKAMURA Takumi 90a4877e31 Revert r234620 and others, "Actually check if lseek works instead of using a filename based heuristic." It was affected by r234615, which was reverted in r234721.
r234620, "Actually check if lseek works instead of using a filename based heuristic."
  r234621, "Testcase for the previous commit."
  r234718, "Suppress clang/test/PCH/emit-pth.c on win32, for now while investigating."

llvm-svn: 234730
2015-04-13 08:43:31 +00:00
Alexey Bataev 671605e85b [OPENMP] Initial codegen for 'parallel for' directive.
Allows generation of combined 'parallel for' directive that represents 'parallel' region with internal implicit 'for' worksharing region.
Differential Revision: http://reviews.llvm.org/D8631

llvm-svn: 234722
2015-04-13 05:28:11 +00:00
NAKAMURA Takumi 73d0280db6 Suppress clang/test/PCH/emit-pth.c on win32, for now while investigating.
MSVCRT's _lseek(SEEK_CUR) doesn't return -1 for raw_ostream::SupportSeeking.

llvm-svn: 234718
2015-04-13 00:30:23 +00:00
Hans Wennborg 7aeeb92a98 clang-cl: Expose -f[no-]diagnostics-color
If we have -f[no-]color-diagnostics, we might as well have these
too.

llvm-svn: 234702
2015-04-12 07:12:19 +00:00
Nico Weber 1c565c31b1 Revert r234581, it might have caused a few miscompiles in Chromium.
If the revert helps, I'll get a repro this Monday.  Else I'll put the change
back in.

llvm-svn: 234700
2015-04-11 23:51:38 +00:00
Duncan P. N. Exon Smith 497d4d465b DebugInfo: Switch from replaceAllUsesWith() to replaceTemporary()
Stop using `DIDescriptor`'s wrapper around
`MDNode::replaceAllUsesWith()` (which is going away).  The new home for
this logic is `DIBuilder::replaceTemporary()`, added in LLVM r234695.

llvm-svn: 234696
2015-04-11 19:05:04 +00:00
Benjamin Kramer 8017237277 Remove empty non-virtual destructors or mark them =default when non-public
These add no value but can make a class non-trivially copyable. NFC.

llvm-svn: 234689
2015-04-11 15:58:30 +00:00
NAKAMURA Takumi 7b24b0573d clang/test/CodeGenCXX/static-data-member-single-emission.cpp: Tweak for MS mangler.
llvm-svn: 234687
2015-04-11 14:57:11 +00:00
Hans Wennborg bec52353bc clang-cl: support -fno-color-diagnostics (PR23109)
Patch by Bernard Solomon, tests by me.

llvm-svn: 234685
2015-04-11 12:27:56 +00:00
Hans Wennborg c296b045c0 clang-cl: support -fmacro-backtrace-limit
Also fix the test for "core options" to actually fail
in case an option isn't supported.

llvm-svn: 234684
2015-04-11 11:44:44 +00:00
Nemanja Ivanovic 35458c2fe9 Add Clang support for -mdirect-move on PPC
This patch corresponds to review:
http://reviews.llvm.org/D8930

This just adds a front end option to let the back end know the target has PPC
direct move instructions.

llvm-svn: 234683
2015-04-11 10:43:36 +00:00
Alexander Kornienko 34eb20725d Use 'override/final' instead of 'virtual' for overridden methods
Summary:
The patch is generated using clang-tidy misc-use-override check.

This command was used:

  tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \
    -checks='-*,misc-use-override' -header-filter='llvm|clang' -j=32 -fix

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D8926

llvm-svn: 234678
2015-04-11 02:00:23 +00:00
Richard Trieu af7d76c720 Improve the error message for assigning to read-only variables.
Previously, many error messages would simply be "read-only variable is not
assignable"  This change provides more information about why the variable is
not assignable, as well as note to where the const is located.

Differential Revision: http://reviews.llvm.org/D4479

llvm-svn: 234677
2015-04-11 01:53:13 +00:00
Reid Kleckner 620d0ce55c Only notify consumers about static data members of class templates once
llvm-svn: 234675
2015-04-11 01:25:36 +00:00
Ahmed Bougacha 256a869d31 [Driver] Properly support -mglobal-merge using explicit options.
Follow-up to r234666.  With this, the -m[no-]global-merge options
have the expected behavior. Previously, -mglobal-merge was ignored,
and there was no way of enabling the optimization.

llvm-svn: 234668
2015-04-11 00:10:44 +00:00
Derek Schuff a419e1ce6c NaCl ARM: fix assembler float abi flags
Summary:
tools::arm::getARMFloatABI() was falling back to guessing soft-float because
it wasn't seeing the GNUEABIHF environment from ComputeEffectivClangTriple
when it was called from gnutools::Assemble::ConstructJob.

Fix by using the effective clang triple in gnutools::Assemble, which now
matches the -triple flag used by cc1 and ClangAs jobs.

Reviewers: jvoung

Subscribers: rengolin, jfb, aemerson, cfe-commits

Differential Revision: http://reviews.llvm.org/D8902

llvm-svn: 234661
2015-04-10 23:07:19 +00:00
Ben Langmuir eb8bd2d9b3 Workaround a performance issue with modules + PCH
More fallout from r228234; when looking up an identifier in a PCH that
imports the Cocoa module on Darwin, it was taking 2 to 5 seconds
because we were hammering the MapVector::erase() function, which is
O(n).  For now, just clear() the contained SmallVector to get back to
0.25 - 0.5 seconds.  This is probably not the long-term fix, because
without modules or without PCH the performance is more like 0.02
seconds.

llvm-svn: 234655
2015-04-10 22:25:42 +00:00
Fariborz Jahanian 27aa9b4028 [Objective-C Sema] Fixes a typo which did not allow
bridge casting to super class of object's bridge type.
rdar://18311183

llvm-svn: 234652
2015-04-10 22:07:47 +00:00
Benjamin Kramer 5c40407038 [tblgen] Use StringRef::trim
llvm-svn: 234643
2015-04-10 21:37:21 +00:00
Joerg Sonnenberger 740f3f4a95 Create the correct profiling symbol on NetBSD.
llvm-svn: 234636
2015-04-10 21:02:53 +00:00
Joerg Sonnenberger 22a2d99e25 Create correct platform-specific target for NetBSD PPC64LE.
llvm-svn: 234629
2015-04-10 20:53:48 +00:00
Kaelyn Takata 5cc8535596 Don't eagerly typo-correct to a keyword if the next token is a right paren.
Take advantage of the delayed typo no longer being eagerly corrected to
a keyword to filter out keyword corrections (and other things like
unresolved & overloaded expressions, which have placeholder types) when
correcting typos inside of a decltype().

llvm-svn: 234623
2015-04-10 19:16:46 +00:00
Rafael Espindola c8bc303faa Testcase for the previous commit.
Sorry, fogot to "git add" the previous time.

llvm-svn: 234621
2015-04-10 18:18:17 +00:00
Rafael Espindola d7e306fbcc Actually check if lseek works instead of using a filename based heuristic.
llvm-svn: 234620
2015-04-10 18:16:30 +00:00
Reid Kleckner 5522d815eb [SEH] Add test for inline functions using SEH helpers
Such helpers should always be comdat with the parent function and have
internal linkage.

llvm-svn: 234618
2015-04-10 18:07:38 +00:00
Reid Kleckner 7553a4bca0 Really fix exceptions-seh-finally.c
llvm-svn: 234616
2015-04-10 17:53:39 +00:00
Reid Kleckner 865c2ca882 Try to fix exceptions-seh-finally.c
llvm-svn: 234614
2015-04-10 17:45:23 +00:00
Reid Kleckner 11859afd5f [SEH] Re-land r234532, but use internal linkage for all SEH helpers
Even though these symbols are in a comdat group, the Microsoft linker
really wants them to have internal linkage.

I'm planning to tweak the mangling in a follow-up change. This is a
straight revert with a 1-line fix.

llvm-svn: 234613
2015-04-10 17:34:52 +00:00
Reid Kleckner 0aa128e219 [Frontend] Close open file handles before renaming output files
The placement of the 'delete' call that was removed in the unique_ptr
migration in r234597 was not an accident. The raw_ostream has to be
destroyed before you do the rename on Windows, otherwise you get
ERROR_ACCESS_DENIED. We can still use unique_ptr, we just need to do a
manual reset().

Also, range-for-loop-ify this code.

llvm-svn: 234612
2015-04-10 17:27:58 +00:00
Benjamin Kramer c19cde119d Don't rely on implicit CallSite construction.
llvm-svn: 234600
2015-04-10 14:49:31 +00:00
Rafael Espindola 5cb3cf0312 Try to make MSVC happy.
llvm-svn: 234599
2015-04-10 14:37:39 +00:00
Rafael Espindola c80a40661c Return std::unique_ptr to avoid a release and recreate.
llvm-svn: 234598
2015-04-10 14:30:43 +00:00
Rafael Espindola 269ec0f470 Use a std::unique_ptr to make it easier to see who owns the stream.
llvm-svn: 234597
2015-04-10 14:11:52 +00:00
Rafael Espindola bfd25d4d8a Return a pointer instead of having a pointer outparam and a bool return.
llvm-svn: 234592
2015-04-10 13:14:31 +00:00
Aaron Ballman fe47a98c18 Initializing an uninitialized data member; should be NFC.
llvm-svn: 234591
2015-04-10 13:05:04 +00:00
Rafael Espindola 47de149565 Return a pointer instead of having a pointer outparam and a bool return.
llvm-svn: 234590
2015-04-10 12:54:53 +00:00
Benjamin Kramer a008d3a9f9 Reduce dyn_cast<> to isa<> or cast<> where possible. Clang edition.
No functional change intended.

llvm-svn: 234587
2015-04-10 11:37:55 +00:00
Alexey Bataev 794ba0dcb7 [OPENMP] Codegen for 'reduction' clause in 'parallel' directive.
Emit a code for reduction clause. Next code should be emitted for reductions:

static kmp_critical_name lock = { 0 };

void reduce_func(void *lhs[<n>], void *rhs[<n>]) {
  ...
  *(Type<i> *)lhs[i] = RedOp<i>(*(Type<i> *)lhs[i], *(Type<i> *)rhs[i]);
  ...
}

... void *RedList[<n>] = {&<RHSExprs>[0], ..., &<RHSExprs>[<n> - 1]};
switch (__kmpc_reduce{_nowait}(<loc>, <gtid>, <n>, sizeof(RedList), RedList, reduce_func, &<lock>)) {
case 1:
  ...
  <LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i]);
  ...
  __kmpc_end_reduce{_nowait}(<loc>, <gtid>, &<lock>);
  break;
case 2:
  ...
  Atomic(<LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i]));
  ...
  break;
default:
  ;
}
Reduction variables are a kind of a private variables, they have private copies, but initial values are chosen in accordance with the reduction operation.

Differential Revision: http://reviews.llvm.org/D8915

llvm-svn: 234583
2015-04-10 10:43:45 +00:00
Arnaud A. de Grandmaison 047a686d53 Remove threshold for inserting lifetime markers for named temporaries
Now that TailRecursionElimination has been fixed with r222354, the
threshold on size for lifetime marker insertion can be removed. This
only affects named temporary though, as the patch for unnamed temporaries
is still in progress.

My previous commit (r222993) was not handling debuginfo correctly, but
this could only be seen with some asan tests. Basically, lifetime markers
are just instrumentation for the compiler's usage and should not affect
debug information; however, the cleanup infrastructure was assuming it
contained only destructors, i.e. actual code to be executed, and was
setting the breakpoint for the end of the function to the closing '}', and
not the return statement, in order to show some destructors have been
called when leaving the function. This is wrong when the cleanups are only
lifetime markers, and this is now fixed.

llvm-svn: 234581
2015-04-10 10:13:52 +00:00
Szabolcs Sipos f83a92302f Reverting test commit.
llvm-svn: 234578
2015-04-10 08:43:58 +00:00
Szabolcs Sipos 5acd963175 Test commit.
llvm-svn: 234577
2015-04-10 08:42:08 +00:00
Alexey Bataev 3e6124bc4d [OPENMP] Fixed cleanup of OpenMP code.
llvm-svn: 234575
2015-04-10 07:48:12 +00:00
Nick Lewycky b9489a696e Fix typo in test. There is no %clangcxx, but there is %clangxx.
llvm-svn: 234574
2015-04-10 07:43:19 +00:00
Alexey Bataev d7614fb7e0 [OPENMP] Fixing troubles with lambdas in cleanups.
llvm-svn: 234572
2015-04-10 06:33:45 +00:00
Alexey Bataev d3ae853c3d [OPENMP] Fixed incompatibility with MSVC, NFC.
llvm-svn: 234568
2015-04-10 05:32:31 +00:00
David Majnemer bd38544c0a [Sema] Don't assume that an initializer list has an initializer
Given something like 'int({}, 1)', we would try to emit a diagnostic
regarding the excess element in the scalar initializer.  However, we
assumed that the initializer list had an element in it.

llvm-svn: 234565
2015-04-10 04:52:06 +00:00
Alexey Bataev 6f1ffc069b [OPENMP] Refactoring of codegen for OpenMP directives.
Refactored API of OpenMPRuntime for compatibility with combined directives.
Differential Revision: http://reviews.llvm.org/D8859

llvm-svn: 234564
2015-04-10 04:50:10 +00:00
Nico Weber bd51a6a99f Revert r234532 for a bit, it very likely caused http://crbug.com/475768
llvm-svn: 234563
2015-04-10 04:33:03 +00:00
Ekaterina Romanova b929ad7b17 _mm256_blend_epi16 is being cast to __m256d instead of __m256i. Fixing this.
llvm-svn: 234560
2015-04-10 02:39:45 +00:00
Richard Smith 13090a2304 [modules] Remove unused MACRO_TABLE record.
llvm-svn: 234555
2015-04-10 02:02:24 +00:00
Nemanja Ivanovic 239eec732e Add Clang support for remaining integer divide and permute instructions from ISA 2.06
This patch corresponds to review:
http://reviews.llvm.org/D8398

It adds some builtin functions to access the extended divide and bit permute instructions.

llvm-svn: 234547
2015-04-09 23:58:16 +00:00
Fariborz Jahanian 696c88753f [Objective-C Sema] It is permissable to bridge cast to 'id'
of a CFType bridged to some unknown Objective-C type. 
rdar://20113785

llvm-svn: 234545
2015-04-09 23:39:53 +00:00
Benjamin Kramer 85be49d26d Update test case for r234543.
llvm-svn: 234544
2015-04-09 22:54:53 +00:00
Benjamin Kramer f3e67de85a [CodeGen] Do a more principled fix for PR231653, always use the inner type.
We were still using the MaterializeTemporaryExpr's type to check if the
transform is legal. Always use the inner Expr type.

llvm-svn: 234543
2015-04-09 22:50:07 +00:00
Rafael Espindola 7e556adddd Propagate usage of std:unique_ptr a bit. NFC.
llvm-svn: 234538
2015-04-09 21:50:11 +00:00
Rafael Espindola 4dedcd7eab Update for LLVM api changes.
llvm-svn: 234536
2015-04-09 21:06:11 +00:00
Reid Kleckner 93d0511e8c Use Linux sysroot in Driver test case from r234521
We don't actually need a real Mac sysroot to make the test pass, just a
linker.  This makes the test pass in environments where no ld is on
PATH.

llvm-svn: 234533
2015-04-09 20:37:38 +00:00
Reid Kleckner 0dbecf2b78 [SEH] Outline finally blocks using the new variable capture support
WinEHPrepare was going to have to pattern match the control flow merge
and split that the old lowering used, and that wasn't really feasible.

Now we can teach WinEHPrepare to pattern match this, which is much
simpler:
  %fp = call i8* @llvm.frameaddress(i32 0)
  call void @func(iN [01], i8* %fp)

This prototype happens to match the prototype used by the Win64 SEH
personality function, so this is really simple.

llvm-svn: 234532
2015-04-09 20:37:24 +00:00
David Majnemer df8f73fd8a [Sema] Diagnose references to unbound arrays in function definitions
A [*] is only allowed in a declaration for a function, not in its
definition.  We didn't correctly recurse on reference types while
looking for it, causing us to crash in CodeGen instead of rejecting it.

llvm-svn: 234528
2015-04-09 19:53:25 +00:00
Kaelyn Takata 0a2e84c41a Properly implement warn_unused_result checking for classes/structs.
The previous implementation would copy the attribute from the class to
functions that have the class as their return type when the functions
are first declared. This proved to have two flaws:
  1) if the class is forward-declared without the attribute and a
     function or method with the class as a its return type is declared,
     and afterward the class is defined with warn_unused_result, the
     function or method would never inherit the attribute, and
  2) the check simply failed for functions and methods that are part of
     a template instantiation, regardless of whether the class with
     warn_unused_result is part of a specific instantiation or part of
     the template itself (presumably because those function/method
     declaration does not hit the same code path as a non-template one
     and so never inherits the attribute).

The new approach is to instead modify the two places where a function or
method call is checked for the warn_unused_result attribute on the decl
by extending the checks to also look for the attribute on the decl's
return type.

Additionally, the check for return types that have the warn_unused_result
now excludes pointers and references to such types, as such return types do
not necessarily imply a transfer of ownership for the underlying object
being referred to by the return value. This does not change the behavior
of functions that are directly given the warn_unused_result attribute.

llvm-svn: 234526
2015-04-09 19:43:04 +00:00
Hans Wennborg 10821e5283 [ASan] Don't link against libc++abi when not using libc++
This is a follow-up to r233860 which added -lc++abi when using ASan
on Mac, and broke Chromium's ASan build which doesn't use libc++.

llvm-svn: 234521
2015-04-09 18:47:01 +00:00
Fariborz Jahanian f8e68e230b [Objective-C modern translation]. Patch to fix type of
objc_msgSend's first argument to "Class" because
objc_getClass is passed. rdar://20477025

llvm-svn: 234520
2015-04-09 18:36:50 +00:00
Olivier Sallenave 5a41f92f69 Added flag to disable isel instruction on PPC target. Using regular branches instead of isel is more efficient in some cases.
llvm-svn: 234509
2015-04-09 17:38:50 +00:00
Benjamin Kramer b2b81439a3 [CodeGen] When promoting a reference temporary to a global use the inner type to fold it.
The MaterializeTemporaryExpr can have a different type than the inner
expression, miscompiling the constant. PR23165.

llvm-svn: 234499
2015-04-09 16:09:29 +00:00
Sanjay Patel 359b105745 Process the -freciprocal-math optimization flag (PR20912)
The driver currently accepts but ignores the -freciprocal-math flag.
This patch passes the flag through and enables 'arcp' fast-math-flag
generation in IR.

Note that this change does not actually enable the optimization for
any target. The reassociation optimization that this flag specifies
was implemented by http://reviews.llvm.org/D6334 :
http://llvm.org/viewvc/llvm-project?view=revision&revision=222510

Because the optimization is done in the backend rather than IR,
the backend must be modified to understand instruction-level
fast-math-flags or a new function-level attribute must be created.

Also note that -freciprocal-math is independent of any target-specific
usage of reciprocal estimate hardware instructions. That requires
its own flag ('-mrecip').

https://llvm.org/bugs/show_bug.cgi?id=20912

llvm-svn: 234493
2015-04-09 15:03:23 +00:00
Javed Absar 879d18b843 [ARM] add support for Cortex-R4/R4F
Adds ARM Cortex-R4 and R4F support and tests in Clang. Though Cortex-R4
support was present, the support for hwdiv in thumb-mode was not defined
or tested properly. This has also been added.

llvm-svn: 234488
2015-04-09 14:12:10 +00:00
Hans Wennborg 7a2e5c260c clang-cl: Support the /fp options (PR23112)
This hooks up the /fp options as aliases for -f[no-]fast-math and
-f[no]-trapping-math. It probably doesn't match cl.exe's behaviour
completely (e.g. LLVM is currently never as precise as /fp:precise),
but it's close enough.

Differential revision: http://reviews.llvm.org/D8909

llvm-svn: 234449
2015-04-08 22:55:09 +00:00
Reid Kleckner e5b064205a [WinEH] Don't wrap cleanups in terminate actions
_CxxFrameHandler3 calls terminate if a cleanup action throws, regardless
of what bits you put in the xdata tables. There's no need to model this
in the IR, since we just have to take it out later.

llvm-svn: 234448
2015-04-08 22:48:50 +00:00
Reid Kleckner 31a1bb0c14 Reland "[SEH] Implement filter capturing in CodeGen"
The test should be fixed. It was failing in NDEBUG builds due to a
missing '*' character in a regex. In asserts builds, the pattern matched
a single digit value, which became a double digit value in NDEBUG
builds. Go figure.

This reverts commit r234261.

llvm-svn: 234447
2015-04-08 22:23:48 +00:00
Fariborz Jahanian 576ff12839 [Objective-C Sema] Use canonical type of properties when comparing
redeclaration of property in class extension and to avoid
bogus error. rdar://20469452

llvm-svn: 234440
2015-04-08 21:34:04 +00:00