Commit Graph

66672 Commits

Author SHA1 Message Date
Richard Smith 8893f35a89 Additional test file missed from r288737.
llvm-svn: 288738
2016-12-06 00:14:22 +00:00
Richard Smith b9d0193e59 [modules] Use the "redundant #include" diagnostic rather than the "module
import can't appear here" diagnostic if an already-visible module is textually
entered (because we have the module map but not the AST file) within a
function/namespace scope.

llvm-svn: 288737
2016-12-06 00:12:39 +00:00
Richard Trieu 67c0071517 Warn on unsigned zero in call to std::max
New default warning that triggers when an unsigned zero is used in a call to
std::max.  For unsigned values, zero is the minimum value, so any call to
std::max is always equal to the other value.  A common pattern was to take
the max of zero and the difference of two unsigned values, not taking into
account that unsigned values wrap around below zero.  This warning also emits
a note with a fixit hint to remove the zero and call to std::max.

llvm-svn: 288732
2016-12-05 23:41:46 +00:00
Florian Hahn f7913ec68d [docs] Use x86_64 and i386 instead of x86 as arch for triples.
Summary: x86 is not a valid arch for target triples, but x86_64 and i386 are.

Reviewers: rengolin, silvas

Subscribers: cfe-commits

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

llvm-svn: 288723
2016-12-05 22:52:20 +00:00
Saleem Abdulrasool 317dcc3f2f CodeGen: fix windows itanium RTTI in EH mode
When emitting RTTI for EH only, we would mark the locally defined (LinkOnceODR)
RTTI definition as dllimport, which is incorrect.  Ensure that if we are
generating the type information for EH only, it is marked as LinkOnceODR and we
do not make it dllimport.

llvm-svn: 288721
2016-12-05 22:40:20 +00:00
Dominic Chen 0dd2306538 [analyzer] Print type for SymbolRegionValues when dumping to stream
Reviewers: NoQ, dcoughlin, zaks.anna

Subscribers: cfe-commits

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

llvm-svn: 288696
2016-12-05 20:30:11 +00:00
Vitaly Buka 846b8f79d4 Fix stack-use-after-scope in CheckExplicitlyDefaultedMemberExceptionSpec
Summary:
Similar to r288685.
getExceptionSpec returned structure with pointers to temporarily object created
by computeImplicitExceptionSpec.

Reviewers: rsmith

Subscribers: aizatsky, cfe-commits

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

llvm-svn: 288689
2016-12-05 19:25:00 +00:00
Vitaly Buka ac10dcc281 Fix stack-use-after-scope in EvaluateImplicitExceptionSpec
Summary:
getExceptionSpec returns structure with pointers to temporarily object created
by computeImplicitExceptionSpec.

Reviewers: rsmith

Subscribers: aizatsky, cfe-commits

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

llvm-svn: 288685
2016-12-05 18:30:22 +00:00
Shoaib Meenai fc78d7cb8e [Sema] Respect DLL attributes more faithfully
On MSVC, if an implicit instantiation already exists and an explicit
instantiation definition with a DLL attribute is created, the DLL
attribute still takes effect. Make clang match this behavior for
exporting.

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

llvm-svn: 288682
2016-12-05 18:01:35 +00:00
Devin Coughlin ab139a9e79 [analyzer] ObjCGenerics: Warn only on mismatch for invariant type parameters
On a method call, the ObjCGenerics checker uses the type tracked by
DynamicTypePropagation for the receiver to to infer substituted parmeter types
for the called methods and warns when the argument type does not match the
parameter.

Unfortunately, using the tracked type can result in false positives when the
receiver has a non-invariant type parameter and has been intentionally upcast.
For example, becaue NSArray's type parameter is covaraint, the following code
is perfectly safe:

NSArray<NSString *> *allStrings = ...
NSDate *date = ...;
NSArray<NSObject *> *allObjects = allStrings;
NSArray<NSObject *> *moreObjects = [allObjects arrayByAddingObject:date];

but the checker currently warns that the date parameter is not an NSString *.

To avoid this kind of false positive, the checker will now only warn when
the class defining the called method has only invariant type parameters.

rdar://problem/28803951

llvm-svn: 288677
2016-12-05 16:28:47 +00:00
Martin Bohme f44cde8b73 CFGBuilder: Fix crash when visiting delete expression on dependent type
Summary:
CXXDeleteExpr::getDestroyedType() can return a null QualType if the destroyed
type is a dependent type. This patch protects against this.

Reviewers: klimek

Subscribers: cfe-commits

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

llvm-svn: 288665
2016-12-05 11:33:19 +00:00
Benjamin Kramer 9ac117ea1c Clean out unused diagnostics. NFC.
llvm-svn: 288664
2016-12-05 11:30:24 +00:00
Richard Smith b3189a1802 DR1213: element access on an array xvalue or prvalue produces an xvalue. In the
latter case, a temporary array object is materialized, and can be
lifetime-extended by binding a reference to the member access. Likewise, in an
array-to-pointer decay, an rvalue array is materialized before being converted
into a pointer.

This caused IR generation to stop treating file-scope array compound literals
as having static storage duration in some cases in C++; that has been rectified
by modeling such a compound literal as an lvalue. This also improves clang's
compatibility with GCC for those cases.

llvm-svn: 288654
2016-12-05 07:49:14 +00:00
Matthias Braun f1b01996ef Adapt to llvm/TableGen DagInit changes.
llvm-svn: 288645
2016-12-05 06:00:51 +00:00
Peter Collingbourne abf7ebec3d IRGen: Remove an unused overload of CreateAlignedLoad.
llvm-svn: 288629
2016-12-05 00:02:18 +00:00
Daniel Jasper ad3ba6be31 Revert "Recover better from an incompatible .pcm file being provided by -fmodule-file=. We try to include the headers of the module textually in this case, still enforcing the modules semantic rules. In order to make that work, we need to still track that we're entering and leaving the module. Also, if the module was also marked as unavailable (perhaps because it was missing a file), we shouldn't mark the module unavailable -- we don't need the module to be complete if we're going to enter it textually."
This reverts commit r288449.

I believe that this is currently faulty wrt. modules being imported
inside namespaces. Adding these lines to the new test:

  namespace n {
  #include "foo.h"
  }

Makes it break with

  fatal error: import of module 'M' appears within namespace 'n'

However, I believe it should fail with

  error: redundant #include of module 'M' appears within namespace 'n'

I have tracked this down to us now inserting a tok::annot_module_begin
instead of a tok::annot_module_include in
Preprocessor::HandleIncludeDirective() and then later in
Parser::parseMisplacedModuleImport(), we hit the code path for
tok::annot_module_begin, which doesn't set FromInclude of
checkModuleImportContext to true (thus leading to the "wrong"
diagnostic).

llvm-svn: 288626
2016-12-04 22:34:37 +00:00
Matthias Braun bbbf5d4286 TableGen: Adapt to llvm r288612
llvm-svn: 288614
2016-12-04 05:55:09 +00:00
Sylvestre Ledru f421403650 Add the --no-color option to the git call in the doc when using clang-format-diff
llvm-svn: 288605
2016-12-03 23:22:45 +00:00
Dan Gohman c819d0169d [WebAssembly] Revert r288447.
Revert r288447 which introduced -mdirect. It turns out we don't need a
custom flag for this, as the information we need is in the target triple.

llvm-svn: 288604
2016-12-03 23:03:52 +00:00
Sergey Kalinichev bbcf74f585 [libclang] Fix python tests
It was broken in r286421

llvm-svn: 288582
2016-12-03 12:53:06 +00:00
Saleem Abdulrasool 25dbdfa0ac Sema: delay the DLL exported member referencing
An explicit template specialization can cause the implicit template
specialization of a type which inherits the attributes.  In such a case, we
would end up with a delayed template specialization for a dll exported type
which we would fail to reference.  This would trigger an assertion.

We now propagate the dll storage attributes through the inheritance
chain.  Only after having done so do we reference the delayed template
specializations.  This allows any implicit specializations which inherit dll
storage to also be referenced.

llvm-svn: 288570
2016-12-03 01:57:47 +00:00
Eric Fiselier 283d8d45db [Sema] Don't perform aggregate initialization for types with explicit constructors
Summary:
The C++17 rules for aggregate initialization changed to disallow types with explicit constructors [dcl.init.aggr]p1. This patch implements that new rule.


Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 288565
2016-12-03 01:26:47 +00:00
Richard Smith 4baaa5ab52 DR616, and part of P0135R1: member access (or pointer-to-member access) on a
temporary produces an xvalue, not a prvalue. Support this by materializing the
temporary prior to performing the member access.

