Commit Graph

65880 Commits

Author SHA1 Message Date
Richard Smith eb7ef2e1ca Re-commit r284753, reverted in r284778, with a fix for PR30749.
Original commit message:

[c++1z] Teach composite pointer type computation how to compute the composite
pointer type of two function pointers with different noexcept specifications.
While I'm here, also teach it how to merge dynamic exception specifications.

llvm-svn: 284785
2016-10-20 21:53:09 +00:00
Alexander Shaposhnikov 476cbf901b [clang] Remove FileEntry copy-constructor
Code cleanup: address FIXME in the file
include/clang/Basic/FileManager.h and remove 
copy-constructor of the class FileEntry.

Test plan: make check-clang

Differential revision: https://reviews.llvm.org/D22712

llvm-svn: 284782
2016-10-20 21:20:35 +00:00
Reid Kleckner afd7b69658 Revert "Disable swiftcall test on windows: More brutal way to appease windows bots"
This reverts commit r284174. The tests pass for me locally. It must have
been a 2015 only crash.

Fixes PR30699

llvm-svn: 284781
2016-10-20 21:17:28 +00:00
Hans Wennborg 2b81f42a76 Revert r284753 "[c++1z] Teach composite pointer type computation how to compute the composite"
It caused PR30749.

llvm-svn: 284778
2016-10-20 20:54:32 +00:00
Reid Kleckner ae818501b7 Fix off-by-one error in PPCaching.cpp token annotation assertion
This assert is intended to defend against backtracking into the middle
of a sequence of tokens that is being replaced with an annotation, but
it's OK if we backtrack to the exact position of the start of the
annotation sequence. Use a <= comparison instead of <.

Fixes PR25946

llvm-svn: 284777
2016-10-20 20:53:20 +00:00
Michal Gorny 16f37c30a3 [Driver] Refactor DetectDistro() parameters to take VFS ref only. NFC
Refactor the DetectDistro() function to take a single vfs::FileSystem
reference only, instead of Driver and llvm::Triple::ArchType.
The ArchType parameter was not used anyway, and Driver was only used to
obtain the VFS.

Aside to making the API simpler and more transparent, it makes it
easier to add unit tests for the function in the future -- since
the tests would need only to provide an appropriate VFS.

Differential Revision: https://reviews.llvm.org/D25819

llvm-svn: 284774
2016-10-20 20:45:40 +00:00
Michal Gorny 0a2cd96e05 [Driver] Parse Debian version as integer when possible. NFC
Replace the string matching for /etc/debian_version with split
integer/string matching algorithm. When the file contains 'major.minor'
version number, parse the major version as integer and use a switch
clause to match it. Otherwise, attempt 'codename/sid' matching using
a StringSwitch.

Differential Revision: https://reviews.llvm.org/D25696

llvm-svn: 284770
2016-10-20 20:13:35 +00:00
Vedant Kumar 2d38ae6c41 [CodeGen] Devirtualize calls to methods marked final in a derived class
If we see a virtual method call to Base::foo() but can infer that the
object is an instance of Derived, and that 'foo' is marked 'final' in
Derived, we can devirtualize the call to Derived::foo().

Differential Revision: https://reviews.llvm.org/D25813

llvm-svn: 284766
2016-10-20 18:44:14 +00:00
Richard Smith f70a906a11 [c++1z] Fix assertion failure when using the wrong number of bindings for a
struct with unnamed bitfields.

llvm-svn: 284761
2016-10-20 18:29:25 +00:00
Ekaterina Romanova 493091fdef Add more doxygen comments to emmintrin.h's intrinsics.
With this patch, 75% of the intrinsics in this file will be documented now. The patches for the rest of the intrisics in this file will be send out later.

The doxygen comments are automatically generated based on Sony's intrinsics document.

I got an OK from Eric Christopher to commit doxygen comments without prior code review upstream. This patch was internally reviewed by Yunzhong Gao.

llvm-svn: 284754
2016-10-20 17:59:15 +00:00
Richard Smith 9c37e66c31 [c++1z] Teach composite pointer type computation how to compute the composite
pointer type of two function pointers with different noexcept specifications.
While I'm here, also teach it how to merge dynamic exception specifications.

llvm-svn: 284753
2016-10-20 17:57:33 +00:00
Renato Golin f46be19104 [clang-cl] Fix test that shouldn't be running on non-x86
The clang-cl test required x86-registered-target but it defaulted to the
host's triple and AArch64 still doesn't support COFF, so the test failed.

The triple was "aarch64-pc-windows-msvc18.0.0" with ObjectFormat equals
llvm::Triple::COFF, failing assertion:

Assertion `(TT.isOSBinFormatELF() || TT.isOSBinFormatMachO()) &&
          "Only expect Darwin and ELF targets"

in AArch64MCTargetDesc.cpp:78.

Making the test only run on Windows hosts obviously fixes the problem.

llvm-svn: 284749
2016-10-20 17:41:08 +00:00
Malcolm Parsons 5d8cdb83db [Format] Cleanup after replacing constructor body with = default
Summary:
Remove colon and commas after replacing constructor body with = default.
Fix annotation of TT_CtorInitializerColon when preceded by a comment.

Reviewers: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D25768

llvm-svn: 284732
2016-10-20 14:58:45 +00:00
Benjamin Kramer c3f89253ae Retire llvm::alignOf in favor of C++11 alignof.
No functionality change intended.

llvm-svn: 284730
2016-10-20 14:27:22 +00:00
Benjamin Kramer e9f132d3f4 Clean up alignment hacks now that MSVC 2013 and GCC 4.7 are gone.
llvm-svn: 284729
2016-10-20 13:52:26 +00:00
Richard Smith e38da03f58 Work around MSVC rejects-valid. Apparenty (some versions of) MSVC will check
that a member is default-initializable even if it's initialized by a default
member initializer.

llvm-svn: 284701
2016-10-20 07:53:17 +00:00
Erik Pilkington 53937db801 Replace uses of LLVM_FUNCTION_NAME with __func__, this was macro was removed from llvm/Support in r284681
llvm-svn: 284690
2016-10-20 02:46:22 +00:00
Richard Smith 6ffdb1f3ed Refactor and simplify Sema::FindCompositePointerType. No functionality change intended.
llvm-svn: 284685
2016-10-20 01:20:00 +00:00
Richard Smith 6609443f2f PR26276: Fix detection of non-cast-expressions as operands of fold-expressions.
llvm-svn: 284684
2016-10-20 00:55:15 +00:00
Victor Leschuk 11eabd4cde Upgrade debug-info-vla test: we do not pass default alignment now
llvm-svn: 284683
2016-10-20 00:37:07 +00:00
Victor Leschuk a7ece03b32 DebugInfo: pass alignment value only if it was forced
Preparation to implement DW_AT_alignment support:
 - We pass non-zero align value to DIBuilder only when alignment was forced
 - Modify tests to match this change

Differential Revision: https://reviews.llvm.org/D24426

llvm-svn: 284679
2016-10-20 00:13:19 +00:00
Richard Smith 6f42740707 Fix crash on noreturn conversion in unprototyped function type. Thanks to Keith
Walker for spotting the bug.

llvm-svn: 284673
2016-10-20 00:01:36 +00:00
Richard Smith 628954652f Extend hack to work around bad exception specifications for 'swap' members to
also cover libstdc++'s std::__debug::array and std::__profile::array.

llvm-svn: 284669
2016-10-19 23:47:37 +00:00
Reid Kleckner 6432d45f7b Use noexcept instead of LLVM_NOEXCEPT now that all compilers support it
llvm-svn: 284667
2016-10-19 23:39:55 +00:00
Michael Gottesman 66cc2d5210 [cmake] Follow LLVM's lead in creating exported tool targets for clang tools.
This is needed by downstream projects such as swift to get proper cmake
dependency information for LLVM/Clang targets.

A few months ago I added support for exporting this information for Clang
libraries. In order to be incremental, I did not add support for exporting clang
tools as well at that time. Now such support is needed, so I am committing this
incremental code.

llvm-svn: 284658
2016-10-19 22:46:06 +00:00
Richard Smith c5452ed941 Add optimization to sizeof...(X) handling: if none of parameter pack X's
corresponding arguments are unexpanded pack expansions, we can compute the
result without substituting them. This significantly improves the memory usage
and performance of make_integer_sequence implementations that do this kind of
thing:

  using result = integer_sequence<T, Ns ..., sizeof...(Ns) + Ns ...>;

... but note that such an implementation will still perform O(sizeof...(Ns)^2)
work while building the second pack expansion (we just have a somewhat lower
constant now).

In principle we could get this down to linear time by caching whether the
number of expansions of a pack is constant, or checking whether we're within an
alias template before scanning the pack for pack expansions (since that's the
only case in which we do substitutions within a dependent context at the
moment), but this patch doesn't attempt that.

llvm-svn: 284653
2016-10-19 22:18:42 +00:00
Eli Friedman 01d6b963d2 Don't crash generating debug info for VLA in function prototype.
Fixes regression from r279445.

Differential Revision: https://reviews.llvm.org/D25793

llvm-svn: 284652
2016-10-19 22:16:32 +00:00
Victor Leschuk 802e4a58a6 DebugInfo: use uint32_t for alignment variables.
LLVM now uses uint32_t for DebugInfo alignment for space efficiency,
in this patch we change frontend DebugInfo-related variables to uint32_t too.

Differential Revision: https://reviews.llvm.org/D25621

llvm-svn: 284651
2016-10-19 22:11:07 +00:00
Chris Bieneman 76a2e60e59 [CMake] Add clang-bootstrap-deps target
Having this target allows other parts of the build system to add to the bootstrap dependencies without needing to be defined before the bootstrap targets are created.

This will specifically be used connect the builtins build from the LLVM runtimes directory as a dependency of the next build stage.

llvm-svn: 284648
2016-10-19 21:18:48 +00:00
Justin Lebar 6c86e9160d [CUDA] When we emit an error that might have been deferred, also print a callstack.
Summary:
Previously, when you did something not allowed in a host+device function
and then caused it to be codegen'ed, we would print out an error telling
you that you did something bad, but we wouldn't tell you how we decided
that the function needed to be codegen'ed.

This change causes us to print out a callstack when emitting deferred
errors.  This is immensely helpful when debugging highly-templated code,
where it's often unclear how a function became known-emitted.

We only print the callstack once per function, after we print the all
deferred errors.

This patch also switches all of our hashtables to using canonical
FunctionDecls instead of regular FunctionDecls.  This prevents a number
of bugs, some of which are caught by tests added here, in which we
assume that two FDs for the same function have the same pointer value.

Reviewers: rnk

Subscribers: cfe-commits, tra

Differential Revision: https://reviews.llvm.org/D25704

llvm-svn: 284647
2016-10-19 21:15:01 +00:00
Chris Bieneman ebe8b83fbc [CMake] Support thin LTO in PGO CMake cache
This allows you to set PGO_INSTRUMENT_LTO=Thin and have it work correctly.

llvm-svn: 284646
2016-10-19 21:12:04 +00:00
Justin Lebar 2271ba2c52 [AST] Add CanonicalDeclPtr<T>.
Summary:
CanonicalDeclPtr<T> is just like a T*, except it calls
T::getCanonicalDecl() on construction.

This is useful as the key in a "set of canonical Decls" -- it's much
less error-prone than calling getCanonicalDecl() every time you touch
the set.

Reviewers: rnk

Subscribers: cfe-commits, tra

Differential Revision: https://reviews.llvm.org/D25703

llvm-svn: 284644
2016-10-19 21:03:42 +00:00
Justin Lebar 9730ae943f [CUDA] Emit errors for wrong-side calls made on the same line as non-wrong-side calls.
Summary:
This fixes two related bugs:

1) Previously, if you had a non-wrong side call at some source code
location L, we wouldn't emit errors for wrong-side calls that appeared
at L.

2) We'd only emit one wrong-side error per source code location, when we
actually want to emit it twice if we hit this line more than once due to
e.g. template instantiation.

Reviewers: tra

Subscribers: rnk, cfe-commits

Differential Revision: https://reviews.llvm.org/D25702

llvm-svn: 284643
2016-10-19 21:03:38 +00:00
Vedant Kumar cdd6da83a6 [ubsan] Drop dependency on a 64-bit arch in a test (NFC)
This should fix:

    http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/46184

llvm-svn: 284642
2016-10-19 20:53:16 +00:00
Vedant Kumar da25927188 [ubsan] Re-work check lines to try to appease a bot (NFC)
This bot does not produce the IR I expect -- it's missing some
'handler.dynamic_type_cache_miss:' labels. We don't need to rely on
those labels, so get rid of them in hopes of making the bot happy.

    http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/55493

llvm-svn: 284639
2016-10-19 20:28:35 +00:00
Sriraman Tallam 165a8845f8 New clang option -mpie-copy-relocations to use copy relocations for PIE builds.
Differential Revision: https://reviews.llvm.org/D19996

llvm-svn: 284638
2016-10-19 20:24:06 +00:00
Vedant Kumar 018f266bbc [ubsan] Use the object pointer's type info for devirtualized calls
ubsan reports a false positive 'invalid member call' diagnostic on the
following example (PR30478):

  struct Base1 {
    virtual int f1() { return 1; }
  };

  struct Base2 {
    virtual int f1() { return 2; }
  };

  struct Derived2 final : Base1, Base2 {
    int f1() override { return 3; }
  };

  int t1() {
    Derived2 d;
    return static_cast<Base2 *>(&d)->f1();
  }

Adding the "final" attribute to a most-derived class allows clang to
devirtualize member calls into an instance of that class. We should pass
along the type info of the object pointer to avoid the FP. In this case,
that means passing along the type info for 'Derived2' instead of 'Base2'
when checking the dynamic type of static_cast<Base2 *>(&d2).

Differential Revision: https://reviews.llvm.org/D25448

llvm-svn: 284636
2016-10-19 20:21:16 +00:00
Hans Wennborg 0a79a1203a MS ABI: Fix assert when generating virtual function call with virtual bases and -flto (PR30731)
getClassAtVTableLocation() was calling
ASTRecordLayout::getBaseClassOffset() on a virtual base, causing an
assert.

Differential Revision: https://reviews.llvm.org/D25779

llvm-svn: 284624
2016-10-19 18:04:27 +00:00
Simon Dardis 1f90f2d33f [mips][msa] Range check MSA intrinsics with immediates
This patch teaches clang to range check immediates for MIPS MSA instrinsics.
This checking is done strictly in comparison to some existing GCC
implementations. E.g. msa_andvi_b(var, 257) does not result in andvi $wX, 1.
Similarily msa_ldi_b takes a range of -128 to 127.

As part of this effort, correct the existing MSA test as it has both illegal
types and immediates.

Reviewers: vkalintiris

Differential Revision: https://reviews.llvm.org/D25017

llvm-svn: 284620
2016-10-19 17:50:52 +00:00
Douglas Katzman 69d7cf0d41 [Myriad] Find libc++ headers next to clang binary
llvm-svn: 284617
2016-10-19 17:30:40 +00:00
Benjamin Kramer f1fce6e966 Remove unused diagnostics. NFC.
llvm-svn: 284595
2016-10-19 14:22:38 +00:00
Benjamin Kramer 089a39e859 Don't copy replacements in for-range loop. NFC.
llvm-svn: 284589
2016-10-19 13:50:17 +00:00
Michal Gorny 0ed2f4e98b [cmake] Use LLVM_CMAKE_PATH for GetSVN script
Use the LLVM_CMAKE_PATH variable to locate the GetSVN.cmake script.
The variable was already available in stand-alone builds, and is also
set by LLVM since r284581.

llvm-svn: 284582
2016-10-19 12:21:39 +00:00
Andrey Bokhanko 9941ca8af6 [Sema] Gcc compatibility of vector shift
Gcc prints error if elements of left and right parts of a shift have different
sizes. This patch is provided the GCC compatibility.

Patch by Vladimir Yakovlev.

Differential Revision: https://reviews.llvm.org/D24669

llvm-svn: 284579
2016-10-19 12:06:10 +00:00
Vassil Vassilev c774a23bd9 [modules] Do not report missing definitions of demoted constexpr variable templates.
This is a followup to regression introduced in r284284.

This should fix our libstdc++ modules builds.

https://reviews.llvm.org/D25678

Reviewed by Richard Smith!

llvm-svn: 284577
2016-10-19 11:19:30 +00:00
Eric Liu 99eeab7ff3 [clang-format] Add comment manipulation header
Summary:
Introduces a separate target for comment manipulation.
Currently, comment manipulation is in BreakableComment.cpp.
Towards implementing comment reflowing, we want to factor out the
comment-related functionality, so it can be reused.
Start simple by just moving out getLineCommentIndentPrefix.

Patch by Krasimir Georgiev!

Reviewers: djasper

Subscribers: klimek, beanz, mgorny, modocache

Differential Revision: https://reviews.llvm.org/D25725

llvm-svn: 284573
2016-10-19 08:19:46 +00:00
Richard Smith 5f4b388442 Resolve exception specifications when selecting an overloaded operator.
llvm-svn: 284556
2016-10-19 00:14:23 +00:00
Justin Lebar d3fd70dedd [CUDA] Rework tests now that we emit deferred diagnostics during sema. Test-only change.
Summary:
Previously we had to split out a lot of our tests into a test that
checked only immediate errors and a test that checked only deferred
errors.  This was because, if you emitted any immediate errors, we
wouldn't run codegen, where the deferred errors were emitted.

We've fixed this, and now emit deferred errors during sema.  This lets
us merge a bunch of tests, and lets us convert some other tests to
-fsyntax-only.

Reviewers: tra

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D25755

llvm-svn: 284553
2016-10-19 00:06:49 +00:00
Richard Smith 84a0b6dba1 DR1330: instantiate exception-specifications when "needed". We previously did
not instantiate exception specifications of functions if they were only used in
unevaluated contexts (other than 'noexcept' expressions).

In C++17 onwards, this becomes essential since the exception specification is
now part of the function's type.

Note that this means that constructs like the following no longer work:

  struct A {
    static T f() noexcept(...);
    decltype(f()) *p;
  };

... because the decltype expression now needs the exception specification of
'f', which has not yet been parsed.

llvm-svn: 284549
2016-10-18 23:39:12 +00:00
Richard Smith fccb5128b2 Add missing warning for use of C++1z init-statements in C++14 and before.
llvm-svn: 284530
2016-10-18 20:27:16 +00:00