Commit Graph

61247 Commits

Author SHA1 Message Date
Daniel Jasper 3fed94525c Fix calculation of shifted cursor/code positions. Specifically support
the case where a specific range is replaced by new text. Previously,
the calculation would shift any position from within a replaced region
to the first character after the region. This is undersirable, e.g. for
clang-format's include sorting.

llvm-svn: 253859
2015-11-23 08:33:48 +00:00
NAKAMURA Takumi 805e657584 OpenMPClause.h: Fix typos. [-Wdocumentation]
llvm-svn: 253854
2015-11-23 06:41:50 +00:00
Vedant Kumar 280001807b [Driver] Mark isForDiagnostics as const. NFC.
llvm-svn: 253853
2015-11-23 06:40:49 +00:00
Xinliang David Li a2124eebbd Revert r253846 (build bot failure))
llvm-svn: 253851
2015-11-23 05:41:05 +00:00
Kelvin Li 7010ed6be3 [OpenMP] Parsing and sema support for map clause - add test case
http://reviews.llvm.org/D14134 

llvm-svn: 253850
2015-11-23 05:36:37 +00:00
Kelvin Li 0bff7afab5 [OpenMP] Parsing and sema support for map clause
http://reviews.llvm.org/D14134 

llvm-svn: 253849
2015-11-23 05:32:03 +00:00
Xinliang David Li eadaf84e78 Disable frame pointer elimination when using -pg
This diff makes sure that the driver does not pass
-fomit-frame-pointer or -momit-leaf-frame-pointer to
the frontend when -pg is used. Currently, clang gives 
an error if -fomit-frame-pointer is used in combination 
with -pg, but -momit-leaf-frame-pointer was forgotten.
Also, disable frame pointer elimination in the frontend 
when -pg is set.

Patch by Stefan Kempf.

llvm-svn: 253846
2015-11-23 05:09:10 +00:00
David Majnemer 67528eaacf [MS ABI] Tolerate invokes of __RTDynamicCast
The pointer returned by __RTDynamicCast must be bitcasted.  However, it
was not expected that __RTDynamicCast would be invoked, resulting in the
bitcast occuring in a different BasicBlock than the invoke.  This caused
a down-stream PHI to get confused about which BasicBlock the incomming
value was from.

This fixes PR25606.

llvm-svn: 253843
2015-11-23 03:01:14 +00:00
Richard Smith 71d403effb [coroutines] Check for overload sets in co_yield / co_return operands being resolved by a call to yield_value / return_value before rejecting them.
llvm-svn: 253817
2015-11-22 07:33:28 +00:00
Richard Smith 4ba66602bd [coroutines] Build implicit return_value / return_void calls for co_return.
llvm-svn: 253816
2015-11-22 07:05:16 +00:00
Martell Malone 605cdb5c9c Test: Update mingw-useld.c to reflect r253813
llvm-svn: 253815
2015-11-22 05:45:03 +00:00
Martell Malone aac044e35c Driver: Specifically tell the linker the target for mingw-w64
Cross compiling from linux and OSX results in Error: Exec format.
This is because the linker is expecting ELF formated objects.
By passing the target we can explicitly tell the linker that
it should be linking COFF objects regardless of the host.

llvm-svn: 253813
2015-11-22 05:40:06 +00:00
Richard Smith 1f38eddee0 [coroutines] Materialize the awaitable before generating the await_* calls.
llvm-svn: 253812
2015-11-22 03:13:02 +00:00
Richard Smith d7bed4d660 [coroutines] Factor out co_await representation into common base class for co_await and co_yield, and use it to hold await_* calls.
llvm-svn: 253811
2015-11-22 02:57:17 +00:00
Daniel Jasper 9b8c7c72f5 clang-format: Make sorting includes respect // clang-format off
llvm-svn: 253772
2015-11-21 09:17:08 +00:00
Matthias Braun 5961fef32e Let's try to fix this test again with a fixed target triple
llvm-svn: 253760
2015-11-21 02:28:42 +00:00
Matthias Braun 84055ecb7d Fix c-unicode.c testcase again.
Specifying a fixed triple is not possible because that target may not
even be compiler. Go for a simpler fix by using a _? regex for the
prefix.

llvm-svn: 253758
2015-11-21 02:13:29 +00:00
Matthias Braun 5c3fccc313 Fix testcase when building on darwin
Explicitely specify a target to avoid "_" prefixes on the names.

llvm-svn: 253741
2015-11-21 00:56:41 +00:00
Vinicius Tinti 92e68c2766 [clang] Disable Unicode in asm files
Clang should not convert tokens to Unicode when preprocessing assembly
files.

Fixes PR25558.

llvm-svn: 253738
2015-11-20 23:42:39 +00:00
Richard Smith 10610f7f2f [coroutines] Better handling of placeholder types.
llvm-svn: 253731
2015-11-20 22:57:24 +00:00
Richard Smith ae3d147c91 [coroutines] Support braced-init-list as operand of co_yield expression.
llvm-svn: 253726
2015-11-20 22:47:10 +00:00
Richard Smith 23da82c5ea [coroutines] Synthesize yield_value call for co_yield.
llvm-svn: 253725
2015-11-20 22:40:06 +00:00
Chris Bieneman 8638714dc7 [CMake] Add support for specifying arguments to the bootstrap build.
This adds support for three types of argument specifications for bootstrap builds:

(1) Arguments prefixed with BOOTSTRAP_* will be passed through with the leading BOOTSTRAP_ removed.
(2) CLANG_BOOTSTRAP_PASSTHROUGH can specify a list of variables to be passed through as they are set.
(3) BOOTSTRAP_DEFAULT_PASSTHROUGH is a list of some default passthrough variables that are always passed through. Those variables include the version string and should only specify variables that are always expected to be the same between the stage1 and stage2

llvm-svn: 253721
2015-11-20 22:09:06 +00:00
Chris Bieneman 5b390b53c6 [CMake] Fix handling of passing through semi-colon separated lists.
When passing around CMake arguments as lists of arguments any arguments containing lists need to have their semi-colons escaped otherwise CMake will split the arguments in the middle.

llvm-svn: 253720
2015-11-20 22:09:03 +00:00
Peter Collingbourne 39719a77d1 Driver: Defer computation of linker path until it is needed.
This allows us to construct Linux toolchains without a valid linker. This
is needed for example to build a CUDA device toolchain after r253385.

llvm-svn: 253707
2015-11-20 20:49:39 +00:00
Bill Seurer 0d7f89d1ac Fix test case function name checks
This is similar to the earlier fix I did, r253702, expect that here it
is function names that are being searched for.  If the function name
matches part of the directory name it can cause an apparent test
case failure.

llvm-svn: 253706
2015-11-20 20:47:34 +00:00
Reid Kleckner 19ff5602da Thread Safety Analysis: Fix DenseMap iterator invalidation UAF
Rather than storing BeforeInfo in the DenseMap by value, this stores a
unique_ptr to it, so that we can keep a pointer to it live across
subsequent DenseMap insertions.

This change also removes the unique_ptr wrapper around BeforeVect
because now we're indirecting at a higher level.

llvm-svn: 253694
2015-11-20 19:08:30 +00:00
Chris Bieneman 0502e98c8a Honor system specific paths of MAN pages
Summary: Caught on NetBSD.

Patch by: Kamil Rytarowski (krytarowski)

Reviewers: beanz, jroelofs

Subscribers: cfe-commits, joerg

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

llvm-svn: 253693
2015-11-20 18:49:02 +00:00
Dehao Chen f735b8d10e Add -disable-llvm-passes for frontend debug info tests.
Summary: The frontend debuginfo tests should not invoke llvm passes which includes add-discriminators that will change the debug info generated by FE.

Reviewers: dblaikie

Subscribers: cfe-commits

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

llvm-svn: 253686
2015-11-20 18:29:01 +00:00
Reid Kleckner 43ecd7c71d [DebugInfo] Look through type sugar on union types when casting
Fixes PR25584.

llvm-svn: 253680
2015-11-20 17:41:12 +00:00
Hans Wennborg 543cb4c333 Revert r253582: "clang-cl: Make /W4 imply -Wall -Wextra (PR25563)"
The patch expanded the flag *at the end*, breaking invocations like:

  clang-cl /W4 -Wno-unused-parameter

Reverting for now.

llvm-svn: 253678
2015-11-20 16:51:56 +00:00
Artyom Skrobov 1311d29527 Handle ARMv6-J as an alias, instead of fake architecture
Summary: Clang-side update, corresponding to D14755

Reviewers: rengolin, bogden, compnerd

Subscribers: aemerson, rengolin, cfe-commits

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

llvm-svn: 253677
2015-11-20 16:47:05 +00:00
Daniel Jasper 71e574543f clang-format: [JS] Make AllowShortFunctionsOnASingle line value "Empty"
work properly.

llvm-svn: 253674
2015-11-20 16:44:28 +00:00
Daniel Jasper f95b1f4546 clang-format: [JS] Properly add a space after "in" in for loops.
llvm-svn: 253672
2015-11-20 16:18:42 +00:00
Daniel Jasper 09840efd92 clang-format: [JS] struct and union aren't keywords / reserved words.
llvm-svn: 253671
2015-11-20 15:58:50 +00:00
Daniel Jasper 7fa524b4b8 clang-format: Don't use incorrect space in macro calls with operators.
Before:
  MACRO(> );

After:
  MACRO(>);

Not overly important, but easy and good for symmetry reasons :-).

llvm-svn: 253669
2015-11-20 15:26:50 +00:00
Daniel Jasper d8d9839ae6 clang-format: [Proto] Support extending message.
Before:
  extend.foo.Bar {
  }

After:
  extend .foo.Bar {
  }

llvm-svn: 253667
2015-11-20 14:32:54 +00:00
Benjamin Kramer 7d0cc23786 Regenerate ASTMatchersReference without CRLF.
llvm-svn: 253654
2015-11-20 07:57:46 +00:00
Benjamin Kramer 611d33a5a2 Fix ASTMatcher reference newlines and make the generator script windows-proof.
llvm-svn: 253653
2015-11-20 07:46:19 +00:00
Alexey Bataev 3d42f340cd [MS] Fix for bug 25013 - #pragma vtordisp is unknown inside functions, by Denis Zobnin.
This patch adds support of #pragma vtordisp inside functions in attempt to improve compatibility. Microsoft compiler appears to save the stack of vtordisp modes on entry of struct methods' bodies and restore it on exit (method-local vtordisp).
Differential Revision: http://reviews.llvm.org/D14467

llvm-svn: 253650
2015-11-20 07:02:57 +00:00
Douglas Katzman 9dc4c62681 [Myriad]: handle Preprocess job action (-E)
llvm-svn: 253647
2015-11-20 04:58:12 +00:00
Argyrios Kyrtzidis a3e2ff19e5 [libclang] Make sure to use the raw module format for libclang parsing.
Fixes crash when passing '-gmodules' in the compiler options.
rdar://23588717