llvm-svn: 288563
2016-12-03 01:14:32 +00:00
Richard Smith 3a8f13ac23 PR31244: Use the exception specification from the callee's type directly to
compute whether a call is noexcept, even if we can't map the callee expression
to a called declaration.

llvm-svn: 288558
2016-12-03 00:29:06 +00:00
Richard Smith 01d96986d8 More diagnostic name fixups: w_ -> warn_, warning_ -> warn_, not_ -> note_.
In passing, add a warning group for "ignored qualifier in inline assembly" warnings.

llvm-svn: 288548
2016-12-02 23:00:28 +00:00
Saleem Abdulrasool 1882002c91 CodeGen: export typeinfo and typeinfo name on itanium
When a C++ record is marked with dllexport mark both the typeinfo and the
typeinfo name as being exported.  Handle dllimport as the inverse.  This applies
to the itanium environment and not the MinGW environment.

llvm-svn: 288546
2016-12-02 22:46:18 +00:00
Richard Smith f881267db9 Mass-rename the handful of error_* diagnostics to err_*.
llvm-svn: 288545
2016-12-02 22:38:31 +00:00
George Burgess IV bc7f44cb28 [Sema] Reset a BumpPtrAllocator on clear(). NFC.
Looks like the reset() call was omitted by accident.

llvm-svn: 288534
2016-12-02 21:00:12 +00:00
Adam Nemet fc9e246463 With LTO and profile-use, enable hotness info in opt remarks
This is to match the behavior of non-LTO;
when -fsave-optimization-record is passed and PGO is available we enable
the generation of hotness information in the optimization records.

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

llvm-svn: 288520
2016-12-02 17:54:34 +00:00
Jason Henline 531f5221ba [CUDA] Forward sanitizer support to host toolchain
Summary:
This is an improvement on rL288448 where address sanitization was listed
as supported for the CudaToolChain. Since the intent is for the
CudaToolChain not to reject any flags supported by the host compiler,
this patch switches to forwarding the CudaToolChain sanitizer support to
the host toolchain rather than explicitly whitelisting address
sanitization.

Thanks to hfinkel for this suggestion.

Reviewers: jlebar

Subscribers: hfinkel, cfe-commits

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

llvm-svn: 288512
2016-12-02 17:32:18 +00:00
Eric Liu 964782adbb [ClangFormat] Only insert #include into the #include block in the beginning of the file.
Summary:
This avoid inserting #include into:
- raw string literals containing #include.
- #if block.
- Special #include among declarations (e.g. functions).

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 288493
2016-12-02 11:01:43 +00:00
Alex Lorenz 8c1b5c9ea9 [Frontend] Fix an issue where a quoted search path is incorrectly
removed as a duplicate header search path

The commit r126167 started passing the First index into RemoveDuplicates, but
forgot to update 0 to First in the loop that looks for the duplicate. This
resulted in a bug where an -iquoted search path was incorrectly removed if you
passed in the same path into -iquote and more than one time into -isystem.

rdar://23991350

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

llvm-svn: 288491
2016-12-02 09:51:51 +00:00
NAKAMURA Takumi 91a5fa1b6f clang/test/Driver/defsym.s: Appease targeting msc. It is incapable of external assembler in trunk.
llvm-svn: 288478
2016-12-02 05:09:21 +00:00
Jason Henline 13bba6966f [CUDA] Fix faulty test from rL288448
Summary:
The test introduced by rL288448 is currently failing because
unimportant but unexpected errors appear as output from a test compile
line. This patch looks for a more specific error message, in order to
avoid false positives.

Reviewers: jlebar

Subscribers: cfe-commits

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

Switch to more specific error

llvm-svn: 288453
2016-12-02 02:04:43 +00:00
Richard Smith 6cc02c2fcd p0012r1: define corresponding feature test macro
llvm-svn: 288452
2016-12-02 02:02:23 +00:00
Richard Smith 444e6f3d82 Recover better from an incompatible .pcm file being provided by -fmodule-file=.
We try to include the headers of the module textually in this case, still
enforcing the modules semantic rules. In order to make that work, we need to
still track that we're entering and leaving the module. Also, if the module was
also marked as unavailable (perhaps because it was missing a file), we
shouldn't mark the module unavailable -- we don't need the module to be
complete if we're going to enter it textually.

llvm-svn: 288449
2016-12-02 01:52:28 +00:00
Jason Henline c3e24403f0 [CUDA] "Support" ASAN arguments in CudaToolChain
This fixes a bug that was introduced in rL287285. The bug made it
illegal to pass -fsanitize=address during CUDA compilation because the
CudaToolChain class was switched from deriving from the Linux toolchain
class to deriving directly from the ToolChain toolchain class. When
CudaToolChain derived from Linux, it used Linux's getSupportedSanitizers
method, and that method allowed ASAN, but when it switched to deriving
directly from ToolChain, it inherited a getSupportedSanitizers method
that didn't allow for ASAN.

This patch fixes that bug by creating a getSupportedSanitizers method
for CudaToolChain that supports ASAN.

This patch also fixes the test that checks that -fsanitize=address is
passed correctly for CUDA builds. That test didn't used to notice if an
error message was emitted, and that's why it didn't catch this bug when
it was first introduced. With the fix from this patch, that test will
now catch any similar bug in the future.

llvm-svn: 288448
2016-12-02 01:42:54 +00:00
Dan Gohman d0eed81dc0 [WebAssembly] Add an -mdirect flag for the direct wasm object feature.
Add a target flag for enabling the new direct wasm object emission
feature.

llvm-svn: 288447
2016-12-02 01:12:40 +00:00
Jonathan Roelofs 28b9668db3 Delete tautological assertion.
After r256463, both the LHS and RHS now refer to the same variable. Before,
they referred to the member, the parameter respectively. Now GCC6's
-Wtautological-compare complains.

llvm-svn: 288444
2016-12-02 00:51:58 +00:00
John McCall 8986361fa1 Struct GEPs must use i32, not whatever size_t is. It should be safe
to do this unconditionally, given that the indices will always be small
constant integers anyway.

llvm-svn: 288440
2016-12-01 23:51:30 +00:00
Argyrios Kyrtzidis 5dda1128f1 [libclang] Add APIs to check the result of an integer expression in CXEvalResult without overflow
Patch by Emilio Cobos Álvarez!
See https://reviews.llvm.org/D26788

llvm-svn: 288438
2016-12-01 23:41:27 +00:00
Joerg Sonnenberger 399aea300f Extend CompilationDatabase by a field for the output filename
In bigger projects like an Operating System, the same source code is
often compiled in slightly different ways. This could be the difference
between PIC and non-PIC code for static vs dynamic libraries, it could
also be the difference between size optimised versions of tools for
ramdisk images. At the moment, the compilation database has no way to
distinguish such cases. As first step, add a field in the JSON format
for it and process it accordingly.

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

llvm-svn: 288436
2016-12-01 23:37:45 +00:00
George Burgess IV bf1a70f1c9 Add a space in a run line. NFC.
llvm-svn: 288414
2016-12-01 20:16:56 +00:00
Artem Belevich 5fb9b5e1c9 Send compiler output to /dev/null in defsym.s test.
Fixes test failures if tests are run in a read-only source tree.

llvm-svn: 288406
2016-12-01 19:34:35 +00:00
Akira Hatanaka 6c299ca6e7 [CodeGen][ARM] Make sure the value and type used to create a bitcast
have the same size.

This fixes an asset that is triggered when an address of a boolean
variable is passed to __builtin_arm_ldrex or __builtin_arm_strex.

rdar://problem/29269006

llvm-svn: 288404
2016-12-01 19:25:14 +00:00
Mandeep Singh Grang 358faec6ab [clang] Implement support for -defsym assembler option
Summary:
Adds support for -Wa,-defsym,abc=1 option.

Related llvm patch: https://reviews.llvm.org/D26214

Reviewers: rafael, t.p.northover, colinl, echristo, compnerd, rengolin

Subscribers: mehdi_amini

Tags: #clang-c

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

llvm-svn: 288397
2016-12-01 18:42:16 +00:00
Arnold Schwaighofer b0f2c33920 swiftcc: Add an api to query whether a target ABI stores swifterror in a register
llvm-svn: 288394
2016-12-01 18:07:38 +00:00
Hans Wennborg 043d9e369f Fix VS2015 build of clang-format-vsix by using NuGet to pull in required assemblies
Also added a gitignore to help track the right items to commit.

Patch by Antonio Maiorano <amaiorano@gmail.com>!

