Commit Graph

69361 Commits

Author SHA1 Message Date
Reid Kleckner cd016d8dc6 [MS] Don't statically initialize dllimport member function pointers
Summary:
r306137 made dllimport pointers to member functions non-constant. This
is correct because a load must be executed to resolve any dllimported
data. However, r306137 did not account for the use of dllimport member
function pointers used as template arguments.

This change re-lands r306137 with a template instantiation fix.

This fixes PR33570.

Reviewers: rnk, majnemer

Subscribers: cfe-commits

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

llvm-svn: 307446
2017-07-07 22:04:29 +00:00
Dehao Chen a3f8c80a35 Add sample PGO integration test to cover profile annotation and inlining.
Summary: The patch makes the integration test cover major sample PGO components.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: sanjoy, cfe-commits

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

llvm-svn: 307445
2017-07-07 22:01:47 +00:00
Lang Hames 86ac9182e0 Add testcase for r305850.
Accidentally left this out of the original commit.

llvm-svn: 307444
2017-07-07 21:51:11 +00:00
Dehao Chen 4a7e66a846 Enable the new PM + SamlePGO + ThinLTO testing.
Summary: This patch should be enabled after https://reviews.llvm.org/D34895

Reviewers: chandlerc, tejohnson, davidxl

Reviewed By: tejohnson

Subscribers: sanjoy, mehdi_amini, inglorion, eraman, cfe-commits

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

llvm-svn: 307438
2017-07-07 20:53:17 +00:00
Richard Smith 1283e9868d [modules ts] Basic for module linkage.
In addition to the formal linkage rules, the Modules TS includes cases where
internal-linkage symbols within a module interface unit can be referenced from
outside the module via exported inline functions / templates. We give such
declarations "module-internal linkage", which is formally internal linkage, but
results in an externally-visible symbol.

llvm-svn: 307434
2017-07-07 20:04:28 +00:00
Craig Topper 61395176f9 [X86] Replace 'fallthrough' comments with LLVM_FALLTHROUGH.
llvm-svn: 307420
2017-07-07 18:41:09 +00:00
Martin Probst a81dd0b6eb clang-format: [JS] do not wrap after "readonly".
Summary:
Breaks after "readonly" trigger automatic semicolon insertion in field
declarations.

Reviewers: krasimir, djasper

Subscribers: klimek

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

llvm-svn: 307394
2017-07-07 13:17:10 +00:00
Alex Lorenz b249c9bcf5 Recommit [driver][macOS] Pick the system version for the
deployment target if the SDK is newer than the system

This commit reverts the revert commit r305891. Now the change from r305678
should be correct because `llvm::sys::getProcessTriple` now returns the correct
macOS version of the system after the LLVM change r307372.

Original commit message:

This commit improves the driver by making sure that it picks the system version
for the deployment target when the version of the macOS SDK is newer than the
system version.

rdar://29449467

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

llvm-svn: 307388
2017-07-07 10:41:19 +00:00
Simon Atanasyan df406d18aa [driver][mips] Pass long-calls feature flag to the MIPS backend
Check the `-mlong-calls` command line option and pass the `long-calls`
feature flag to the backend. Handling of this feature flag in the backend
needs to be implemented by a separate commit.

llvm-svn: 307386
2017-07-07 10:35:33 +00:00
Alex Lorenz 5ff6b8655a [Frontend] Verify that the bitstream is not empty before reading
the serialised diagnostics

Clang should avoid calling report_fatal_error when the file with the serialised
diagnostics is empty. This commit changes Clang's serialised diagnostic reader,
now it reports an appropriate error instead of crashing.

rdar://31939877

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

