Alex Lorenz [Fri, 7 Jul 2017 09:15:29 +0000 (09:15 +0000)]
[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.
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.
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.
[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.
Douglas Gregor [Wed, 5 Jul 2017 20:20:14 +0000 (20:20 +0000)]
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:
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.
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.
Richard Smith [Wed, 5 Jul 2017 07:47:11 +0000 (07:47 +0000)]
[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.
Add an option group for deprecated warnings. Add the removed
-fslp-vectorize-aggressive and -fno-slp-vectorize-aggressive flags back
under this group and test for the warning. Document the future removal
in the ReleaseNotes.
[modules] Teach clang how to merge typedef over anonymous structs in C mode.
In C mode clang fails to merge the textually included definition with the one imported from a module. The C lookup rules fail to find the imported definition because its linkage is internal in non C++ mode.
This patch reinstates some of the ODR merging rules for typedefs of anonymous tags for languages other than C++.
Jonas Hahnfeld [Sat, 1 Jul 2017 10:40:50 +0000 (10:40 +0000)]
[OpenMP] Fix mapping of scalars for combined directives
Combined directives like 'target parallel' have two captured statements.
Sema has to check the right one from the right direction.
Previously, Sema::IsOpenMPCapturedByRef would return false for mapped
scalars on combined directives. This results in a wrong signature of
the outlined function which triggers an assertion:
void llvm::CallInst::init(llvm::FunctionType *, llvm::Value *, ArrayRef<llvm::Value *>, ArrayRef<OperandBundleDef>, const llvm::Twine &): Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Calling a function with a bad signature!"' failed.
Fixes PR30975 (and PR31985). New function was taken from clang-ykt.
Summary:
Un-revert https://reviews.llvm.org/D34868, but with a slight tweak to the
documentation to fix an error -- I had used the wrong syntax for a link.
Brian Gesiak [Sat, 1 Jul 2017 04:44:38 +0000 (04:44 +0000)]
[Driver] Add -fdiagnostics-hotness-threshold
Summary:
Depends on https://reviews.llvm.org/D34867.
Add a Clang frontend option to enable optimization remark hotness
thresholds, which were added to LLVM in https://reviews.llvm.org/D34867.
This prevents diagnostics that do not meet a minimum hotness
threshold from being output. When generating optimization remarks for large
codebases with a ton of cold code paths, this option can be used
to limit the optimization remark output at a reasonable size.
Discussion of this change can be read here:
http://lists.llvm.org/pipermail/llvm-dev/2017-June/114377.html
[Driver] Check that the iOS deployment target is iOS 10 or earlier if
the target is 32-bit.
The following changes are made to the driver since 32-bit apps do not
run on iOS 11 or later:
- If the deployment target is set explicitly, either with a command-line
option or an environment variable, the driver should report an error
if the version is greater than iOS 10.
- In the case where the deployment target is not set explicitly and the
default is inferred from the target triple or SDK version, it should
use a maximum default of iOS 10.99.99.
[Modules] Implement ODR-like semantics for tag types in C/ObjC
Allow ODR for ObjC/C in the sense that we won't keep more that
one definition around (merge them). However, ensure the decl
pass the structural compatibility check in C11 6.2.7/1, for that,
reuse the structural equivalence checks used by the ASTImporter.
Few other considerations:
- Create error diagnostics for tag types mismatches and thread
them into the structural equivalence checks.
- Note that by doing this we only support redefinition between types
that are considered "compatible types" by C.
This is mixed approach of the suggestions discussed in
http://lists.llvm.org/pipermail/cfe-dev/2017-March/053257.html
Hubert Tong [Fri, 30 Jun 2017 22:43:54 +0000 (22:43 +0000)]
Fix PR 33189: Clang assertion on template destructor declaration
Summary:
This patch aims to fix the bug reported at
https://bugs.llvm.org/show_bug.cgi?id=33189. Clang hits an assertion
when a template destructor declaration is present. This is caused by
later processing that does not expect to encounter a template when
looking at a destructor. The resolution is to treat the destructor as
being not declared when later processing is interested in the properties
of the destructor of a class.
Vassil Vassilev [Fri, 30 Jun 2017 22:40:17 +0000 (22:40 +0000)]
Reinstate "Load lazily the template specialization in multi-module setups."
It was reverted in r305460 but the issue appears to only break our self-host
libcxx modules bot. Reapplying it will give us a chance to get a reproducer and
fix the issue.
Vedant Kumar [Fri, 30 Jun 2017 21:02:14 +0000 (21:02 +0000)]
[Profile] Do not assign counters to functions without bodies
The root cause of the issues reported in D32406 and D34680 is that clang
instruments functions without bodies. Make it stop doing that, and also
teach it how to use old (incorrectly generated) profiles without
crashing.
Richard Smith [Fri, 30 Jun 2017 20:57:39 +0000 (20:57 +0000)]
Fix ODR violations due to abuse of LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR
This is a short-term fix for PR33650 aimed to get the modules build bots green again.
Remove all the places where we use the LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR
macros to try to locally specialize a global template for a global type. That's
not how C++ works.
Instead, we now centrally define how to format vectors of fundamental types and
of string (std::string and StringRef). We use flow formatting for the former
cases, since that's the obvious right thing to do; in the latter case, it's
less clear what the right choice is, but flow formatting is really bad for some
cases (due to very long strings), so we pick block formatting. (Many of the
cases that were using flow formatting for strings are improved by this change.)
Other than the flow -> block formatting change for some vectors of strings,
this should result in no functionality change.
Francois Ferrand [Fri, 30 Jun 2017 20:25:55 +0000 (20:25 +0000)]
clang-format: add options to merge empty record body
Summary:
This patch introduces a few extra BraceWrapping options, similar to
`SplitEmptyFunction`, to allow merging empty 'record' bodies (e.g.
class, struct, union and namespace):
* SplitEmptyClass
* SplitEmptyStruct
* SplitEmptyUnion
* SplitEmptyNamespace
The `SplitEmptyFunction` option name has also been simplified/
shortened (from `SplitEmptyFunctionBody`).
These options are helpful when the correspond AfterXXX option is
enabled, to allow merging the empty record:
class Foo
{};
In addition, this fixes an unexpected merging of short records, when
the AfterXXXX options are used, which caused to be formatted like
this:
This is similar to how dictionnaries are formatted, and actually corresponds to the same conditions: when initializing a container (and not just 'calling' a constructor).
Such formatting involves 2 things:
* Line breaks around the content of the block. This can be forced by adding a comma or comment after the last element
* Elements should not be binpacked
This patch considers the block is an initializer list if it either ends with a comma, or follows an assignment, which seems to provide a sensible approximation.
Brian Gesiak [Fri, 30 Jun 2017 19:37:11 +0000 (19:37 +0000)]
[ORE] Use LLVM's "diagnostics hotness" spelling
Summary:
Depends on https://reviews.llvm.org/D34864.
To unify Clang and LLVM's spelling of "diagnostic[s] hotness", use the
new "diagnostics hotness" spelling in LLVM, which was added in
https://reviews.llvm.org/D34864.
Craig Topper [Fri, 30 Jun 2017 18:14:01 +0000 (18:14 +0000)]
[X86] Move all atom CPUs to the same section of the switch and use fallthroughs like we do for other CPU generations. NFC
This is prep work to add MOVBE to all Atom CPUs. This instruction didn't come in to the Nehalem/Westmere/SandyBridge/etc. line until later so there's no natural place to overlap the Atom CPUs into that part of the switch.
Alex Lorenz [Fri, 30 Jun 2017 16:58:36 +0000 (16:58 +0000)]
Move ClassReplacements.cpp test from clang-rename tests to the
clang-apply-replacements tests
The ClassReplacements.cpp test in the clang-rename tests uses
clang-apply-replacements. I moved it back to the clang-tools-extra repository
for now to ensure that the clang-rename tests can pass when clang is compiled
without clang-tools-extra.
Alex Lorenz [Fri, 30 Jun 2017 16:36:09 +0000 (16:36 +0000)]
[refactor] Move clang-rename into the clang repository
The core engine of clang-rename will be used for local and global renames in the
new refactoring engine, as mentioned in
http://lists.llvm.org/pipermail/cfe-dev/2017-June/054286.html.
The clang-rename tool is still supported but might get deprecated in the future.
Kuba Mracek [Fri, 30 Jun 2017 16:28:15 +0000 (16:28 +0000)]
[objc] Don't require null-check and don't emit memset when result is ignored for struct-returning method calls [clang part]
This fixes an issue with the emission of lifetime markers for struct-returning Obj-C msgSend calls. When the result of a struct-returning call is ignored, the temporary storage is only marked with lifetime markers in one of the two branches of the nil-receiver-check. The check is, however, not required when the result is unused. If we still need to emit the check (due to consumer arguments), let's not emit the memset to zero out the result if it's unused. This fixes a use-after-scope false positive with AddressSanitizer.
Driver: honor -nostdinc and -isystem-after on CrossWindows
This changes CrossWindows to look for -nostdinc instead of -nostdlibinc.
In addition, fixes a bug where -isystem-after options would be dropped
when called with -nostdinc.
Benjamin Kramer [Fri, 30 Jun 2017 13:21:27 +0000 (13:21 +0000)]
[Driver] Actually report errors during parsing instead of stopping when there's an error somewhere.
This is a more principled version of r303756. That change was both very
brittle about the state of the Diags object going into the driver and
also broke tooling in funny ways.
In particular it prevented tools from capturing diagnostics properly and
made the compilation database logic fail to provide arguments to the
tool, falling back to scanning directories for JSON files.
Sjoerd Meijer [Fri, 30 Jun 2017 08:07:34 +0000 (08:07 +0000)]
ARMV8-A archkind and target defines helper functions
This introduces helper functions that set target defines for different ARMV8-A
architecture kinds. It fixes an issue that the v8.1 define ARM_FEATURE_QRDMX
was not set for v8.2. These helper functions make things more “scalable” if we
want to add ARMv8.3 at some point, and a cleanup has been done to hold the
architecture kind in one variable (instead of one for each).
Chandler Carruth [Fri, 30 Jun 2017 05:13:31 +0000 (05:13 +0000)]
Remove Clang support for '-fvectorize-slp-aggressive' which used LLVM's
basic block vectorizer. This vectorizer has had no known users for many,
many years and is completely surpassed by the normal
'-fvectorize-slp'-controlled SLP vectorizer in LLVM.
Hal proposed this back in 2014 to no objections:
http://lists.llvm.org/pipermail/llvm-dev/2014-November/079091.html
While this patch completely removes the flag, Joerg is working on
a patch that will add it back in a way that warns users and ignores the
flag in a clear and well factored way (so that we can keep doing this
going forward).
Heejin Ahn [Fri, 30 Jun 2017 00:44:01 +0000 (00:44 +0000)]
[WebAssembly] Add throw/rethrow builtins for exception handling
Summary:
Add new builtins for throw/rethrow instructions. This follows exception handling
handling proposal in
https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md