llvm-svn: 288393
2016-12-01 18:05:41 +00:00
George Burgess IV 8a36ace5b1 [TableGen] Ignore fake args for parsing-related arg counts.
We should complain about the following:

```
void foo() __attribute__((unavailable("a", "b")));
```

Instead, we currently just ignore "b". (...We also end up ignoring "a",
because we assume elsewhere that this attribute can only have 1 or 0
args.)

This happens because `unavailable` has a fake enum arg, and
`AttributeList::{getMinArgs,getMaxArgs}` include fake args in their
counts.

llvm-svn: 288388
2016-12-01 17:52:39 +00:00
Dominic Chen 1a154e082c [analyzer] Drop explicit mention of range constraint solver
Summary: The basic constraint solver was dropped in rL162384, leaving the range constraint solver as the default and only constraint solver. Explicitly specifying it is unnecessary, and makes it difficult to test with other solver backends.

Reviewers: zaks.anna, dcoughlin

Subscribers: cfe-commits

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

llvm-svn: 288372
2016-12-01 17:06:39 +00:00
Manuel Klimek a37e110def Adds hasUnqualifiedDesugaredType to allow matching through type sugar.
Differential Revision: https://reviews.llvm.org/D27207

llvm-svn: 288366
2016-12-01 15:45:06 +00:00
Alex Lorenz a589abc353 [ObjC] Avoid a @try/@finally/@autoreleasepool fixit when parsing an expression
This patch ensures that the typo fixit for the @try/@finally/@autoreleasepool {}
directive is shown only when we're parsing an actual statement where such
directives can actually be present.

rdar://19669565

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

llvm-svn: 288334
2016-12-01 12:14:38 +00:00
Joey Gouly e3c85de6df [OpenCL] Refactor read_only/write_only pipes.
This adds the access qualifier to the Pipe Type, rather than using a class
hierarchy. 

It also fixes mergeTypes for Pipes, by disallowing merges. Only identical
pipe types can be merged. The test case in invalid-pipes-cl2.0.cl is added
to check that.

llvm-svn: 288332
2016-12-01 11:30:49 +00:00
Florian Hahn 15be03a922 Fix crash with unsupported architectures in Linux/Gnu target triples.
Summary: This patch adds a check and an error message to gnutools::Linker::ConstructJob in case the architecture is not supported. For most other operating systems, the error message is created in lib/Basic/Targets.cpp:AllocateTarget, but when construction the linker arguments for the gnutools linker a supported architecture is required.

Reviewers: rafael, joerg, echristo

Subscribers: mehdi_amini, joerg, dschuff, cfe-commits

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

llvm-svn: 288327
2016-12-01 11:02:59 +00:00
John McCall e5f23fb9ea Teach ConstantBuilder how to emit a reference to the current position
that will be filled in when the initializer is set.

llvm-svn: 288313
2016-12-01 05:33:30 +00:00
Richard Smith a7d9378761 P0012R1: add Itanium ABI support for throwing non-noexcept function pointers and catching as noexcept.
llvm-svn: 288305
2016-12-01 03:32:42 +00:00
Richard Smith b17d6fa5b3 Revert r285664, cxx-abi-dev chose to go in a different direction for the ABI here.
llvm-svn: 288304
2016-12-01 03:04:07 +00:00
Richard Smith baa4783d31 PR31081: ignore exception specifications when deducing function template
arguments from a declaration; despite what the standard says, this form of
deduction should not be considering exception specifications.

llvm-svn: 288301
2016-12-01 02:11:49 +00:00
George Burgess IV 1881a573e9 [TableGen] Minor clean-ups. NFC.
Primarily: try to use DenseSet<StringRef> instead of
std::set<std::string>, and use pretty range algos where we can.

Small sizes were arbitrarily chosen.

llvm-svn: 288297
2016-12-01 00:13:18 +00:00
John McCall dba63a7e5c Clean up CGObjCMac's APIs for deriving class references. NFC.
llvm-svn: 288295
2016-11-30 23:54:50 +00:00
Kelvin Li 579e41ced2 [OpenMP] Sema and parsing for 'teams distribute parallel for simd' pragma
This patch is to implement sema and parsing for 'teams distribute parallel for simd' pragma.

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

llvm-svn: 288294
2016-11-30 23:51:03 +00:00
John McCall d195d4c520 Introduce a type-safe enum for ForDefinition.
llvm-svn: 288289
2016-11-30 23:25:13 +00:00
John McCall cd21d54139 Fix some layering violations where CGObjCMac's NSString emission was
performed at the CodeGenModule level.

Would be NFC except we now also use a different uniquing structure so
that we don't get spurious conflicts if you ask for both an NSString
and a CFString for the same content (which is possible with builtins).

llvm-svn: 288287
2016-11-30 23:15:55 +00:00
John McCall f00e2c09be Prospective MSVC workaround.
llvm-svn: 288272
2016-11-30 20:46:55 +00:00
John McCall ecee86faa1 Finish adopting ConstantInitBuilder in CGObjCGNU. NFC.
llvm-svn: 288269
2016-11-30 20:19:46 +00:00
Akira Hatanaka 21e5fdd89e [Sema] Teach -Wcast-align to look at the aligned attribute of the
declared variables.

Teach Sema to check the aligned attribute attached to variable
declarations so that it doesn't issue spurious warnings.

rdar://problem/26517471

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

llvm-svn: 288267
2016-11-30 19:42:03 +00:00
Artem Dergachev 28ee2d1b09 [analyzer] Construct temporary objects of correct types, destroy them properly.
When constructing a temporary object region, which represents the result of
MaterializeTemporaryExpr, track down the sub-expression for which the temporary
is necessary with a trick similar to the approach used in CodeGen, namely
by using Expr::skipRValueSubobjectAdjustments().

Then, create the temporary object region with type of that sub-expression.
That type would propagate further in a path-sensitive manner.

During destruction of lifetime-extened temporaries, consult the type of
the temporary object region, rather than the type of the lifetime-extending
variable, in order to call the correct destructor (fixes pr17001) and,
at least, not to crash by trying to call a destructor of a plain type
(fixes pr19539).

rdar://problem/29131302
rdar://problem/29131576

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

llvm-svn: 288263
2016-11-30 19:02:44 +00:00
Artem Dergachev 7b75e3266c [analyzer] SValExplainer: Support ObjC ivars and __block variables.
Additionally, explain the difference between normal and heap-based
symbolic regions.

llvm-svn: 288260
2016-11-30 18:26:43 +00:00
Artem Dergachev 30ed5467a4 [analyzer] Minor fixes and improvements to debug.ExprInspection
- Fix the bug with transition handling in ExprInspectionChecker's
  checkDeadSymbols implementation.

- Test this bug by adding a new function clang_analyzer_numTimesReached() to
  catch number of passes through the code, which should be handy for testing
  against unintended state splits.

- Add two more functions should help debugging issues quickly without running
  the debugger or dumping exploded graphs - clang_analyzer_dump() which dump()s
  an SVal argument to a warning message, and clang_analyzer_printState(), which
  dump()s the current program state to stderr.

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

llvm-svn: 288257
2016-11-30 17:57:18 +00:00
John McCall c4ae1dd193 Prospective GCC build fix: the unelaborated form of this friend
declaration should find the right type, assuming it's supported
evenly across all our hosts.

llvm-svn: 288231
2016-11-30 04:18:19 +00:00
Bob Haarman 2fae56fce4 make -fprofile-instr-generate and -fprofile-instr-use work with clang-cl
Summary: Makes -fprofile-instr-generate and -fprofile-instr-use work
with clang-cl so that profile-guided optimization can be used.

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

llvm-svn: 288230
2016-11-30 03:25:36 +00:00
John McCall 176f892fa7 Switch CGObjCMac to use ConstantInitBuilder. Whew.
Not strictly NFC because I did change the order of emission of
some global constants, but it shouldn't make any difference.

llvm-svn: 288229
2016-11-30 02:39:18 +00:00
Reid Kleckner 68c4bb5dda Fix -Winconsistent-missing-override in CodeGenAction.cpp
llvm-svn: 288227
2016-11-30 01:32:53 +00:00
Hans Wennborg 86bd29afda Fix formatting issue from r288207
llvm-svn: 288223
2016-11-30 00:31:39 +00:00
Reid Kleckner 6fd35373ea Give this test that uses Itanium mangling a triple
llvm-svn: 288222
2016-11-30 00:31:16 +00:00
Reid Kleckner 15241ba4dd Stop handling interesting deserialized decls after HandleTranslationUnit
Other AST consumers can deserialize interesting decls that we might
codegen, but they won't make it to the final object file and can trigger
assertions in debug information generation after finalization.