llvm-svn: 253645
2015-11-20 03:36:21 +00:00
Richard Smith 744b224bb5 [coroutines] Per latest wording paper, co_* are no longer permitted in any
unevaluated operands.

llvm-svn: 253641
2015-11-20 02:54:01 +00:00
Argyrios Kyrtzidis dcb5653516 [CMake] Add a specific 'install-clang-headers' target.
llvm-svn: 253636
2015-11-20 02:24:03 +00:00
Devin Coughlin c7315b3ebf [analyzer] DeadStoresChecker: Treat locals captured by reference in C++ lambdas as escaped.
The analyzer currently reports dead store false positives when a local variable
is captured by reference in a C++ lambda.

For example:

  int local = 0; auto lambda = [&local]() {
    local++;
  };
  local = 7; // False Positive: Value stored to 'local' is never read
  lambda();

In this case, the assignment setting `local` to 7 is not a dead store because
the called lambda will later read that assigned value.

This commit silences this source of false positives by treating locals captured
by reference in C++ lambdas as escaped, similarly to how the DeadStoresChecker
deals with locals whose address is taken.

rdar://problem/22165179

llvm-svn: 253630
2015-11-20 01:53:44 +00:00
Chris Bieneman 586d24bbf2 Support CMake's clang_rt.profile library naming scheme
Summary: This code is a bit undesirable, but it gets clang to work with the autoconf and cmake-built libclang_rt.profile libraries.

Reviewers: bogner

Subscribers: cfe-commits

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

llvm-svn: 253625
2015-11-20 00:19:21 +00:00
Tom Stellard d097e94abb AMDGPU: Add support for 's' and 'v' asm constraints
Summary: 's' is used to specify sgprs and 'v' is used to specify vgprs.

Reviewers: arsenm, echristo

Subscribers: cfe-commits

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

llvm-svn: 253610
2015-11-19 22:11:58 +00:00
Dehao Chen b85fc5c799 Update clang tests to accomendate discriminator changes.
Summary: The discriminator change in http://reviews.llvm.org/D14738 will fail these clang tests. Update the test to accomendate the discriminator change.

Reviewers: dblaikie, davidxl, dnovillo

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

llvm-svn: 253595
2015-11-19 19:53:16 +00:00
Faisal Vali 48401eb18a Change the expression evaluation context from Unevaluated to ConstantEvaluated while substituting into non-type template argument defaults.
Also address a typo from a prior patch that performed a similar fix during Parsing of default non-type template arguments.  I left the RAII ExpressionEvaluationContext variable Name as Unevaluated though we had switched the context to ConstantEvaluated.

There should be no functionality change here - since when expression evaluation context is popped off, for the most part these two contexts currently behave similarly in regards to lambda diagnostics and odr-use tracking.

Like its parsing counterpart, this patch presages the advent of constexpr lambda patches...

llvm-svn: 253590
2015-11-19 19:20:17 +00:00
Hans Wennborg 2763dc29a5 clang-cl: Make /W4 imply -Wall -Wextra (PR25563)
llvm-svn: 253582
2015-11-19 17:49:59 +00:00
NAKAMURA Takumi 8153a24a84 clangFrontend: [PR25565] Quick fix for dependencies on Attributes.inc.
FIXME: Attributes.inc may be an independent target.

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

llvm-svn: 253554
2015-11-19 10:59:48 +00:00
Alexey Bataev f278eb10b7 PR10235: support for vector mode attributes + warning, by Dmitry Polukhin.
Add support for vector mode attributes like "attribute((mode(V4SF)))". Also add warning about deprecated vector modes like GCC does.
Differential Revision: http://reviews.llvm.org/D14744

llvm-svn: 253551
2015-11-19 10:13:11 +00:00
Pete Cooper 3b39e88ae0 Revert "Change memcpy/memset/memmove to have dest and source alignments."
This reverts commit r253512.

This likely broke the bots in:
http://lab.llvm.org:8011/builders/clang-ppc64-elf-linux2/builds/20202
http://bb.pgr.jp/builders/clang-3stage-i686-linux/builds/3787

llvm-svn: 253542
2015-11-19 05:55:59 +00:00
Pete Cooper ccfcdc0d3a Revert "Fix debian build after r253512."
This reverts commit r253519.

This likely broke the bots in
http://lab.llvm.org:8011/builders/clang-ppc64-elf-linux2/builds/20202
http://bb.pgr.jp/builders/clang-3stage-i686-linux/builds/3787

llvm-svn: 253541
2015-11-19 05:55:44 +00:00
Richard Smith 9b2f53e39e [coroutines] Tweak diagnostics to always use fully-qualified name for std::coroutine_traits.
llvm-svn: 253535
2015-11-19 02:36:35 +00:00
John McCall 00b2bbb7bb Don't actually add the __unsafe_unretained qualifier in MRC;
driving a canonical difference between that and an unqualified
type is a really bad idea when both are valid.  Instead, remember
that it was there in a non-canonical way, then look for that in
the one place we really care about it: block captures.  The net
effect closely resembles the behavior of a decl attribute, except
still closely following ARC's standard qualifier parsing rules.

llvm-svn: 253534
2015-11-19 02:28:03 +00:00
John McCall d80218fa42 Fix the emission of ARC-style ivar layouts in the fragile runtime
to start at the offset of the first ivar instead of the rounded-up
end of the superclass.  The latter could include a large amount of
tail padding because of a highly-aligned ivar, and subclass ivars
can be laid out within that.

llvm-svn: 253533
2015-11-19 02:27:55 +00:00
Anna Zaks 61fcb521fa [analyzer] Improve modeling of static initializers.
Conversions between unrelated pointer types (e.g. char * and void *) involve
bitcasts which were not properly modeled in case of static initializers. The
patch fixes this problem.