llvm-svn: 307384
2017-07-07 10:25:12 +00:00
Olivier Goffart 67049f034d Fix crash parsing invalid code
The code in the test caused a crash with this backtrace:

 RecordLayoutBuilder.cpp:2934: const clang::ASTRecordLayout &clang::ASTContext::getASTRecordLayout(const clang::RecordDecl *) const: Assertion `!D->isInvalidDecl() && "Cannot get layout of invalid decl!"' failed.
 [...]
 #7 0x00007f63963d845a __assert_fail_base (/usr/lib/libc.so.6+0x2c45a)
 #8 0x00007f63963d84d2 (/usr/lib/libc.so.6+0x2c4d2)
 #9 0x00007f63937a0631 clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const /home/olivier/prog/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp:2935:3
 #10 0x00007f63937a1ad5 getFieldOffset(clang::ASTContext const&, clang::FieldDecl const*) /home/olivier/prog/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp:3057:37
 #11 0x00007f6391869f14 clang::Sema::RefersToMemberWithReducedAlignment(clang::Expr*, llvm::function_ref<void (clang::Expr*, clang::RecordDecl*, clang::FieldDecl*, clang::CharUnits)>) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaChecking.cpp:12139:23
 #12 0x00007f639186a2f8 clang::Sema::CheckAddressOfPackedMember(clang::Expr*) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaChecking.cpp:12190:1
 #13 0x00007f6391a7a81c clang::Sema::CheckAddressOfOperand(clang::ActionResult<clang::Expr*, true>&, clang::SourceLocation) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaExpr.cpp:11111:10
 #14 0x00007f6391a7f5d2 clang::Sema::CreateBuiltinUnaryOp(clang::SourceLocation, clang::UnaryOperatorKind, clang::Expr*) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaExpr.cpp:11932:18

Fixing by bailing out for invalid classes.

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

llvm-svn: 307371
2017-07-07 09:38:59 +00:00
Alex Lorenz cdd596fcde [ObjC] Avoid the -Wunguarded-availability warnings for protocol
requirements in protocol/class/category declarations

The unguarded availability warnings in the protocol requirements of a protocol
/class/category declaration can be avoided. This matches the behaviour of
Swift's diagnostics. The warnings for deprecated/unavailable protocols are
preserved.

rdar://33156429

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

llvm-svn: 307368
2017-07-07 09:15:29 +00:00
Evgeniy Stepanov 760a261e1e Update Cross-DSO CFI documentation.
Reviewers: pcc

Subscribers: llvm-commits

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

llvm-svn: 307341
2017-07-07 00:48:12 +00:00
Sterling Augustine 6b030ab461 This call-site should have been updated as part of D34304.
Summary: Use an argument adjuster to preserve behavior inadvertantly changed by D34304.

Reviewers: klimek

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

llvm-svn: 307329
2017-07-06 22:47:19 +00:00
David L. Jones d4053fb2ec Change remaining references to lit.util.capture to use subprocess.check_output.
Summary:
The capture() function was removed in r306625. This should fix PGO breakages
reported by Michael Zolotukhin.

Reviewers: mzolotukhin

Subscribers: sanjoy, llvm-commits

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

llvm-svn: 307320
2017-07-06 21:46:47 +00:00
Richard Smith 1f2bd35b24 Reject attempts to build a module without -fmodules, rather than silently doing weird things.
llvm-svn: 307316
2017-07-06 21:05:56 +00:00
Sterling Augustine 1cda1d76b1 Allow CompilerInvocations to generate .d files.
Summary:
Most clang tools should ignore the -M
family of options because one wouldn't want them
to generate a new dependency (.d) file. However,
some tools may want this dependency file. This
patch creates a mechanism for them to do this.

This implementation just plumbs a boolean down
several layers of calls. Each of the modified calls
has several call sites, and so a single member
variable or new API entry point won't work.

An alternative would be to write a function to filter
the -M family of arguments out of CC1Args, and have
each caller call that function by hand before calling
newInvocation, Invocation::run, or buildAstFromCodeWithArgs.
This is a more complicated and error-prone solution.
Why burden all the callers to remember to use
this function?

But I could rewrite this patch to use that method if
that is deemed more appropriate.

Reviewers: klimek

Reviewed By: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 307315
2017-07-06 21:02:52 +00:00
Mandeep Singh Grang a2baff0851 [Objective-C] Fix non-determinism in clang
Summary: Iteration of the unordered Ivars causes objc-modern-metadata-visibility.mm (uncovered by reverse iterating SmallPtrSet).

Reviewers: dblaikie, davide, rsmith

Reviewed By: dblaikie

Subscribers: cfe-commits, llvm-commits

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

llvm-svn: 307296
2017-07-06 18:49:57 +00:00
Sjoerd Meijer 98ee78578b This reverts r305820 (ARMv.2-A FP16 vector intrinsics) because it shows
problems in testing, see comments in D34161 for some more details.
A fix is in progres in D35011, but a revert seems better now as the fix will
probably take some more time to land.

llvm-svn: 307277
2017-07-06 16:37:31 +00:00
Gheorghe-Teodor Bercea f0f29608d0 [OpenMP] Extend CLANG target options with device offloading kind.
Summary: Pass the type of the device offloading when building the tool chain for a particular target architecture. This is required when supporting multiple tool chains that target a single device type. In our particular use case, the OpenMP and CUDA tool chains will use the same ```addClangTargetOptions ``` method. This enables the reuse of common options and ensures control over options only supported by a particular tool chain.

Reviewers: arpith-jacob, caomhin, carlo.bertolli, ABataev, jlebar, hfinkel, tstellar, Hahnfeld

Reviewed By: hfinkel

Subscribers: jgravelle-google, aheejin, rengolin, jfb, dschuff, sbc100, cfe-commits

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

llvm-svn: 307272
2017-07-06 16:22:21 +00:00
Gheorghe-Teodor Bercea 6a5df72a82 [OpenMP] Customize CUDA-based tool chain selection
Summary: This patch provides a generic way of selecting CUDA based tool chains as host-device pairs.

Reviewers: arpith-jacob, caomhin, carlo.bertolli, ABataev, Hahnfeld, jlebar, hfinkel, tstellar

Reviewed By: Hahnfeld

Subscribers: rengolin, cfe-commits

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

llvm-svn: 307271
2017-07-06 16:08:15 +00:00
Krasimir Georgiev 8fc2967a6a [clang-format] Add TextProto language name, NFC
llvm-svn: 307264
2017-07-06 14:39:39 +00:00
Krasimir Georgiev 47f21ef2af [clang-format] Add space between a message field key and the opening bracket in proto messages
Summary:
This patch updates the formatting of message fields of type `a{...}` to `a {...}`
for proto messages.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 307261
2017-07-06 13:58:29 +00:00
Egor Churaev ccc5e04461 [OpenCL] Test on image access modifiers and image type can only be a type of a function argument.
Reviewers: Anastasia

Reviewed By: Anastasia

Subscribers: yaxunl, cfe-commits, bader

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

llvm-svn: 307238
2017-07-06 07:06:11 +00:00
Richard Smith b51cf1136f [modules ts] Do not emit strong function definitions from the module interface unit in every user.
llvm-svn: 307232
2017-07-06 00:30:00 +00:00
Richard Smith 29c5f16ad0 [cxx_status] Update link to Modules TS to latest working draft. Fix Coroutines TS flag to work if copy-pasted.
llvm-svn: 307231
2017-07-06 00:29:13 +00:00
Douglas Gregor c0fe1f211a Fix test case in pre-C++11 mode; address Aaron Ballman's code review.
llvm-svn: 307202
2017-07-05 21:12:37 +00:00
Michael Zolotukhin f70de9caa2 Fix one more reference to lit.util.capture()
The capture method was removed in r306643.

llvm-svn: 307201
2017-07-05 21:06:11 +00:00
Douglas Gregor bb33f57045 Cope with Range-v3's CONCEPT_REQUIRES idiom
llvm-svn: 307197
2017-07-05 20:20:15 +00:00
Douglas Gregor 00fa10b43f Customize the SFINAE diagnostics for enable_if to provide the failed condition.
When enable_if disables a particular overload resolution candidate,
rummage through the enable_if condition to find the specific condition
that caused the failure. For example, if we have something like:

    template<
      typename Iter,
      typename = std::enable_if_t<Random_access_iterator<Iter> &&
                                  Comparable<Iterator_value_type<Iter>>>>
    void mysort(Iter first, Iter last) {}

and we call "mysort" with "std::list<int>" iterators, we'll get a
diagnostic saying that the "Random_access_iterator<Iter>" requirement
failed. If we call "mysort" with
"std::vector<something_not_comparable>", we'll get a diagnostic saying
that the "Comparable<...>" requirement failed.

llvm-svn: 307196
2017-07-05 20:20:14 +00:00
Brian Gesiak bb83ce4678 Add docs for -foptimization-record-file=
Summary: The Clang option was previously not included in the User's Manual.

Reviewers: anemet, davidxl, hfinkel

Reviewed By: hfinkel

Subscribers: cfe-commits

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

llvm-svn: 307193
2017-07-05 19:55:51 +00:00
Erik Pilkington 4042f3cf8e [Sema] Don't allow -Wunguarded-availability to be silenced with redecls
Differential revision: https://reviews.llvm.org/D33816

llvm-svn: 307175
2017-07-05 17:08:56 +00:00
Erich Keane 7538b35cef Address comments that escaped D33333
Patch By: Jen Yu

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

llvm-svn: 307172
2017-07-05 16:43:45 +00:00
Ulrich Weigand 6d6c4808ef [SystemZ] Simplify handling of ISA revisions
This moves determination of the ISA revision from the CPU name to
one single place, removing a bunch of duplicated code.  It also
makes the supported ISA revisions available as feature strings.

No functional change.

llvm-svn: 307156
2017-07-05 13:19:47 +00:00
Simon Atanasyan 6a9570c282 [driver][mips] Use AddTargetFeature to check arguments and add feature flags. NFC
llvm-svn: 307152
2017-07-05 12:57:37 +00:00
Simon Atanasyan 3369438ef4 [driver][mips] Remove redundant curly brackets. NFC
llvm-svn: 307151
2017-07-05 12:57:32 +00:00
Krasimir Georgiev 835ac9bc62 [clang-format] Fix an uninitialized memory access
llvm-svn: 307147
2017-07-05 12:24:01 +00:00
Alexander Kornienko 1c6b8f82af Add const to reference arguments of Diagnostic ctor
llvm-svn: 307143
2017-07-05 11:45:09 +00:00
Erik Verbruggen 795eee96b3 Fix invalid warnings for header guards in preambles
Fixes https://bugs.llvm.org/show_bug.cgi?id=33574

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

llvm-svn: 307134
2017-07-05 09:44:07 +00:00
Richard Smith d19389a3c9 [modules ts] Improve merging of module-private declarations.
These cases occur frequently for declarations in the global module (above the
module-declaration) in a Modules TS module interface. When we merge a
definition from another module into such a module-private definition, ensure
that we transitively make everything lexically within that definition visible
to that translation unit.

llvm-svn: 307129
2017-07-05 07:47:11 +00:00
Hiroshi Inoue 0c2734f8de fix trivial typos in comments; NFC
llvm-svn: 307123
2017-07-05 05:37:45 +00:00
Yaxun Liu 25d1b4341f [AMDGPU] Fix size and alignment of size_t and pointer types
Differential Revision: https://reviews.llvm.org/D34995

llvm-svn: 307121
2017-07-05 04:58:24 +00:00
Richard Smith e03a654581 [modules ts] Declarations from a module interface unit are only visible outside
the module if declared in an export block. 

llvm-svn: 307115
2017-07-05 01:42:07 +00:00
Yaxun Liu 3ba4a720ad [AMDGPU] Fix regressions on mesa/clover with libclc due to address space
Currently AMDGPUTargetInfo does not initialize AddrSpaceMap in constructor, which causes regressions in mesa/clover with libclc.

This patch fixes that.

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

llvm-svn: 307105
2017-07-04 19:57:18 +00:00
Kamil Rytarowski 2eef475ad3 Enable LLVM asan support for NetBSD/amd64
Summary:
Enable LLVM asan sanitizer for NetBSD/amd64.

Don't generate -ldl for dlopen(3)-like functions on NetBSD.
These features are available in libc on NetBSD.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, eugenis, kcc, dim

Reviewed By: dim

Subscribers: #clang, #sanitizers

Tags: #clang, #sanitizers

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

llvm-svn: 307104
2017-07-04 19:55:56 +00:00
Martin Probst 37a7f91005 clang-format: [JS] space between pseudo keywords and template literals.
Summary:
Before:
  yield`foo`;

After:
  yield `foo`;

This reinstates commit 71d3b5cd91 / r307023 and fixes the logic by
introducing an explicit table of JavaScript pseudo keywords.

Reviewers: djasper

Subscribers: klimek

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

llvm-svn: 307087
2017-07-04 15:30:21 +00:00
Alex Lorenz 200dc12f3b [index] Index nested name qualifiers in a forward declaration of a
class template specialization

rdar://33122110

llvm-svn: 307074
2017-07-04 12:50:53 +00:00
Joey Gouly 6b03d95f0f [OpenCL] Rename err_opencl_enqueue_kernel_expected_type
Rename err_opencl_enqueue_kernel_expected_type so that other builtins
can use the same diagnostic.

https://reviews.llvm.org/D34948

llvm-svn: 307067
2017-07-04 11:50:23 +00:00
Shoaib Meenai 61118e7ecd [CodeGen] Check key function for typeinfo import
If the imported class does not have a key function, we should emit its
typeinfo locally instead of attempting to import it.

llvm-svn: 307052
2017-07-04 01:02:19 +00:00
Eli Friedman e91b2e682c [Sema] Make BreakContinueFinder handle nested loops.
We don't care about break or continue statements that aren't
associated with the current loop, so make sure the visitor
doesn't find them.

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

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

llvm-svn: 307051
2017-07-04 00:52:24 +00:00