llvm-svn: 288221
2016-11-30 00:25:36 +00:00
Richard Smith 13b40bcc03 [c++1z] Improve support for -fno-exceptions: we can't just ignore exception
specifications in this mode in C++17, since they're part of the function type,
so check and diagnose them like we would if exceptions were enabled.

Better ideas welcome.

llvm-svn: 288220
2016-11-30 00:13:55 +00:00
Eugene Zelenko 58ab22fe48 Fix some Clang-tidy and Include What You Use warnings; other minor fixes (NFC).
This preparation to remove SetVector.h dependency on SmallSet.h.

llvm-svn: 288213
2016-11-29 22:44:24 +00:00
Richard Smith 6564006a38 [c++1z] PR31210: ignore exception specification when matching the type of a
builtin with the type of an explicit declaration of the same function.

llvm-svn: 288208
2016-11-29 22:32:05 +00:00
Hans Wennborg a6714922d1 Don't try to merge DLL attributes on redeclaration of invalid decl (PR31069)
llvm-svn: 288207
2016-11-29 22:31:00 +00:00
John McCall 843dfccdc5 getObjCEncodingForMethodDecl cannot fail. Simplify. NFC.
llvm-svn: 288203
2016-11-29 21:57:00 +00:00
Reid Kleckner aab2aae8ee Don't declare IsEnumDeclComplete as extern
Otherwise MSVC and clang-cl will see "extern inline" after merging
redeclarations and emit it in all TUs that include Type.h and Decl.h.

Noticed by inspection, since it's always the first thing to get emitted.

llvm-svn: 288197
2016-11-29 20:46:24 +00:00
Richard Smith 8110c9df22 Support constant expression evaluation for wchar_t versions of simple string
functions, in order to support constexpr std::char_traits<wchar_t>.

llvm-svn: 288193
2016-11-29 19:45:17 +00:00
Anastasia Stulova e4a1c38109 [OpenCL] Prevent generation of globals in non-constant AS for OpenCL.
Avoid using shortcut for const qualified non-constant address space
aggregate variables while generating them on the stack such that
the alloca object is used instead of a global variable containing
initializer.

Review: https://reviews.llvm.org/D27109
llvm-svn: 288163
2016-11-29 17:01:19 +00:00
Benjamin Kramer 7fff35479c [AST] Use static_assert to verify types instead of undefined classes.
No functionliaty change intended.

llvm-svn: 288133
2016-11-29 12:41:21 +00:00
Alexey Bader c211c6c884 [OpenCL] Prohibit using reserve_id_t in program scope.
Patch by Egor Churaev (echuraev).

Reviewers: Anastasia

Subscribers: cfe-commits, yaxunl, bader

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

llvm-svn: 288126
2016-11-29 10:21:40 +00:00
Krasimir Georgiev bba2d59ea4 Removed DEBUG_TYPE from TokenAnalyzer.h
Summary:
Defining DEBUG_TYPE in a header file doesn't make sense.
It is already defined in the corresponding source file.

Reviewers: klimek, ioeric

Subscribers: klimek

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

llvm-svn: 288125
2016-11-29 10:21:28 +00:00
Yaron Keren 633e14aa42 Correct comment: we are creating a canonicla decltypetype.
llvm-svn: 288124
2016-11-29 10:08:20 +00:00
Daniel Jasper e98e58111b clang-format: [JS] Properly format dict literals that skip labels.
llvm-svn: 288121
2016-11-29 09:40:36 +00:00
Daniel Jasper 22ed262c23 clang-format: Wrap complex binary expressions on the RHS of a comma.
Specifically, if the RHS of a comma is a complex binary expression and
spans multiple lines, insert a line break before it. This usually is
often more readable compared to producing a hanging indent. See changes
in FormatTest.cpp for examples.

llvm-svn: 288120
2016-11-29 09:40:32 +00:00
Daniel Jasper 35e4122f48 clang-format: Fix unnnecessary line break.
Before:
  aaaaaaaaaa(aaaa(aaaa,
		  aaaa), //
	     aaaa,
             aaaaa);

After:
  aaaaaaaaaa(aaaa(aaaa,
		  aaaa), //
	     aaaa, aaaaa);

llvm-svn: 288119
2016-11-29 09:40:01 +00:00
Richard Smith 9bb192ed99 Add a warning for 'main' returning 'true' or 'false'.
Patch by Joshua Hurwitz!

llvm-svn: 288097
2016-11-29 01:35:17 +00:00
Reid Kleckner fec0f32ea9 Use ${:uid} to generate unique MS asm labels, not {:uid}
llvm-svn: 288093
2016-11-29 00:39:37 +00:00
Reid Kleckner 9e749f6636 Avoid lambdas in default member initializers to work around clang bug
On Windows, Clang is mangling lambdas in default member initializers
incorrectly. See PR31197.

This is causing redness on the self-host bots. Work around the problem
locally so we aren't blind to further issues.

llvm-svn: 288089
2016-11-28 23:58:04 +00:00
Peter Collingbourne b367c567d9 IRGen: Remove all uses of CreateDefaultAlignedLoad.
Differential Revision: https://reviews.llvm.org/D27157

llvm-svn: 288083
2016-11-28 22:30:21 +00:00
John McCall 9c6cb7642e Make CGVTables use ConstantInitBuilder. NFC.
llvm-svn: 288081
2016-11-28 22:18:33 +00:00
John McCall f1788639c5 Hide the result of building a constant initializer. NFC.
llvm-svn: 288080
2016-11-28 22:18:30 +00:00
John McCall 23c9dc6585 ConstantBuilder -> ConstantInitBuilder for clarity, and
move the member classes up to top level to allow forward
declarations to name them.  NFC.

llvm-svn: 288079
2016-11-28 22:18:27 +00:00
Michal Gorny 593970f1a7 [Driver] Add unit tests for Distro detection
Add a set of unit tests for the distro detection code. The tests use an
in-memory virtual filesystems resembling release files for various
distributions supported. All release files are provided (not only the
ones directly used) in order to guarantee that one of the rules will not
mistakenly recognize the distribution incorrectly due to the additional
files (e.g. Ubuntu as Debian).

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

llvm-svn: 288062
2016-11-28 21:11:22 +00:00
Michal Gorny 047e099a2e [Driver] Fix recognizing newer OpenSUSE versions
Fix recognizing newer OpenSUSE versions that combine the two version
components into 'VERSION = x.y'. The check was written against an older
version that kept those two split as VERSION and PATCHLEVEL.

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

llvm-svn: 288061
2016-11-28 21:11:18 +00:00
Michal Gorny 67e199eb32 [Driver] Refactor distro detection & classification as a separate API
Refactor the Distro enum along with helper functions into a full-fledged
Distro class, inspired by llvm::Triple, and make it a public API.
The new class wraps the enum with necessary comparison operators, adding
the convenience Is*() methods and a constructor performing
the detection. The public API is needed to run the unit tests (D25869).

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

llvm-svn: 288060
2016-11-28 21:11:14 +00:00
Reid Kleckner 08ebbcebb9 [MS] Mangle a unique ID into all MS inline asm labels
This solves PR23715 in a way that is compatible with LTO.

MSVC supports jumping to source-level labels and between inline asm
blocks, but we don't.

Also revert the old solution, r255201, which was to mark these calls as
noduplicate.

llvm-svn: 288059
2016-11-28 20:52:19 +00:00
Alexey Bataev 7fcacd8e0e [OPENMP] Fix for PR31137: Wrong DSA for members in struct.
If member expression is used in the task region and the base expression
is a DeclRefExp and the variable used in this ref expression is private,
it should be marked as implicitly firstprivate inside this region. Patch
fixes this issue.

llvm-svn: 288039
2016-11-28 15:55:15 +00:00
Malcolm Parsons 57ae857548 [Sema] Set range end of constructors and destructors in template instantiations
Summary:
clang-tidy checks frequently use source ranges of functions.
The source range of constructors and destructors in template instantiations
is currently a single token.
The factory method for constructors and destructors does not allow the
end source location to be specified.
Set end location manually after creating instantiation.

Reviewers: aaron.ballman, rsmith, arphaman

Subscribers: arphaman, cfe-commits

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