The problem was originally spotted by Artem Dergachev. Patched by Yuri Gribov!

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

llvm-svn: 253532
2015-11-19 01:25:28 +00:00
David Majnemer 70effde0af [MS ABI] Let arbitrary entities participate in vftable ordering
In the Microsoft ABI, the vftable is laid out in the order in the
declaration order of the entities defined within it.

Obviously, only virtual methods end up in the vftable but they will be
placed into the table at the same position as the first entity with the
same name.

llvm-svn: 253523
2015-11-19 00:03:54 +00:00
Pete Cooper eb3bc60e62 Fix debian build after r253512.
The conversion from QuantityType to the (temporary) IntegerAlignment class
was ambiguous.

For now add in explicit conversion to unsigned to satisfy the clang-x86_64-debian-fast bot.

I'll remove the explicit conversion when I remove the IntegerAlignment class.

llvm-svn: 253519
2015-11-18 22:53:40 +00:00
Devin Coughlin 6e644abd46 [analyzer] Skip checking blocks in dependent contexts.
Since we don't check functions in dependent contexts, we should skip blocks
in those contexts as well. This avoids an assertion failure when the
DeadStoresChecker attempts to evaluate an array subscript expression with
a dependent name type.

rdar://problem/23564220

llvm-svn: 253516
2015-11-18 22:46:52 +00:00
Pete Cooper 7bfd5cb7be Change memcpy/memset/memmove to have dest and source alignments.
This is a follow on from a similar LLVM commit: r253511.

Note, this was reviewed (and more details are in) http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html

These intrinsics currently have an explicit alignment argument which is
required to be a constant integer.  It represents the alignment of the
source and dest, and so must be the minimum of those.

This change allows source and dest to each have their own alignments
by using the alignment attribute on their arguments.  The alignment
argument itself is removed.

The only code change to clang is hidden in CGBuilder.h which now passes
both dest and source alignment to IRBuilder, instead of taking the minimum of
dest and source alignments.

Reviewed by Hal Finkel.

llvm-svn: 253512
2015-11-18 22:18:45 +00:00
David Majnemer bee2bc3932 [MSVC Compat] Make -Wmicrosoft-cast not an error by default
Too much code is sloppy about this to error by default.

llvm-svn: 253506
2015-11-18 21:42:38 +00:00
David Majnemer 678f50b622 [Sema] Don't work around a malformed AST
We created a malformed TemplateSpecializationType: it was dependent but
had a RecordType as it's canonical type.  This would lead getAs to
crash.  r249090 worked around this but we should fix this for real by
providing a more appropriate template specialization type as the
canonical type.

This fixes PR24246.

llvm-svn: 253495
2015-11-18 19:49:19 +00:00
Aaron Ballman f08e184815 Removing the AST matcher test for thread_local storage duration. Not all platforms support TLS, and on platforms that do not support it, use of thread_local causes an error. Since there's no way to determine whether the testing platform supports TLS, there's no way to know whether the test is safe to run or not. I will explore ways to enable this test, but this will appease at least one more build bot.
llvm-svn: 253486
2015-11-18 18:37:29 +00:00
Betul Buyukkurt 6247bed9bd [PGO] Test update for revision 253484.
llvm-svn: 253485
2015-11-18 18:15:55 +00:00
Aaron Ballman 8e7f00b0eb Re-committing r253473 after hopefully fixing the bot breakage. There was a copy-pasta issue that my local testing did not catch.
llvm-svn: 253481
2015-11-18 17:56:55 +00:00
Douglas Katzman d617e44065 [Myriad]: fix test for Windows
llvm-svn: 253476
2015-11-18 17:19:47 +00:00
Aaron Ballman 81d17f2f7e Reverting r253473 while I investigate build bot failures.
llvm-svn: 253475
2015-11-18 17:16:01 +00:00
Aaron Ballman 34e0bd40e4 Adding AST matchers for VarDecl storage durations. Can now determine whether a VarDecl has automatic, static, or thread storage duration. This also updates the documentation for matchers, which appear to be missing some previous additions.
llvm-svn: 253473
2015-11-18 17:05:39 +00:00
Bradley Smith bbf5a00de1 [ARM] Support +feature targeting in -mcpu/-march
llvm-svn: 253471
2015-11-18 16:33:48 +00:00
Douglas Katzman 674a31243b [Myriad]: insert -L paths into linker cmd only when they exist.
Differential Revision: http://reviews.llvm.org/D14754

llvm-svn: 253467
2015-11-18 16:24:46 +00:00
Benjamin Kramer c02670ed50 [libclang] Add entry points that take a full command line including argv[0].
This provides both a more uniform interface and makes libclang behave like
clang tooling wrt relative paths against argv[0]. This is necessary for
finding paths to a c++ standard library relative to a clang binary given
in a compilation database. It can also be used to find paths relative to
libclang.so if the full path to it is passed in.

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

llvm-svn: 253466
2015-11-18 16:14:27 +00:00
Igor Laevsky 27e67986af Fix tests in order for them to not fail after r252604.
Some expected attributes appear to be incorrect after 
optimizations are run and llvm will strip them. Use -O0
so that llvm will not have a chance to remove them. 