llvm-svn: 288025
2016-11-28 11:11:34 +00:00
Hal Finkel fec8345108 Adjust type-trait evaluation to properly handle Using(Shadow)Decls
Since r274049, for an inheriting constructor declaration, the name of the using
declaration (and using shadow declaration comes from the using declaration) is
the name of a derived class, not the base class (line 8225-8232 of
lib/Sema/SemaDeclCXX.cpp in https://reviews.llvm.org/rL274049). Because of
this, name-based lookup performed inside Sema::LookupConstructors returns not
only CXXConstructorDecls but also Using(Shadow)Decls, which results assertion
failure reported in PR29087.

Patch by Taewook Oh, thanks!

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

llvm-svn: 287999
2016-11-27 16:26:14 +00:00
Ekaterina Romanova 4c77e8940e [DOXYGEN] Updated instruction names corresponding to avxintrin.h intrinsics.
Documentation for some of the avxintrin.h's intrinsics errorneously said that
non VEX-prefixed instructions could be generated. This was fixed.

I tried several different solutions to achieve pretty printing of unordered lists (nested and non-nested) in param sections in doxygen. 

llvm-svn: 287990
2016-11-26 19:38:19 +00:00
Joerg Sonnenberger 92d91569a1 Typo.
llvm-svn: 287947
2016-11-25 20:15:57 +00:00
Eric Liu 6135581cdf Do not do raw name replacement when FromDecl is a class forward-declaration.
Summary:
If the `FromDecl` is a class forward declaration, the reference is
still considered as referring to the original definition given the nature
of forward-declarations, so we can't do a raw name replacement in this case.

Reviewers: bkramer

Subscribers: cfe-commits, klimek

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

llvm-svn: 287929
2016-11-25 16:02:49 +00:00
Joerg Sonnenberger c937970175 Document the arguments form of commands.
llvm-svn: 287926
2016-11-25 14:14:43 +00:00
Eric Liu eddec09ee4 Consider nested namespaces in the canonical namespace as canonical as well.
Summary:
For example, this case was missed when looking for different but canonical
namespaces. UseContext in this case should be considered as in the canonical
namespace.
```
namespace a { namespace b { <FromContext> } }
namespace a { namespace b { namespace c { <UseContext> } } }
```
Added some commenting.

Reviewers: bkramer

Subscribers: klimek, cfe-commits

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

llvm-svn: 287924
2016-11-25 12:39:03 +00:00
Benjamin Kramer 81cb4b7103 [CodeGen] Pass objects that are expensive to copy by const ref.
No functionality change. Found by clang-tidy's
performance-unnecessary-value-param.

llvm-svn: 287894
2016-11-24 16:01:20 +00:00
Benjamin Kramer ebac56ebb0 [Format] Avoid copying std::sets and simplify code a bit.
No functional change.

llvm-svn: 287892
2016-11-24 15:42:29 +00:00
Benjamin Kramer 6ca15b6114 [Sema] Pass APSInts by const ref, avoiding copies.
No functionality change intended. Fix by clang-tidy's
performance-unnecessary-value-param check.

llvm-svn: 287890
2016-11-24 15:36:17 +00:00
Ehsan Amiri 85f5bfcf0d [PPC] support for arithmetic builtins in the FE
(commit again after fixing the buildbot failures)
This adds various overloads of the following builtins to altivec.h:

    vec_neg
    vec_nabs
    vec_adde
    vec_addec
    vec_sube
    vec_subec
    vec_subc

Note that for vec_sub builtins on 32 bit integers, the semantics is similar to
what ISA describes for instructions like vsubecuq that work on quadwords: the
first operand is added to the one's complement of the second operand. (As
opposed to two's complement which I expected).

llvm-svn: 287872
2016-11-24 12:40:04 +00:00
Benjamin Kramer 60a53d5e16 [ASTDumper] Add some more character escapes for convenience.
llvm-svn: 287859
2016-11-24 09:41:33 +00:00
Kelvin Li 2bfddcec19 Remove comments (NFC)
Differential Revision: https://reviews.llvm.org/D27006

llvm-svn: 287852
2016-11-24 03:18:07 +00:00
Douglas Yung 31ec97aaa1 Make these tests work more reliably with Release builds.
Differential Revision: https://reviews.llvm.org/D26827

llvm-svn: 287851
2016-11-24 01:53:38 +00:00
Joerg Sonnenberger 7ed9d1a0ce Spelling.
llvm-svn: 287847
2016-11-24 01:24:38 +00:00
Ehsan Amiri 9cce1ee88c [PPC] revert r287795
A test that passed locally is failing on one of the build bots.

llvm-svn: 287796
2016-11-23 18:55:17 +00:00
Ehsan Amiri 9b91cfa0b0 [PPC] support for arithmetic builtins in the FE
(commit again after fixing the buildbot failures)
This adds various overloads of the following builtins to altivec.h:

    vec_neg
    vec_nabs
    vec_adde
    vec_addec
    vec_sube
    vec_subec
    vec_subc

Note that for vec_sub builtins on 32 bit integers, the semantics is similar to
what ISA describes for instructions like vsubecuq that work on quadwords: the
first operand is added to the one's complement of the second operand. (As
opposed to two's complement which I expected).

llvm-svn: 287795
2016-11-23 18:36:29 +00:00
Reid Kleckner 98c80572f2 Add dllexport default ctor closure PCH regression test for PR31121
Follow up to r287774

llvm-svn: 287793
2016-11-23 18:33:54 +00:00
Alex Lorenz 675221589e [Sema][Atomics] Treat expected pointer in compare exchange atomics as _Nonnull
This commit teaches clang that is has to emit a warning when NULL is passed
as the 'expected' pointer parameter into an atomic compare exchange call.

rdar://18926650

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

llvm-svn: 287776
2016-11-23 16:57:03 +00:00
Ehsan Amiri ac10595b0d [PPC] Reverting r287772
Due to buildbot failure, I revert. Will recommit after investigation.

llvm-svn: 287775
2016-11-23 16:56:03 +00:00
Reid Kleckner c01ee7505a Remove C++ default arg side table for MS ABI ctor closures
Summary:
We don't need a side table in ASTContext to hold CXXDefaultArgExprs. The
important part of building the CXXDefaultArgExprs was to ODR use the
default argument expressions, not to make AST nodes. Refactor the code
to only check the default argument, and remove the side table in
ASTContext which wasn't being serialized.

Fixes PR31121

Reviewers: thakis, rsmith, majnemer

Subscribers: cfe-commits

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

llvm-svn: 287774
2016-11-23 16:51:30 +00:00
Ehsan Amiri 5ea1054dab [PPC] support for arithmetic builtins in the FE
This adds various overloads of the following builtins to altivec.h:

    vec_neg
    vec_nabs
    vec_adde
    vec_addec
    vec_sube
    vec_subec
    vec_subc

Note that for vec_sub builtins on 32 bit integers, the semantics is similar to
what ISA describes for instructions like vsubecuq that work on quadwords: the
first operand is added to the one's complement of the second operand. (As
opposed to two's complement which I expected).

llvm-svn: 287772
2016-11-23 16:32:05 +00:00
Alex Lorenz 01bcfc1414 [CodeCompletion] Fix incorrect Objective-C block parameter formatting
This commit fixes an incorrectly formatted Objective-C block parameter
placeholder in a code completion result. The incorrect parameter had a
redundant leading parenthesis.

rdar://25224416

llvm-svn: 287771
2016-11-23 16:28:34 +00:00
Gabor Horvath 0866c2f5d4 [ASTImporter] Added ability to import AtomicType nodes
Patch by: Kareem Khazem

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

llvm-svn: 287763
2016-11-23 15:24:23 +00:00
Simon Pilgrim b243bbc87d [X86][AVX512VL] Add missing _mm256_maskz_alignr_epi64 shufflevector check
Missed in rL287733

llvm-svn: 287755
2016-11-23 11:38:52 +00:00
Benjamin Kramer 630cf8c2a3 [CodeGen] Simplify code. No functionality change intended.
llvm-svn: 287754
2016-11-23 11:20:27 +00:00
Craig Topper 6aefe00ccf [X86] Replace valignd/q builtins with appropriate __builtin_shufflevector.
llvm-svn: 287733
2016-11-23 01:47:12 +00:00
Richard Smith 8dbc6b2617 Make diagnostic for use of default member initializer before enclosing class is
complete a little more general; it is produced in other cases than the one that
it previously talked about.

llvm-svn: 287713
2016-11-22 22:55:12 +00:00
John McCall df8580f0fe Remove variable only used in an assertion.
llvm-svn: 287691
2016-11-22 20:12:32 +00:00
Marcin Koscielnicki 069dd06592 Add test for D21736.
Differential Revision: http://reviews.llvm.org/D21741

llvm-svn: 287689
2016-11-22 20:03:40 +00:00
Marcin Koscielnicki 9a063e7c02 [CodeGen] Insert TargetLibraryInfoWrapperPass before anything else.
Currently, TargetLibraryInfoWrapperPass is inserted by PMBuilder.
However, some passes are inserted manually before the PMBuilder
ones - if any of them happens to use TargetLibraryInfoWrapperPass,
it'll get a default-constructed one, with an unknown target triple.
This happens to InstrProfiling in D21736, breaking it.

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

llvm-svn: 287688
2016-11-22 20:03:35 +00:00
Nico Weber 9b3baaa74a darwin: Unconditionally pass -lto_library, remove -Wliblto warning.
https://reviews.llvm.org/D25932 made it so that clang always checks if
libLTO.dylib is present on disk, even if -flto is not being used. The
motivation for that change was that if a dependency happens to contain bitcode,
ld64 will try to load libLTO without -flto explicitly being enabled. However,
the change had the undesirable side effect of warning if libLTO.dylib doesn't
exist even if it isn't needed.

Change things so that -lto_library is always passes, independent of if it
exists or not. ld64 only looks at this flag if it uses LTO. If the dylib
exists, all is well. If it doesn't, and LTO is not being used, all is well too.
If ld64 does end up using LTO and the dylib does not exist, ld64 will print
something like

    ld: could not process llvm bitcode object file, because foo/libLTO.dylib could not be loaded file 'test.o' for architecture x86_64

https://reviews.llvm.org/D26984

llvm-svn: 287685
2016-11-22 19:38:07 +00:00
Eric Liu e86a5f4c65 Make llvm::Error generated from replacement interfaces more specific.
Summary:
The new error information contains the type of error (e.g. overlap or bad file path)
and the replacement(s) that is causing the error. This enables us to resolve some errors.
For example, for insertion at the same location conflict, we need to know the
existing replacement which conflicts with the new replacement in order to calculate
the new position to be insert before/after the existing replacement (for merging).

Reviewers: klimek, bkramer

Subscribers: djasper, cfe-commits

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

llvm-svn: 287639
2016-11-22 13:46:42 +00:00
Axel Naumann b920aa0fae Missing initializer.
llvm-svn: 287633
2016-11-22 10:00:23 +00:00
Adam Nemet 43018fdbe5 Rename option to -lto-pass-remarks-output
The new option -pass-remarks-output broke LLVM_LINK_LLVM_DYLIB because
of the duplicate option name with opt.

llvm-svn: 287628
2016-11-22 07:35:19 +00:00
Artem Dergachev 22e28f4078 [analyzer] Fix a crash on accessing a field within a literal-initialized union.
Because in case of unions we currently default-bind compound values in the
store, this quick fix avoids the crash for this case.

Patch by Ilya Palachev and independently by Alexander Shaposhnikov!

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

llvm-svn: 287618
2016-11-22 04:29:23 +00:00
Peter Collingbourne bad8e511d9 Fix -Asserts build, and add some more test cases.
llvm-svn: 287602
2016-11-22 00:43:30 +00:00
Peter Collingbourne 120eb54422 Sema, CodeGen: Ensure that an implicit copy ctor is available more often under the Microsoft C++ ABI.
This is needed because whether the constructor is deleted can control whether
we pass structs by value directly.

To fix this properly we probably want a more direct way for CodeGen to ask
whether the constructor was deleted.

Fixes PR31049.

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

llvm-svn: 287600
2016-11-22 00:21:43 +00:00
Richard Smith 5a2e6b97f7 Indicate in AST dump whether special member functions are defaulted and trivial.
llvm-svn: 287599
2016-11-21 23:43:54 +00:00
Alex Lorenz ff6c34b30d [ObjC] Prevent infinite loops when iterating over redeclaration
of a method that was declared in an invalid interface

This commit fixes an infinite loop that occurs when clang tries to iterate over
redeclaration of a method that was declared in an invalid @interface. The
existing validity checks don't catch this as that @interface is a duplicate of
a previously declared valid @interface declaration, so we have to verify that
the found redeclaration is in a valid declaration context.

rdar://29220965

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

llvm-svn: 287530
2016-11-21 11:16:30 +00:00
Alex Lorenz 9229d332bf [Frontend] Add a predefined macro that describes the Objective-C bool type
This commit adds a new predefined macro named __OBJC_BOOL_IS_BOOL that describes
the Objective-C boolean type: its value is zero if the Objective-C boolean uses
the signed character type, otherwise its value is one as the Objective-C boolean
uses the builtin boolean type.

rdar://21170440

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

llvm-svn: 287529
2016-11-21 11:05:15 +00:00
Dean Michael Berris 3abce99b67 [XRay] Support AArch64 in Clang
This patch adds XRay support in Clang for AArch64 target.
This patch is one of a series:

LLVM: https://reviews.llvm.org/D26412
compiler-rt: https://reviews.llvm.org/D26413

Author: rSerge

Reviewers: rengolin, dberris

Subscribers: aemerson, cfe-commits, iid_iunknown

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

llvm-svn: 287518
2016-11-21 03:24:59 +00:00
Ekaterina Romanova bf667b21ac Add doxygen comments to immintrin.h's intrinsics.
The doxygen comments are automatically generated based on Sony's intrinsics docu
ment.

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

llvm-svn: 287483
2016-11-20 08:35:05 +00:00
Chris Bieneman c6c0f583a2 [CMake] Fixing clang standalone build
I broke this in r287406 and r287407.

llvm-svn: 287463
2016-11-19 21:14:59 +00:00
John McCall 18081afc1d Remove alignment from ctors/dtors lists in an attempt to placate LTO.
llvm-svn: 287458
2016-11-19 20:12:25 +00:00
Mehdi Amini 6f40836823 Change setDiagnosticsOutputFile to take a unique_ptr from a raw pointer (NFC)
Summary:
This makes it explicit that ownership is taken. Also replace all `new`
with make_unique<> at call sites.

Reviewers: anemet

Subscribers: llvm-commits

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

llvm-svn: 287449
2016-11-19 18:19:41 +00:00
John McCall 6c9f1fdb5c Introduce a helper class for building complex constant initializers. NFC.
I've adopted this in most of the places it makes sense, but v-tables
and CGObjCMac will need a second pass.

llvm-svn: 287437
2016-11-19 08:17:24 +00:00
Ekaterina Romanova 0a70076121 Doxygen comments for avxintrin.h.
Added doxygen comments to avxintrin.h's intrinsics. As of now, all the intrinsics in this file that were documented by Sony's intrinsics guide should have corresponding doxygen comments.

Note: The doxygen comments are automatically generated based on Sony's intrinsic
s document.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream.

Reviewed by Wolfgang Pieb.

llvm-svn: 287436
2016-11-19 04:59:08 +00:00
Peter Collingbourne 66bfcb3ea5 Sema: As of MSVC 2015, a user-declared move operation causes the deletion of both copy operations.
Differential Revision: https://reviews.llvm.org/D26868

llvm-svn: 287411
2016-11-19 00:30:56 +00:00
Akira Hatanaka f7d563c76c [Sema] Don't allow applying address-of operator to a call to a function
with __unknown_anytype return type.

When the following code is compiled, Sema infers that the type of
__unknown_anytype is double:

extern __unknown_anytype func();
double *d = (double*)&func();

This triggers an assert in CodeGenFunction::EmitCallExprLValue because
it doesn't expect to see a call to a function with a non-reference
scalar return type.

This commit prevents the assert by making VisitUnaryAddrOf error out if
the address-of operator is applied to a call to a function with
__unknown_anytype return type.

rdar://problem/20287610

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

llvm-svn: 287410
2016-11-19 00:13:03 +00:00
Chris Bieneman 73f03752b6 [CMake] clang depends on intrinsics_gen
cc1_main.cpp has the following include chain:

llvm/LinkAllPasses.h
llvm/Analysis/AliasSetTracker.h
llvm/Analysis/AliasAnalysis.h
llvm/IR/CallSite.h
llvm/IR/Attributes.h
llvm/IR/Attributes.gen

This means clang needs to depend on intrinsics_gen.

llvm-svn: 287407
2016-11-18 23:31:16 +00:00
Chris Bieneman 3d1d968f18 [CMake] clang-offload-bundler depends on intrinsics_gen
ClangOffloadBundler.cpp has the following include chain:

llvm/Bitcode/BitcodeWriter.h
llvm/IR/ModuleSummaryIndex.h
llvm/IR/Module.h
llvm/IR/Function.h
llvm/IR/Argument.h
llvm/IR/Attributes.h
llvm/IR/Attributes.gen

This means clang-offload-bundler needs to depend on intrinsics_gen.

llvm-svn: 287406
2016-11-18 23:31:14 +00:00
Konstantin Zhuravlyov 62ae8f671c [AMDGPU] Change frexp.exp builtin to return i16 for f16 input
Differential Revision: https://reviews.llvm.org/D26863

llvm-svn: 287390
2016-11-18 22:31:51 +00:00
Dominic Chen c8629bd35a [analyzer] Refactor recursive symbol reachability check to use symbol_iterator
Reviewers: zaks.anna, dcoughlin

Subscribers: cfe-commits

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

llvm-svn: 287380
2016-11-18 21:07:03 +00:00
Oleg Ranevskyy 85d93a8778 [ARM] Fix sema check of ARM special register names
Summary:
This is a simple sema check patch for arguments of `__builtin_arm_rsr` and the related builtins, which currently do not allow special registers with indexes >7.

Some of the possible register name formats these builtins accept are:
```
{c}p<coprocessor>:<op1>:c<CRn>:c<CRm>:<op2>
```
```
o0:op1:CRn:CRm:op2
```
where `op1` / `op2` are integers in the range [0, 7] and `CRn` / `CRm` are integers in the range [0, 15].

The current sema check does not allow `CRn` > 7 and accepts `op2` up to 15.

Reviewers: LukeCheeseman, rengolin

Subscribers: asl, aemerson, rengolin, cfe-commits

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

llvm-svn: 287378
2016-11-18 21:00:08 +00:00
Matthias Braun ae032b6cf5 Adapt to llvm NamedRegionTimer changes
We have to specify a name and description for the timers and groups now.

llvm-svn: 287371
2016-11-18 19:43:25 +00:00
Chris Bieneman b82f97f4bb [CMake] Fixing variable names that were mistyped
This is a silly bug that I'm sure I caused...

llvm-svn: 287366
2016-11-18 19:20:39 +00:00
Adam Nemet e4b9fd9852 LTO support for -fsave-optimization-record on Darwin
I guess this would have to be added for each linker.

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

llvm-svn: 287358
2016-11-18 18:17:36 +00:00
Adam Nemet 62ff7bab72 Fix a comment for -fsave-optimization-record
Differential Revision: https://reviews.llvm.org/D26807

llvm-svn: 287357
2016-11-18 18:17:33 +00:00
Joey Gouly 5788b783ac [OpenCL] Introduce ReadPipeType and WritePipeType.
This allows Sema to diagnose passing a read_only pipe to a
write_only pipe argument.

llvm-svn: 287343
2016-11-18 14:10:54 +00:00
Simon Pilgrim 6e91750e06 Wdocumentation fix
llvm-svn: 287335
2016-11-18 11:18:28 +00:00
Ekaterina Romanova 06b1914cb7 Add doxygen comments for lzcntintrin.h's intrinsics.
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 Charles Li.

llvm-svn: 287317
2016-11-18 06:26:01 +00:00
Craig Topper 37bf5c6a3f [AVX-512] Replace masked 16-bit element variable shift builtins with new unmasked versions and selects.
llvm-svn: 287313
2016-11-18 05:04:51 +00:00
Ekaterina Romanova 53088dd44d Add doxygen comments to fxsrintrin.h's intrinsics.
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 Paul Robinson and Charles Li.

llvm-svn: 287295
2016-11-18 01:42:01 +00:00
Justin Lebar fbe0a57604 [CUDA] Attempt to fix test failures in cuda-macos-includes.cu.
Run clang -cc1 -E instead of -S, in an attempt to make this test work
cross-platform.

llvm-svn: 287292
2016-11-18 01:11:32 +00:00
John McCall 811b291d8c Forward ns_consumed delegate arguments with a move.
StartFunction enters a release cleanup for ns_consumed arguments in
ARC, so we need to balance that somehow.  We could teach StartFunction
that it's emitting a delegating function, so that the cleanup is
unnecessary, but that would be invasive and somewhat fraught.  We could
balance the consumed argument with an extra retain, but clearing the
original variable should be easier to optimize and avoid some extra work
at -O0.  And there shouldn't be any difference as long as nothing else
uses the argument, which should always be true for the places we emit
delegate arguments.

Fixes PR 27887.

llvm-svn: 287291
2016-11-18 01:08:24 +00:00
Justin Lebar 50fe985349 [CUDA] Wrapper header changes necessary to support MacOS.
Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 287288
2016-11-18 00:41:35 +00:00
Justin Lebar d14fe8830e [CUDA] Use the right section and constant names for fatbins when compiling for macos.
Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 287287
2016-11-18 00:41:31 +00:00
Justin Lebar f91086b0a8 [CUDA] Initialize our header search using the host triple.
Summary:
This used to work because system headers are found in a (somewhat)
predictable set of locations on Linux.  But this is not the case on
MacOS; without this change, we don't look in the right places for our
headers when doing device-side compilation on Mac.

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 287286
2016-11-18 00:41:27 +00:00
Justin Lebar 66c4fd7987 [CUDA] Driver changes to support CUDA compilation on MacOS.
Summary:
Compiling CUDA device code requires us to know the host toolchain,
because CUDA device-side compiles pull in e.g. host headers.

When we only supported Linux compilation, this worked because
CudaToolChain, which is responsible for device-side CUDA compilation,
inherited from the Linux toolchain.  But in order to support MacOS,
CudaToolChain needs to take a HostToolChain pointer.

Because a CUDA toolchain now requires a host TC, we no longer will
create a CUDA toolchain from Driver::getToolChain -- you have to go
through CreateOffloadingDeviceToolChains.  I am *pretty* sure this is
correct, and that previously any attempt to create a CUDA toolchain
through getToolChain() would eventually have resulted in us throwing
"error: unsupported use of NVPTX for host compilation".

In any case hacking getToolChain to create a CUDA+host toolchain would
be wrong, because a Driver can be reused for multiple compilations,
potentially with different host TCs, and getToolChain will cache the
result, causing us to potentially use a stale host TC.

So that's the main change in this patch.

In addition, we have to pull CudaInstallationDetector out of Generic_GCC
and into a top-level class.  It's now used by the Generic_GCC and MachO
toolchains.

Reviewers: tra

Subscribers: rryan, hfinkel, sfantao

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

llvm-svn: 287285
2016-11-18 00:41:22 +00:00
Ekaterina Romanova 2174b6fe72 Minor changes in x86 intrinsics headers; NFC
I made several changes for consistency with the rest of x86 instrinsics header files. Some of these changes help to render doxygen comments better.

1. avxintrin.h –  Moved the opening bracket on a separate line for several 
                  intrinsics (for consistency with the rest of the intrinsics).

2. emmintrin.h -  Moved the doxygen comment next to the body of the function;
               -  Added braces after extern "C"  even though there is only 
                  one declaration each time

3. xmmintrin.h -  Moved the doxygen comment next to the body of the function;
               -  Added intrinsic prototypes for a couple of macro definitions
                  into the doxygen comment;
               -  Added braces after extern "C"  even though there is only one
                  declaration each time

4. ammintrin.h –  Removed extra line between the doxygen comment and the body
                  of the functions (for consistency with the rest of the files).

Desk reviewed by Paul Robinson.

llvm-svn: 287278
2016-11-17 23:02:00 +00:00
Bruno Cardoso Lopes 6fa3b742e0 [Preprocessor] Support for '-dI' flag
Re-introduce r285411.

Implement the -dI as supported by GCC: Output ‘#include’ directives in addition
to the result of preprocessing.

This change aims to add this option, pass it through to the preprocessor via
the options class, and when inclusions occur we output some information (+ test
cases).

Patch by Steve O'Brien!

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

llvm-svn: 287275
2016-11-17 22:45:31 +00:00
Bruno Cardoso Lopes 02681c4af6 [CrashReproducer][Darwin] Suggest attaching .crash diagnostic file
In addition to the preprocessed sources file and reproducer script, also
point to the .crash diagnostic files on Darwin. Example:

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-4.0: note: diagnostic msg: /var/folders/bk/1hj20g8j4xvdj5gd25ywhd3m0000gq/T/RegAllocGreedy-238f28.cpp
clang-4.0: note: diagnostic msg: /var/folders/bk/1hj20g8j4xvdj5gd25ywhd3m0000gq/T/RegAllocGreedy-238f28.cache
clang-4.0: note: diagnostic msg: /var/folders/bk/1hj20g8j4xvdj5gd25ywhd3m0000gq/T/RegAllocGreedy-238f28.sh
clang-4.0: note: diagnostic msg: /var/folders/bk/1hj20g8j4xvdj5gd25ywhd3m0000gq/T/RegAllocGreedy-238f28.crash

When no match is found for the .crash, point the user to a directory
where those can be found. Example:

clang-4.0: note: diagnostic msg: Crash backtrace is located in
clang-4.0: note: diagnostic msg: /Users/bruno/Library/Logs/DiagnosticReports/clang-4.0_<YYYY-MM-DD-HHMMSS>_<hostname>.crash
clang-4.0: note: diagnostic msg: (choose the .crash file that corresponds to your crash)

rdar://problem/27286266

llvm-svn: 287262
2016-11-17 21:41:22 +00:00
Malcolm Parsons ca9d83475e Fixes for r287241. Use placement new. Apply clang-format.
llvm-svn: 287258
2016-11-17 21:00:09 +00:00
Manman Ren b666573238 ObjC Module: try to make objc module deterministic.
Make sure that comparing selectors in DeclarationName does its job.
rdar://problem/28988750

llvm-svn: 287244
2016-11-17 18:41:18 +00:00
Malcolm Parsons ff0382c161 Use unique_ptr for cached tokens for default arguments in C++.
Summary:
This changes pointers to cached tokens for default arguments in C++ from raw pointers to unique_ptrs.  There was a fixme in the code where the cached tokens are created  about using a smart pointer.

The change is straightforward, though I did have to track down and fix a memory corruption caused by the change.  memcpy was being used to copy parameter information.  This duplicated the unique_ptr, which led to the cached token buffer being deleted prematurely.

Patch by David Tarditi!

Reviewers: malcolm.parsons

Subscribers: arphaman, malcolm.parsons, cfe-commits

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

llvm-svn: 287241
2016-11-17 17:52:58 +00:00
Saleem Abdulrasool 765a219431 Sema: correct typo correction for ivars in @implementation
The previous typo correction handling assumed that ivars are only declared in
the interface declaration rather than as a private ivar in the implementation.
Adjust the handling to permit both interfaces.  Assert earlier that the
interface has been acquired to ensure that we can identify when both possible
casts have failed.

Addresses PR31040!

llvm-svn: 287238
2016-11-17 17:10:54 +00:00
Benjamin Kramer 9eba7354bb Link include-fixer into libclang if clang-tools-extra is checked out.
include-fixer only slightly bloats the size of libclang, but since
libclang has no explicit plugin mechanism it's the only way of getting
this to work. Clang-tidy is already there and so far there weren't many
complaints ;)

This is designed to be easy to remove again if libclang ever grows
proper plugin support.

llvm-svn: 287229
2016-11-17 15:22:36 +00:00
Alexey Bataev 957d856e7e [OPENMP] Fixed codegen for 'omp cancel' construct.
If 'omp cancel' construct is used in a worksharing construct it may
cause hanging of the software in case if reduction clause is used. Patch fixes this problem by avoiding extra reduction processing for branches that were canceled.

llvm-svn: 287227
2016-11-17 15:12:05 +00:00
Richard Smith 467b79c557 Remove -Wsigned-enum-bitfield from -Wmost. On a wide set of ABIs, this warning
is completely irrelevant, producing (effectively) false positives, and -Wmost
is used pretty widely. We should somehow turn it back on by default when
targeting the MS ABI, however, since it indicates the program will not do as
intended in those cases.

(Or perhaps we should just treat enum bitfields as having the signedness of the
enum, even when targeting the MS ABI...)

llvm-svn: 287193
2016-11-17 02:16:09 +00:00
George Burgess IV 004319554c [Sema] Fix a bug in enable_if condition instantiation.
During template instantiation, we currently fall back to just calling
Sema::SubstExpr for enable_if attributes that aren't value-dependent or
type-dependent. Since Sema::SubstExpr strips off any implicit casts
we've added to an expression, it's possible that this behavior will
leave us with an enable_if condition that's just a DeclRefExpr.
Conditions like that deeply confuse Sema::CheckEnableIf.