llvm-svn: 253458
2015-11-18 14:40:41 +00:00
Eugene Leviant 0d8103e975 Set flag for lldb when qualified name lookup is being done
llvm-svn: 253456
2015-11-18 12:48:05 +00:00
Rafael Espindola cd67662ad9 Update for llvm change.
llvm-svn: 253440
2015-11-18 06:54:13 +00:00
NAKAMURA Takumi 64705c8e7b BuildUniversalActions(): Prune obsolete \param(s). [-Wdocumentation]
FIXME: Describe BAInputs.
llvm-svn: 253434
2015-11-18 05:15:21 +00:00
Faisal Vali 0374bf0d07 [NFC] Change the evaluation context of a non-type default template argument from Unevaluated to ConstantEvaluated.
This patch emits a more appropriate (but still noisy) diagnostic stream when a lambda-expression is encountered within a non-type default argument. 

For e.g. template<int N = ([] { return 5; }())> int f();

As opposed to complaining that a lambda expression is not allowed in an unevaluated operand, the patch complains about the lambda being forbidden in a constant expression context (which will be allowed in C++17 now that they have been accepted by EWG, unless of course CWG or national bodies (that have so far shown no signs of concern) rise in protest) 

As I start submitting patches for constexpr lambdas (http://wg21.link/P0170R0) under C++1z (OK'd by Richard Smith at Kona), this will be one less change to make.

Thanks!

llvm-svn: 253431
2015-11-18 04:29:22 +00:00
Richard Smith 2a40fb78c0 Don't expose iterators into the list of types on the ASTContext; these are
unsafe, since many operations on the types can trigger lazy deserialization of
more types and invalidate the iterators. This fixes a crasher, but I've not
been able to reduce it to a reasonable testcase yet.

llvm-svn: 253420
2015-11-18 01:19:02 +00:00
Reid Kleckner 356be39f65 Try to fix leak in CXStringSet from r252853
llvm-svn: 253418
2015-11-18 01:06:39 +00:00
Artem Belevich 6e50375286 Fix for use-after-free which caused test failure in cuda-detect.cu.
Return std::string itself instead StringRef to a temporary std::string.

llvm-svn: 253410
2015-11-18 00:37:41 +00:00
Akira Hatanaka 8c26ea663d Produce a better diagnostic for global register variables.
Currently, when there is a global register variable in a program that
is bound to an invalid register, clang/llvm prints an error message that
is not very user-friendly.

This commit improves the diagnostic and moves the check that used to be
in the backend to Sema. In addition, it makes changes to error out if
the size of the register doesn't match the declared variable size.

e.g., volatile register int B asm ("rbp");

rdar://problem/23084219

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

llvm-svn: 253405
2015-11-18 00:15:28 +00:00
Betul Buyukkurt cbf0b5e4b6 [PGO] Removed unused code. [NFC]
llvm-svn: 253404
2015-11-18 00:14:08 +00:00
Richard Smith 752ada870d [modules] When a #include is mapped to a module import and appears somewhere
other than the top level, we issue an error. This breaks a fair amount of C++
code wrapping C libraries, where the C library is #included within a namespace
/ extern "C" combination, because the C library (probably) includes C++
standard library headers which may be within modules.

Without modules, this setup is harmless if (and *only* if) the corresponding
standard library module was already included outside the namespace, so
downgrade the error to a default-error extension in that case, so that it can
be selectively disabled for such misbehaving libraries.

llvm-svn: 253398
2015-11-17 23:32:01 +00:00
Douglas Katzman 9d40374880 [Myriad]: -nostdlib implies -nostartfiles
llvm-svn: 253390
2015-11-17 22:33:34 +00:00
Artem Belevich 8601733c1c [CUDA] Make CUDA compilation usable by default.
Currently clang requires several additional command
line options in order to enable new features needed
during CUDA compilation. This patch makes these
options default.

* Automatically include cuda_runtime.h if we've found
  a valid CUDA installation.
* Disable automatic CUDA header inclusion during unit tests.
* Added test case for command line construction.
* Enabled target overloads and relaxed call checks that are
  needed in order to include CUDA headers.
* Added CUDA-7.5 installation path to the CUDA installation search list.
* Define __CUDA__ macro to indicate CUDA compilation.

llvm-svn: 253389
2015-11-17 22:28:55 +00:00
Artem Belevich c29db84419 [CUDA] Added a wrapper header for inclusion of stock CUDA headers.
Header files that come with CUDA are assuming split host/device
compilation and are not usable by clang out of the box.
With a bit of preprocessor magic it's possible to twist them
into something clang can use.

This wrapper always includes CUDA headers exactly the same way during
host and device compilation passes and produces identical preprocessed
content during host and device side compilation for sm_35 GPUs. Device
compilation passes for older GPUs will see a smaller subset of device
functions supported by particular GPU.

The wrapper assumes specific contents of CUDA header files and works
only with CUDA 7.0 and 7.5.

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

llvm-svn: 253388
2015-11-17 22:28:52 +00:00
Artem Belevich 34f481acc6 [CUDA] Detect and link with CUDA's libdevice bitcode library.
- added detection of libdevice bitcode file and API to find one appropriate for the GPU we're compiling for.
- pass additional cc1 options for linking with detected libdevice bitcode
- added -nocudalib to prevent automatic linking with libdevice
- added test cases to verify new functionality

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

llvm-svn: 253387
2015-11-17 22:28:50 +00:00
Artem Belevich fa11ab53c0 [CUDA] added include paths for both sides of CUDA compilation.
In order to compile a CUDA file clang must be able to find
include files for both both host and device.

This patch passes AuxToolchain to AddPreprocessingOptions and
uses it to add include paths for the opposite side of compilation.

We also must be able to find CUDA include files. If the driver
found CUDA installation, it adds appropriate include path
to CUDA headers. This can be disabled with '-nocudainc'.

- Added include paths for the opposite side of compilation.
- Added include paths to detected CUDA installation.
- Added -nocudainc to prevent adding CUDA include path.
- Added test cases to verify new functionality.

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

llvm-svn: 253386
2015-11-17 22:28:46 +00:00
Artem Belevich 5e2a3ecd48 [CUDA] use -aux-triple to pass target triple of opposite side of compilation
Clang needs to know target triple for both sides of compilation so that
preprocessor macros and target builtins from both sides are available.

This change augments Compilation class to carry information about
toolchains used during different CUDA compilation passes and refactors
BuildActions to use it when it constructs CUDA jobs.

Removed DeviceTriple from CudaHostAction/CudaDeviceAction as it's no
longer needed.

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

llvm-svn: 253385
2015-11-17 22:28:40 +00:00
Douglas Katzman 78b37b0555 Use !hasArg with two options instead of !hasArg && !hasArg.
Thereby fixing a warning about failure to claim all args.

llvm-svn: 253372
2015-11-17 20:28:07 +00:00
Charles Li e7cbb3ed4f [Lit Test] Updated 34 Lit tests to be C++11 compatible.
Added expected diagnostics new to C++11.
Expanded RUN line to: default, C++98/03 and C++11.

llvm-svn: 253371
2015-11-17 20:25:05 +00:00
Hans Wennborg 1acf955a6a bmiintrin.h: Allow using the tzcnt intrinsics for non-BMI targets
The tzcnt intrinsics are used non non-BMI targets by code (e.g. ffmpeg)
that uses it as a potentially faster BSF.

The TZCNT instruction is special in that it's encoded in a
backward-compatible way and behaves as BSF on non-BMI targets.

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

llvm-svn: 253358
2015-11-17 18:46:48 +00:00
Tim Northover c741b04d1e ARM: fix mismatch between Clang and backend on exception type.
"-arch armv7k" is only normally used with a watchos target, but Clang doesn't
stop you from giving a "-miphoneos-version-min" option too, converting the
triple to "thumbv7k-apple-ios". In this case the backend will decide to use
SjLj exceptions, so Clang needs to agree so it can create the correct
predefines.

Fortunately, there's a handy function to make the decision for us now.

llvm-svn: 253355
2015-11-17 18:27:27 +00:00
Douglas Katzman 6059ef98d9 Add trivial utility to append -L arguments to linker step. NFC
llvm-svn: 253350
2015-11-17 17:41:23 +00:00
Manuel Klimek ff39366de5 Revert "Make FP_CONTRACT ON the default."
This reverts commit r253269.

This leads to assert / segfault triggering on the following reduced example:
float foo(float U, float base, float cell) { return (U = 2 * base) - cell; }

llvm-svn: 253337
2015-11-17 15:40:10 +00:00
Craig Topper e39fa490f9 [Sema] Remove unnecessary typecast of bool to int when passing arguments to diagnostics. NFC
llvm-svn: 253316
2015-11-17 05:40:12 +00:00
Craig Topper da7b27ff0b [Sema] Combine similar diagnostics using %select. NFC
llvm-svn: 253315
2015-11-17 05:40:09 +00:00
Craig Topper 8f7f3ea658 [Sema] Minor formatting fixes. NFC
llvm-svn: 253314
2015-11-17 05:40:05 +00:00
Richard Smith 10568d8c1c [modules] Fix some more cases where we used to reject a conflict between two
declarations that are not simultaneously visible, and where at least one of
them has internal/no linkage.

llvm-svn: 253283
2015-11-17 03:02:41 +00:00
Stephen Canon 916be92955 Make FP_CONTRACT ON the default.
Differential Revision: D14200

llvm-svn: 253269
2015-11-16 23:09:11 +00:00
Derek Schuff 821d884383 Derive nacltools::Linker from GnuTool to get response file support
It could be derived from gnutools::Linker directly but this way makes it
consistent with all the other toolchains around it.

llvm-svn: 253259
2015-11-16 22:21:25 +00:00
John McCall 0204e342ca Correctly handle type mismatches in the __weak copy/move-initialization
peephole I added in r250916.

rdar://23559789

llvm-svn: 253255
2015-11-16 22:11:41 +00:00
Eric Christopher b7bbc53314 When producing error messages for always_inline functions with the
target attribute, don't include "negative" subtarget features in the
list of required features. Builtins are positive by default so don't
need this change, but we pull the default list of features from the
command line and so need to make sure that we only include features
that are turned on for code generation in our error.

llvm-svn: 253242
2015-11-16 18:29:59 +00:00
Vasileios Kalintiris bbc9930a34 [mips] Do not add arch name in the compiler-rt's components.
Instead, use the constant "mips" since the libraries are already
placed under the multilib's OS suffix.

llvm-svn: 253214
2015-11-16 15:41:30 +00:00
Douglas Katzman 642e5f9fea [Myriad]: pass the 'std=' option to moviCompile
llvm-svn: 253213
2015-11-16 15:38:40 +00:00
Oliver Stannard 7aa90f5735 [ARM,AArch64] Fix __rev16l and __rev16ll intrinsics
These two intrinsics are defined in arm_acle.h.

__rev16l needs to rotate by 16 bits, bit it was actually rotating by 2 bits.
For AArch64, where long is 64 bits, this would still be wrong.

__rev16ll was incorrect, it reversed the bytes in each 32-bit word, rather than
each 16-bit halfword. The correct implementation is to apply __rev16 to the top
and bottom words of the 64-bit value.

For AArch32 targets, these get compiled down to the hardware rev16 instruction
at -O1 and above. For AArch64 targets, the 64-bit ones get compiled to two
32-bit rev16 instructions, because there is not currently a pattern for the
64-bit rev16 instruction.

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

llvm-svn: 253211
2015-11-16 14:58:50 +00:00
Artyom Skrobov afb3cb154b Handle ARMv6KZ naming
Summary: Update for clang tests for D14568

Reviewers: rengolin, joerg, bogden

Subscribers: aemerson, rengolin, cfe-commits

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

llvm-svn: 253207
2015-11-16 14:05:48 +00:00
Daniel Jasper da44677082 clang-format: Enable #include sorting by default.
This has seen quite some usage and I am not aware of any issues. Also
add a style option to enable/disable include sorting. The existing
command line flag can from now on be used to override whatever is set
in the style.

llvm-svn: 253202
2015-11-16 12:38:56 +00:00
Bradley Smith b350196d77 [ARM] Pass in the architecture to TargetParser to cope with API change
The TargetParser API to get the default FPU and default extensions has
changed so that it can fall back to the architecture in case of a
generic CPU.

llvm-svn: 253199
2015-11-16 11:16:36 +00:00
Rafael Espindola 156aac0bb6 Update for the gnu flavor being renamed to old-gnu.
llvm-svn: 253191
2015-11-16 09:12:12 +00:00
Keno Fischer 87842f3b4e [CGDebugInfo] Set the size and align for reference types
In r253186, I changed the DIBuilder API to now take size and align
for reference types as well. This was done in preparation for upcoming
changes to the Verifier that will validate that sizes match between
DI types and IR values that are declared as having those types.
This updates clang to actually pass the information through.

llvm-svn: 253190
2015-11-16 09:04:13 +00:00
David Majnemer 213bea3361 [Sema] Implement several unary type traits more accurately
is_empty, is_polymorphic, and is_abstract didn't handle incomplete types
correctly.  Only non-union class types must be complete for these
traits.

is_final and is_sealed don't care about the particular spelling of the
FinalAttr.

is_interface_class should always return false regardless of its input.
The type trait can only be satisfied in a mode we do not support (/CLR).

llvm-svn: 253184
2015-11-16 06:58:51 +00:00
Vedant Kumar 678125d7ec [Basic] Replace vector<bool> with BitVector in SourceManager. NFC.
llvm-svn: 253181
2015-11-16 04:39:22 +00:00
Vedant Kumar 5b60ad68ce [Frontend] Rangify for loop. NFC.
llvm-svn: 253178
2015-11-16 00:59:34 +00:00
Vedant Kumar a52fa8efe6 [Basic] Use a bitfield in SLocEntry for clarity. NFC.
llvm-svn: 253177
2015-11-16 00:11:58 +00:00
Devin Coughlin 1d4058322d [analyzer] Handle calling ObjC super method from inside C++ lambda.
When calling a ObjC method on super from inside a C++ lambda, look at the
captures to find "self". This mirrors how the analyzer handles calling super in
an ObjC block and fixes an assertion failure.

rdar://problem/23550077

llvm-svn: 253176
2015-11-15 17:48:22 +00:00
Craig Topper 1212626041 [Sema] Use getLangOpts in Sema instead of Preprocessor. Call getTargetInfo on the AST context instead of Preprocessor. NFC
llvm-svn: 253175
2015-11-15 17:27:57 +00:00
Craig Topper 56e51be796 [Sema] Fix filename in header. NFC
llvm-svn: 253174
2015-11-15 17:27:55 +00:00
Craig Topper 177f6b9758 [Sema] Remove unnecessary includes and forward declarations. NFC
llvm-svn: 253173
2015-11-15 17:27:52 +00:00
Simon Pilgrim 7b8f926465 [X86][MMX] Added MMX IR + assembly codegen builtin tests for some missing cvt intrinsics
llvm-svn: 253169
2015-11-15 14:40:31 +00:00
Sergey Kalinichev 8f3b187e21 [libclang] Visit TypeAliasTemplateDecl
This makes TypeAliasTemplateDecl accessible via LibClang and python bindings

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

llvm-svn: 253166
2015-11-15 13:48:32 +00:00
Sergey Kalinichev c015120b53 [libclang] Expose AutoType
Expose the AutoType via LibClang and python bindings

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

llvm-svn: 253165
2015-11-15 13:10:10 +00:00
Sergey Kalinichev 43ed98b9dd Remove some trailing whitespace
llvm-svn: 253164
2015-11-15 12:37:01 +00:00
Yaron Keren a7fa79fb9b Make the mingw toolchain accept 'ld' and 'lld' only as values to -fuse-ld.
Post-commit suggestion by Filipe Cabecinhas.

llvm-svn: 253161
2015-11-15 08:06:27 +00:00
Craig Topper 2512241b31 Fix a layering oddity by passing Sema to DeclSpec::Finish instead of DiagnosticsEngine and Preprocessor. Everything the preprocessor was being used for can be acquired from Sema.
llvm-svn: 253158
2015-11-15 03:32:11 +00:00
Devin Coughlin e69b043088 [analyzer] Refer to capture field to determine if capture is reference.
The analyzer incorrectly treats captures as references if either the original
captured variable is a reference or the variable is captured by reference.
This causes the analyzer to crash when capturing a reference type by copy
(PR24914). Fix this by refering solely to the capture field to determine when a
DeclRefExpr for a lambda capture should be treated as a reference type.

https://llvm.org/bugs/show_bug.cgi?id=24914
rdar://problem/23524412

llvm-svn: 253157
2015-11-15 03:07:17 +00:00
David Majnemer 7f77eb90a5 [Sema] Don't crash trying to diagnose abs called on a pointer type
Clang tries to figure out if a call to abs is suspicious by looking
through implicit casts to look at the underlying, implicitly converted
type.
Interestingly, C has implicit conversions from pointer-ish types like
function to less exciting types like int.  This trips up our 'abs'
checker because it doesn't know which variant of 'abs' is appropriate.

Instead, diagnose 'abs' called on function types upfront.  This sort of
thing is highly suspicious and is likely indicative of a missing
pointer dereference/function call/array index operation.

This fixes PR25532.

llvm-svn: 253156
2015-11-15 03:04:34 +00:00
Craig Topper 07fa176669 Use Sema::getLocForEndOfToken instead of Preprocessor::getLocForEndOfToken. NFC
llvm-svn: 253155
2015-11-15 02:31:46 +00:00
Dan Gohman ce70b42bce [WebAssembly] Remove the "const" attribute from __builtin_wasm_memory_size.
llvm-svn: 253146
2015-11-14 22:57:34 +00:00
Craig Topper abb83aed5c Move diagnostics from Parse to Sema to remove Sema's dependency on ParserDiagnostic.h diagnostics.
llvm-svn: 253143
2015-11-14 19:31:56 +00:00
Craig Topper 7d2f94319f Fix indentation. NFC
llvm-svn: 253142
2015-11-14 19:31:52 +00:00
Craig Topper 54a6a68c70 Merge some similar diagnostics using %select.
llvm-svn: 253136
2015-11-14 18:16:08 +00:00
Craig Topper 3110a5cb93 Minor formatting fixes. NFC
llvm-svn: 253135
2015-11-14 18:16:02 +00:00
Craig Topper ff35428593 Fix 80 column violation. NFC.
llvm-svn: 253134
2015-11-14 18:16:00 +00:00
Craig Topper 3f13d4d20d Fix spelling error in comment.
llvm-svn: 253133
2015-11-14 18:15:55 +00:00
Simon Pilgrim 54cf98eeb2 [X86][MMX] Sorted MMX IR + assembly codegen builtin tests
Makes it easier to track what tests are missing....

llvm-svn: 253131
2015-11-14 13:25:06 +00:00
Simon Pilgrim 087b6a7216 [X86][MMX] Added MMX IR + assembly codegen builtin tests
Improved tests as discussed in PR24580

llvm-svn: 253130
2015-11-14 12:47:44 +00:00
David Majnemer 55cf252d75 Mark is_destructible/is_nothrow_destructible as implemented
These were implemented back in r244564.  However, I forgot to update the
docs.

llvm-svn: 253128
2015-11-14 07:21:35 +00:00
Ben Langmuir 90717ad731 [modules] Allow "redefinition" of typedef of anon tag from unimported submodule
r233345 started being stricter about typedef names for linkage purposes
in non-visible modules, but broke languages without the ODR.

rdar://23527954

llvm-svn: 253123
2015-11-14 03:26:14 +00:00
Eric Christopher ce83677666 Add support for the always_inline + target feature diagnostic to print
out the first missing target feature that's required and reword
the diagnostic accordingly.

llvm-svn: 253121
2015-11-14 02:38:37 +00:00
Craig Topper 7f5ff2175f Use %select to merge similar diagnostics. NFC
llvm-svn: 253119
2015-11-14 02:09:55 +00:00
Eric Christopher 39db726093 Clarify and elaborate the conditions on which we're checking target
features for calls.

llvm-svn: 253117
2015-11-14 01:56:04 +00:00
David Blaikie 6267684a18 Make some tests LLVM-optimization agnostic and remove some others that were beyond value/repair
Several of these tests (the two deleted, and the one removal edit) were
relying on the optimizer to collapse things to test some frontend
feature. The tests were really old and features seemed amply covered by
other parts of the test suite, so I just removed them.

If anyone thinks they're valuable enough to keep/fix, we can play around
with that, for sure.

(inspired by r252872)

llvm-svn: 253114
2015-11-14 01:10:38 +00:00
Matthias Gehre 09a134eca3 CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt
Summary:
VisitReturnStmt would create a new block with including Dtors, so the Dtors created
in VisitCompoundStmts would be in an unreachable block.

Example:

struct S {
  ~S();
};

void f()
{
  S s;
  return;
}

void g()
{
  S s;
}

Before this patch, f has one additional unreachable block containing just the
destructor of S. With this patch, both f and g have the same blocks.

Reviewers: krememek

Subscribers: cfe-commits

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

llvm-svn: 253107
2015-11-14 00:36:50 +00:00
Justin Bogner f905256386 Revert "[AArch64] Unconditionally pass subtarget feature reserve-x18 on Darwin."
This reverts r243310, which is redundant as of r253102.

Conflicts:
	lib/Driver/Tools.cpp

llvm-svn: 253104
2015-11-13 23:07:31 +00:00
Argyrios Kyrtzidis f10158c025 [CMake] Don't install c-index-test when LLVM_INSTALL_TOOLCHAIN_ONLY=ON.
llvm-svn: 253099
2015-11-13 22:41:14 +00:00
Jonathan Roelofs 534c4eec48 Fix build... again
llvm-svn: 253081
2015-11-13 21:04:14 +00:00
Jonathan Roelofs 814aa25a92 [scan-build] Make scan-build work whether it's installed or not
llvm-svn: 253074
2015-11-13 20:34:15 +00:00
Yaron Keren 273f9560c9 Relax mingw-useld test to fix bot failures.
llvm-svn: 253069
2015-11-13 20:02:08 +00:00