llvm-svn: 287187
2016-11-17 01:33:54 +00:00
Ivan Krasin 9103036f5f Explicitly specify that ubsan-vtable-checks is x86-64.
This should fix a failure on PowerPC introduced by r287181.

llvm-svn: 287185
2016-11-17 01:09:04 +00:00
Ivan Krasin d98f5d78cb Insert a type check before reading vtable.
Summary:
this is to prevent a situation when a pointer is invalid or null,
but we get to reading from vtable before we can check that
(possibly causing a segfault without a good diagnostics).

Reviewers: pcc

Subscribers: cfe-commits

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

llvm-svn: 287181
2016-11-17 00:39:48 +00:00
Petr Hosek 8e07a88bfa [CMake] Support lld with LTO bootstrap
lld has LTO support, if requested we should add a dependency on lld
rather than LLVMgold when doing LTO bootstrap build.

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

llvm-svn: 287179
2016-11-16 23:59:06 +00:00
Reid Kleckner ad425626d2 Add warning when assigning enums to bitfields without an explicit unsigned underlying type
Summary:
Add a warning when assigning enums to bitfields without an explicit
unsigned underlying type. This is to prevent problems with MSVC
compatibility, since the Microsoft ABI defaults to storing enums with a
signed type, causing inconsistencies with saving to/reading from
bitfields.

Also disabled the warning in the dr0xx.cpp test which throws the error,
and added a test for the warning.

The warning can be disabled with -Wno-signed-enum-bitfield.

Patch by Sasha Bermeister!

Reviewers: rnk, aaron.ballman

Subscribers: mehdi_amini, aaron.ballman, cfe-commits, thakis, dcheng

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

llvm-svn: 287177
2016-11-16 23:40:00 +00:00
Anna Zaks 1485992eb3 [analyzer] Remove unused check::RegionChanges::wantsRegionChangeUpdate callback
Remove the check::RegionChanges::wantsRegionChangeUpdate callback as it is no
longer used (since checkPointerEscape has been added).

A patch by Krzysztof Wiśniewski!

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

llvm-svn: 287175
2016-11-16 22:59:01 +00:00
George Burgess IV add6ab5084 Use the member function location in enable_if diagnostics.
Before:
<stdin>:3:3: error: no matching member function for call to 'bar'
  Foo().bar();
  ^

After:
<stdin>:3:9: error: no matching member function for call to 'bar'
  Foo().bar();
        ^

llvm-svn: 287154
2016-11-16 21:31:25 +00:00
Adrian Prantl 001c678992 Relax testcase.
This removes checks that are irrelevant for what is being tested.

llvm-svn: 287141
2016-11-16 19:31:44 +00:00
Adrian Prantl f4c5a0e630 Add the missing FileCheck invocation to this testcase.
llvm-svn: 287139
2016-11-16 19:26:11 +00:00
Yaron Keren 3998a09daf Rangify for loops, NFC.
llvm-svn: 287138
2016-11-16 19:24:10 +00:00
Adrian Prantl d3c4e1b11f Fix PR31029 by attaching an artificial debug location to msabi thunks.
This was a latent bug that was recently uncovered by r286400.

llvm-svn: 287134
2016-11-16 18:49:47 +00:00
Sean Callanan ee6d3fa07e Fixed layout of test/ASTMerge.
As outlined in a previous RFC, the test/ASTMerge/Inputs folder is getting full and the tests are starting to become interdependent. This is undesirable because

- it makes it harder to write new tests
- it makes it harder to figure out at a glance what old tests are doing, and
- it adds the risk of breaking one test while changing a different one, because of the interdependencies.

To fix this, according to the conversation in the RFC, I have changed the layout from

a.c
Inputs/a1.c
Inputs/a2.c

to

a/test.c
a/Inputs/a1.c
a/Inputs/a2.c
for all existing tests. I have also eliminated interdependencies by replicating the input files for each test that uses them.

https://reviews.llvm.org/D26571

llvm-svn: 287129
2016-11-16 18:21:00 +00:00
Benjamin Kramer 7de9969bb0 [Frontend] Allow attaching an external sema source to compiler instance and extra diags to TypoCorrections
This can be used to append alternative typo corrections to an existing diag.
include-fixer can use it to suggest includes to be added.

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

llvm-svn: 287128
2016-11-16 18:15:26 +00:00
Pekka Jaaskelainen 6aa07ee410 target-data test update for TCE and TCELE
llvm-svn: 287115
2016-11-16 16:21:59 +00:00
Simon Pilgrim 0b33f11164 Remove duplicate condition (PR30648). NFCI.
We only need to check that the bitstream entry is a Record.

llvm-svn: 287114
2016-11-16 16:11:08 +00:00
Pekka Jaaskelainen 6735448751 Add a little endian variant of TCE.
llvm-svn: 287112
2016-11-16 15:22:31 +00:00
Devin Coughlin 0f77429df3 [www] Fix spelling error in checker release notes.
llvm-svn: 287105
2016-11-16 14:23:41 +00:00