]> granicus.if.org Git - clang/log
clang
7 years ago[clang-format] disable adding extra space after MSVC '__super' keyword
Martin Probst [Thu, 16 Mar 2017 10:21:35 +0000 (10:21 +0000)]
[clang-format] disable adding extra space after MSVC '__super' keyword

clang-format treats MSVC `__super` keyword like all other keywords adding
a single space after. This change disables this behavior for `__super`.

Patch originally by jutocz (thanks!).

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297936 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoclang-format: Fix bug in wrapping behavior of operators.
Daniel Jasper [Thu, 16 Mar 2017 07:54:11 +0000 (07:54 +0000)]
clang-format: Fix bug in wrapping behavior of operators.

Before (even violating the column limit):
  auto Diag =
      diag()
      << aaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
  auto Diag = diag() << aaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaa,
                                         aaaaaaaaaaaaaaaaaaaaaaaaaa);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297931 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix up testcase to:
Eric Christopher [Wed, 15 Mar 2017 23:41:58 +0000 (23:41 +0000)]
Fix up testcase to:

a) avoid actually compiling anything
b) avoid depositing files in the test directory
c) use a check line to make sure that we're looking for the correct behavior

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297917 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove repeated code (PR32250). NFCI.
Simon Pilgrim [Wed, 15 Mar 2017 22:43:36 +0000 (22:43 +0000)]
Remove repeated code (PR32250). NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297905 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agofix build break by removing the target on command line
Guansong Zhang [Wed, 15 Mar 2017 21:46:44 +0000 (21:46 +0000)]
fix build break by removing the target on command line

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297896 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoenable -save-temps with -finclude-defult-header
Guansong Zhang [Wed, 15 Mar 2017 20:57:11 +0000 (20:57 +0000)]
enable -save-temps with -finclude-defult-header

Currently the two flags can not work together.

To illustrate the issue, we can have an one line file a.cl contains only an empty function

cat a.cl

void test(){}

Then use

clang -v -save-temps -x cl -Xclang -cl-std=CL2.0 -Xclang -finclude-default-header -target amdgcn -S -c a.cl

we will get redefinition errors for various things.

The reason is that the -finclude-default-header flag is not meant to be on cc1 command other than the preprocessor.

The fix is modeled after the code just below the change to filter the -finclude-default-header flag out when we are not in the preprocess phase.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297890 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][XOP] Add codegen tests for vector integer comparison intrinsics (PR15844)
Simon Pilgrim [Wed, 15 Mar 2017 20:20:43 +0000 (20:20 +0000)]
[X86][XOP] Add codegen tests for vector integer comparison intrinsics (PR15844)

We were testing for the generic _mm_com_* intrinsics, but not the specific comparison mode versions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297885 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd AST matchers for ObjCProtocolDecl, ObjCCategoryDecl, ObjCMethodDecl, ObjCIvarDecl...
Aaron Ballman [Wed, 15 Mar 2017 20:14:25 +0000 (20:14 +0000)]
Add AST matchers for ObjCProtocolDecl, ObjCCategoryDecl, ObjCMethodDecl, ObjCIvarDecl, and ObjCPropertyDecl.

Patch by Dave Lee.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297882 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix uninitialized value.
Zachary Turner [Wed, 15 Mar 2017 19:54:25 +0000 (19:54 +0000)]
Fix uninitialized value.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297881 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Driver] Define macro __APPLE_EMBEDDED_SIMULATOR__ when option
Akira Hatanaka [Wed, 15 Mar 2017 18:04:13 +0000 (18:04 +0000)]
[Driver] Define macro __APPLE_EMBEDDED_SIMULATOR__ when option
-m(i|tv|watch)os-simulator-version-min is on the command line.

Previously the driver would treat -m(i|tv|watch)os-simulator-version-min
as an alias of -m(i|tv|watch)os-version-min. This no longer works since
we now need to distinguish between the two options (the latter is used
for iOS running in a VM, for example).

This commit stops making the simulator options the aliases of the OS
options and defines a macro to differentiate between the two groups of
options.

rdar://problem/28872911

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297866 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ObjC][Sema] Avoid warning about a call to an instance method on an
Alex Lorenz [Wed, 15 Mar 2017 17:16:41 +0000 (17:16 +0000)]
[ObjC][Sema] Avoid warning about a call to an instance method on an
instance of a qualified Class object when that instance method comes from
a protocol that's implemented by NSObject

Instance methods from a root class like NSObject are also class methods because
the metaclass of root class derives from that root class. Therefore, we can
avoid the warning for instances of qualified Class objects that point to classes
that derive from NSObject. Note that we actually don't know if a Class instance
points to a class that derives from NSObject at compile-time, so we have to
make a reasonable assumption that the majority of instances will do so.

rdar://22812517

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297862 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDon't use MSVC Setup Api on MinGW.
Zachary Turner [Wed, 15 Mar 2017 17:09:36 +0000 (17:09 +0000)]
Don't use MSVC Setup Api on MinGW.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297861 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDisable warning about MSVC not found.
Zachary Turner [Wed, 15 Mar 2017 16:35:13 +0000 (16:35 +0000)]
Disable warning about MSVC not found.

When this test runs on bots that are configured to default
to MSVC, but MSVC isn't actually installed, we can emit a
warning that MSVC is not found.  Since MSVC isn't actually
needed for this test to succeed, just disable this warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297858 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUpdate clang-cl driver for MSVC 2017.
Zachary Turner [Wed, 15 Mar 2017 16:07:35 +0000 (16:07 +0000)]
Update clang-cl driver for MSVC 2017.

2017 changes the way you find an installed copy of
Visual Studio as well as its internal directory layout.
As a result, clang-cl was unable to find VS2017 even
when you had run vcvarsall to set up a toolchain
environment.  This patch updates everything for 2017
and cleans up the way we handle a tiered search a la
environment -> installation -> PATH for which copy
of Visual Studio to bind to.

Patch originally by Hamza Sood, with some fixups for landing.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297851 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Driver] Restructure handling of -ffast-math and similar options
John Brawn [Wed, 15 Mar 2017 14:03:32 +0000 (14:03 +0000)]
[Driver] Restructure handling of -ffast-math and similar options

The way -ffast-math and the various related options to tweak floating-point
handling are handled is inflexible and rather confusing. This patch restructures
things so that we go through the options adjusting our idea of what's enabled as
we go, instead of trying to figure each individual thing out by working
backwards from the end, as this makes the behaviour of each individual option
more clear.

Doing it this way also means we get gcc-compatible behaviour for when the
__FAST_MATH__ and __FINITE_MATH_ONLY__ macros are defined, as they should depend
on the final set of features that are enabled and not just on -ffast-math and
-ffinite-math-only specifically.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297837 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix test on Windows. Only a single backslash was required, not a double.
Douglas Yung [Wed, 15 Mar 2017 01:38:24 +0000 (01:38 +0000)]
Fix test on Windows. Only a single backslash was required, not a double.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297799 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMake a blind attempt to fix this testcase on Windows.
Adrian Prantl [Tue, 14 Mar 2017 23:29:40 +0000 (23:29 +0000)]
Make a blind attempt to fix this testcase on Windows.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297791 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCanonicalize the path provided by -fmodules-cache-path.
Adrian Prantl [Tue, 14 Mar 2017 23:07:49 +0000 (23:07 +0000)]
Canonicalize the path provided by -fmodules-cache-path.

This fixes lookup mismatches that could happen when the module cache
path contained a '/./' component.

<rdar://problem/30413458>

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297790 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix Wdocumentation warning
Simon Pilgrim [Tue, 14 Mar 2017 21:43:52 +0000 (21:43 +0000)]
Fix Wdocumentation warning

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297784 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Hexagon] Recognize hexagonv62 as a valid target CPU
Krzysztof Parzyszek [Tue, 14 Mar 2017 20:29:23 +0000 (20:29 +0000)]
[Hexagon] Recognize hexagonv62 as a valid target CPU

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297778 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoModules: Optimize bitcode encoding of diagnostic state
Duncan P. N. Exon Smith [Tue, 14 Mar 2017 19:31:27 +0000 (19:31 +0000)]
Modules: Optimize bitcode encoding of diagnostic state

Since bitcode uses VBR encoding, large numbers are more expensive than
small ones.  Instead of emitting a UINT_MAX sentinel after each sequence
of state-change pairs, emit the size of the sequence as a prefix.

This should have no functionality change besides saving bits from the
encoding.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297770 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix arch-specific-libdir tests on Windows
Reid Kleckner [Tue, 14 Mar 2017 18:24:41 +0000 (18:24 +0000)]
Fix arch-specific-libdir tests on Windows

This is pretty horrible, but I forget if we have any better ways to
handle these backslashing issues.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297764 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoWarn on enum assignment to bitfields that can't fit all values
Reid Kleckner [Tue, 14 Mar 2017 18:01:02 +0000 (18:01 +0000)]
Warn on enum assignment to bitfields that can't fit all values

This adds -Wbitfield-enum-conversion, which warns on implicit
conversions that happen on bitfield assignment that change the value of
some enumerators.

Values of enum type typically take on a very small range of values, so
they are frequently stored in bitfields. Unfortunately, there is no
convenient way to calculate the minimum number of bits necessary to
store all possible values at compile time, so users usually hard code a
bitwidth that works today and widen it as necessary to pass basic
testing and validation. This is very error-prone, and leads to stale
widths as enums grow. This warning aims to catch such bugs.

This would have found two real bugs in clang and two instances of
questionable code. See r297680 and r297654 for the full description of
the issues.

This warning is currently disabled by default while we investigate its
usefulness outside of LLVM.

The major cause of false positives with this warning is this kind of
enum:
  enum E { W, X, Y, Z, SENTINEL_LAST };
The last enumerator is an invalid value used to validate inputs or size
an array. Depending on the prevalance of this style of enum across a
codebase, this warning may be more or less feasible to deploy. It also
has trouble on sentinel values such as ~0U.

Reviewers: rsmith, rtrieu, thakis

Reviewed By: thakis

Subscribers: hfinkel, voskresensky.vladimir, sashab, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297761 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd more debugging code for the SystemZ bot.
Juergen Ributzka [Tue, 14 Mar 2017 17:46:26 +0000 (17:46 +0000)]
Add more debugging code for the SystemZ bot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297759 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix misspelled enum
Jonathan Roelofs [Tue, 14 Mar 2017 17:29:33 +0000 (17:29 +0000)]
Fix misspelled enum

https://reviews.llvm.org/D30945

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297756 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Driver] Fix arch-specific-libdir-rpath.c
Pirama Arumuga Nainar [Tue, 14 Mar 2017 17:26:56 +0000 (17:26 +0000)]
[Driver] Fix arch-specific-libdir-rpath.c

Summary: Fix the test by adding missing -target flags with a 'linux' triple.

Reviewers: rnk, srhines

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297754 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Driver] Add flag to request arch-specific-subdir in -rpath
Pirama Arumuga Nainar [Tue, 14 Mar 2017 16:58:07 +0000 (16:58 +0000)]
[Driver] Add flag to request arch-specific-subdir in -rpath

Summary:
This patch adds -f[no-]rtlib-add-rpath, which if enabled, embeds the
arch-specific subdirectory in resource directory using -rpath (instead
of doing so only during native compilation).

This patch also re-enables test arch-specific-libdir.c which was
silently unsupported because of the REQUIRES tag 'linux'.

Reviewers: bkramer, rnk, mgorny

Subscribers: srhines, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297751 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ubsan] Use the nicer nullability diagnostic handlers
Vedant Kumar [Tue, 14 Mar 2017 16:48:29 +0000 (16:48 +0000)]
[ubsan] Use the nicer nullability diagnostic handlers

This is a follow-up to r297700 (Add a nullability sanitizer).

It addresses some FIXME's re: using nullability-specific diagnostic
handlers from compiler-rt, now that the necessary handlers exist.

check-ubsan test updates to follow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297750 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd more clang-format changes to the 5.0 release notes
Krasimir Georgiev [Tue, 14 Mar 2017 10:34:39 +0000 (10:34 +0000)]
Add more clang-format changes to the 5.0 release notes

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297730 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agodescribe the recent changes in clang-format in the 5.0 release notes
Sylvestre Ledru [Tue, 14 Mar 2017 09:43:55 +0000 (09:43 +0000)]
describe the recent changes in clang-format in the 5.0 release notes

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297721 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CodeGen][ObjC] Fix a bug where the type of an ivar wasn't encoded
Akira Hatanaka [Tue, 14 Mar 2017 04:00:52 +0000 (04:00 +0000)]
[CodeGen][ObjC] Fix a bug where the type of an ivar wasn't encoded
correctly.

This fixes PR30413.

Patch by David Lobron.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297702 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ubsan] Add a nullability sanitizer
Vedant Kumar [Tue, 14 Mar 2017 01:56:34 +0000 (01:56 +0000)]
[ubsan] Add a nullability sanitizer

Teach UBSan to detect when a value with the _Nonnull type annotation
assumes a null value. Call expressions, initializers, assignments, and
return statements are all checked.

Because _Nonnull does not affect IRGen, the new checks are disabled by
default. The new driver flags are:

  -fsanitize=nullability-arg      (_Nonnull violation in call)
  -fsanitize=nullability-assign   (_Nonnull violation in assignment)
  -fsanitize=nullability-return   (_Nonnull violation in return stmt)
  -fsanitize=nullability          (all of the above)

This patch builds on top of UBSan's existing support for detecting
violations of the nonnull attributes ('nonnull' and 'returns_nonnull'),
and relies on the compiler-rt support for those checks. Eventually we
will need to update the diagnostic messages in compiler-rt (there are
FIXME's for this, which will be addressed in a follow-up).

One point of note is that the nullability-return check is only allowed
to kick in if all arguments to the function satisfy their nullability
preconditions. This makes it necessary to emit some null checks in the
function body itself.

Testing: check-clang and check-ubsan. I also built some Apple ObjC
frameworks with an asserts-enabled compiler, and verified that we get
valid reports.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297700 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoclang-format: Make it very slighly more expensive to wrap between "= {".
Daniel Jasper [Tue, 14 Mar 2017 00:40:32 +0000 (00:40 +0000)]
clang-format: Make it very slighly more expensive to wrap between "= {".

This prevents unwanted fallout from r296664. Specifically in proto formatting,
this changed:
  optional Aaaaaaaa aaaaaaaa = 12 [
    (aaa) = aaaa,
    (bbbbbbbbbbbbbbbbbbbbbbbbbb) = {
      aaaaaaaaaaaaaaaaa: true,
      aaaaaaaaaaaaaaaa: true
    }
  ];

Into:
  optional Aaaaaaaa aaaaaaaa = 12 [
    (aaa) = aaaa,
    (bbbbbbbbbbbbbbbbbbbbbbbbbb) =
        {aaaaaaaaaaaaaaaaa: true, aaaaaaaaaaaaaaaa: true}
  ];

Which is considered less readable. Generally, it seems preferable to
format such dict literals as blocks rather than contract them to one
line.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297696 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix crash with interrupt attribute on ARM.
Eli Friedman [Tue, 14 Mar 2017 00:18:29 +0000 (00:18 +0000)]
Fix crash with interrupt attribute on ARM.

An indirect call has no associated function declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297694 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReapply [VFS] Ignore broken symlinks in the directory iterator.
Juergen Ributzka [Tue, 14 Mar 2017 00:14:40 +0000 (00:14 +0000)]
Reapply [VFS] Ignore broken symlinks in the directory iterator.

Modified the tests to accept any iteration order, to run only on Unix, and added
additional error reporting to investigate SystemZ bot issue.

The VFS directory iterator and recursive directory iterator behave differently
from the LLVM counterparts. Once the VFS iterators hit a broken symlink they
immediately abort. The LLVM counterparts don't stat entries unless they have to
descend into the next directory, which allows to recover from this issue by
clearing the error code and skipping to the next entry.

This change adds similar behavior to the VFS iterators. There should be no
change in current behavior in the current CLANG source base, because all
clients have loop exit conditions that also check the error code.

This fixes rdar://problem/30934619.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297693 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix -Wunused-lambda-capture warning in new code
Reid Kleckner [Mon, 13 Mar 2017 22:33:07 +0000 (22:33 +0000)]
Fix -Wunused-lambda-capture warning in new code

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297681 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoWiden AST bitfields too small to represent all enumerators
Reid Kleckner [Mon, 13 Mar 2017 22:33:04 +0000 (22:33 +0000)]
Widen AST bitfields too small to represent all enumerators

All of these were found by a new warning that I am prototyping,
-Wbitfield-enum-conversion.

Stmt::ExprBits::ObjectKind - This was not wide enough to represent
OK_ObjSubscript, so this was a real, true positive bug.

ObjCDeclSpec::objCDeclQualifier - On Windows, setting DQ_CSNullability
would cause the bitfield to become negative because enum types are
always implicitly 'int' there. This would probably never be noticed
because this is a flag-style enum, so we only ever test one bit at a
time. Switching to 'unsigned' also makes this type pack smaller on
Windows.

FunctionDecl::SClass - Technically, we only need two bits for all valid
function storage classes. Functions can never have automatic or register
storage class. This seems a bit too clever, and we have a bit to spare,
so widening the bitfield seems like the best way to pacify the warning.
You could classify this as a false positive, but widening the bitfield
defends us from invalid ASTs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297680 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Make 0 the private nullptr value
Matt Arsenault [Mon, 13 Mar 2017 19:47:53 +0000 (19:47 +0000)]
AMDGPU: Make 0 the private nullptr value

We can't actually pretend that 0 is valid for address space 0.
r295877 added a workaround to stop allocating user objects
there, so we can use 0 as the invalid pointer.

Some of the tests seemed to be using private as the non-0 null
test address space, so add copies using local to make sure
this is still stressed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297659 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoModules: Use hash of PCM content for SIGNATURE
Duncan P. N. Exon Smith [Mon, 13 Mar 2017 18:45:08 +0000 (18:45 +0000)]
Modules: Use hash of PCM content for SIGNATURE

Change ASTFileSignature from a random 32-bit number to the hash of the
PCM content.

  - Move definition ASTFileSignature to Basic/Module.h so Module and
    ASTSourceDescriptor can use it.

  - Change the signature from uint64_t to std::array<uint32_t,5>.

  - Stop using (saving/reading) the size and modification time of PCM
    files when there is a valid SIGNATURE.

  - Add UNHASHED_CONTROL_BLOCK, and use it to store the SIGNATURE record
    and other records that shouldn't affect the hash.  Because implicit
    modules reuses the same file for multiple levels of -Werror, this
    includes DIAGNOSTIC_OPTIONS and DIAG_PRAGMA_MAPPINGS.

This helps to solve a PCH + implicit Modules dependency issue: PCH files
are handled by the external build system, whereas implicit modules are
handled by internal compiler build system.  This prevents invalidating a
PCH when the compiler overwrites a PCM file with the same content
(modulo the diagnostic differences).

Design and original patch by Manman Ren!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297655 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoWiden bitfield for type specifiers for OpenCL types
Reid Kleckner [Mon, 13 Mar 2017 18:42:30 +0000 (18:42 +0000)]
Widen bitfield for type specifiers for OpenCL types

Added a static_assert to catch this issue at compile time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297654 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Linker] Provide callback for internalization
Jonas Devlieghere [Mon, 13 Mar 2017 18:08:11 +0000 (18:08 +0000)]
[Linker] Provide callback for internalization

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297649 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Add checking of the scale argument to scatter/gather builtins
Craig Topper [Mon, 13 Mar 2017 17:16:50 +0000 (17:16 +0000)]
[X86] Add checking of the scale argument to scatter/gather builtins

The only valid values for scale immediate of scatter/gather builtins are 1, 2, 4, or 8. This patch enforces this in the frontend otherwise we generate invalid instruction encodings in the backend.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297642 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CodeCompletion] Format block parameter placeholders in implicit property
Alex Lorenz [Mon, 13 Mar 2017 15:43:42 +0000 (15:43 +0000)]
[CodeCompletion] Format block parameter placeholders in implicit property
setters using the block type information that's obtained from the property

rdar://12604235

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297628 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ASTImporter] Import fix of GCCAsmStmts w/ missing symbolic operands
Gabor Horvath [Mon, 13 Mar 2017 15:32:24 +0000 (15:32 +0000)]
[ASTImporter] Import fix of GCCAsmStmts w/ missing symbolic operands

Patch by Zoltan Gera!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297627 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[clang-format] Add more examples and fix a bug in the py generation script
Sylvestre Ledru [Mon, 13 Mar 2017 14:42:47 +0000 (14:42 +0000)]
[clang-format] Add more examples and fix a bug in the py generation script

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297623 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoWhen diagnosing taking address of packed members skip __unaligned-qualified expressions
Roger Ferrer Ibanez [Mon, 13 Mar 2017 13:18:21 +0000 (13:18 +0000)]
When diagnosing taking address of packed members skip __unaligned-qualified expressions

Given that we have already explicitly stated in the qualifier that the
expression is __unaligned, it makes little sense to diagnose that the address
of the packed member may not be aligned.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297620 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] Fix a rare crash for valist check.
Gabor Horvath [Mon, 13 Mar 2017 12:48:26 +0000 (12:48 +0000)]
[analyzer] Fix a rare crash for valist check.

It looks like on some host-triples the result of a valist related expr can be
a LazyCompoundVal. Handle that case in the check.

Patch by Abramo Bagnara!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297619 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd -iframeworkwithsysroot compiler option
Alex Lorenz [Mon, 13 Mar 2017 11:17:41 +0000 (11:17 +0000)]
Add -iframeworkwithsysroot compiler option

This commit adds support for a new -iframeworkwithsysroot compiler option which
allows the user to specify a framework path that can be prefixed with the
sysroot. This option is similar to the -iwithsysroot option that exists to
supplement -isystem.

rdar://21316352

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297614 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoclang-format: [JS] do not wrap @see tags.
Martin Probst [Mon, 13 Mar 2017 09:39:23 +0000 (09:39 +0000)]
clang-format: [JS] do not wrap @see tags.

Summary:
@see is special among JSDoc tags in that it is commonly followed by URLs. The JSDoc spec suggests that users should wrap URLs in an additional {@link url...} tag (@see http://usejsdoc.org/tags-see.html), but this is very commonly violated, with @see being followed by a "naked" URL.

This change special cases all JSDoc lines that contain an @see not to be wrapped to account for that.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297607 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoclang-format: [JS] allow breaking after non-null assertions.
Martin Probst [Mon, 13 Mar 2017 09:14:23 +0000 (09:14 +0000)]
clang-format: [JS] allow breaking after non-null assertions.

Summary:
Previously clang-format would not break after any !. However in TypeScript, ! can be used as a post fix operator for non-nullability:
    x.foo()!.bar()!;

With this change, clang-format will wrap after the ! if it is likely a post-fix non null operator.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297606 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoclang-format: [JS] do not wrap after interface and type.
Martin Probst [Mon, 13 Mar 2017 07:10:18 +0000 (07:10 +0000)]
clang-format: [JS] do not wrap after interface and type.

Summary:
`interface` and `type` are pseudo keywords and cause automatic semicolon
insertion when followed by a line break:

    interface  // gets parsed as a long variable access to "interface"
        VeryLongInterfaceName {

    }

With this change, clang-format not longer wraps after `interface` or `type`.

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297605 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAllow the nonnull attribute to be inherited as a parameter in the redefinition of...
Aaron Ballman [Sun, 12 Mar 2017 22:30:07 +0000 (22:30 +0000)]
Allow the nonnull attribute to be inherited as a parameter in the redefinition of a function. Fixes PR30828.

Patch by Matt Bettinson.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297592 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AVX-512] Add range check for locality hint immediate on scatter/gather prefetch...
Craig Topper [Sun, 12 Mar 2017 22:19:10 +0000 (22:19 +0000)]
[AVX-512] Add range check for locality hint immediate on scatter/gather prefetch builtins.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297590 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[x86] these aren't the undefs you're looking for (PR32176)
Sanjay Patel [Sun, 12 Mar 2017 19:15:10 +0000 (19:15 +0000)]
[x86] these aren't the undefs you're looking for (PR32176)

x86 has undef SSE/AVX intrinsics that should represent a bogus register operand.
This is not the same as LLVM's undef value which can take on multiple bit patterns.

There are better solutions / follow-ups to this discussed here:
https://bugs.llvm.org/show_bug.cgi?id=32176
...but this should prevent miscompiles with a one-line code change.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297588 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AVX-512] Fix avx512vl gather builtins to require the scale argument to be an ICE...
Craig Topper [Sun, 12 Mar 2017 17:58:12 +0000 (17:58 +0000)]
[AVX-512] Fix avx512vl gather builtins to require the scale argument to be an ICE like the rest of the gather builtins.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297584 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[coroutines] Fix diagnostics depending on the first coroutine statement.
Eric Fiselier [Sat, 11 Mar 2017 02:35:37 +0000 (02:35 +0000)]
[coroutines] Fix diagnostics depending on the first coroutine statement.

Summary:
Some coroutine diagnostics need to point to the location of the first coroutine keyword in the function, like when diagnosing a `return` inside a coroutine. Previously we did this by storing each *valid* coroutine statement in a list and select the first one to use in diagnostics. However if every coroutine statement is invalid we would have no location to point to.

This patch fixes the storage of the first coroutine statement location, ensuring that it gets stored even when the resulting AST node would be invalid.
This patch also removes the `CoroutineStmts` list in `FunctionScopeInfo` because it was unused.

Reviewers: rsmith, GorNishanov, aaron.ballman

Reviewed By: GorNishanov

Subscribers: mehdi_amini, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297547 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[coroutines] Refactor SuspendExpr to create just one OpaqueValue (almost NFC)
Gor Nishanov [Sat, 11 Mar 2017 01:30:17 +0000 (01:30 +0000)]
[coroutines] Refactor SuspendExpr to create just one OpaqueValue (almost NFC)

Summary:
Create only one OpaqueValue for await_ready/await_suspend/await_resume.
Store OpaqueValue used in the CoroutineSuspendExpr node, so that CodeGen does not have to hunt looking for it.

Reviewers: rsmith, EricWF, aaron.ballman

Reviewed By: EricWF

Subscribers: mehdi_amini, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297541 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "Reapply [VFS] Ignore broken symlinks in the directory iterator."
Juergen Ributzka [Sat, 11 Mar 2017 00:14:50 +0000 (00:14 +0000)]
Revert "Reapply [VFS] Ignore broken symlinks in the directory iterator."

Still broken on Windows and SystemZ bot ... sorry for the noise.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297533 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdding debug output to investigate systemz bot issue.
Juergen Ributzka [Sat, 11 Mar 2017 00:01:24 +0000 (00:01 +0000)]
Adding debug output to investigate systemz bot issue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297531 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoclang/test/SemaOpenCL/overload_addrspace_resolution.cl: Appease MS mangler to specify...
NAKAMURA Takumi [Fri, 10 Mar 2017 23:06:34 +0000 (23:06 +0000)]
clang/test/SemaOpenCL/overload_addrspace_resolution.cl: Appease MS mangler to specify triple=x86_64-unknown.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297530 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReapply [VFS] Ignore broken symlinks in the directory iterator.
Juergen Ributzka [Fri, 10 Mar 2017 22:49:04 +0000 (22:49 +0000)]
Reapply [VFS] Ignore broken symlinks in the directory iterator.

Modified the tests to accept any iteration order.

The VFS directory iterator and recursive directory iterator behave differently
from the LLVM counterparts. Once the VFS iterators hit a broken symlink they
immediately abort. The LLVM counterparts allow to recover from this issue by
clearing the error code and skipping to the next entry.

This change adds the same functionality to the VFS iterators. There should be
no change in current behavior in the current CLANG source base, because all
clients have loop exit conditions that also check the error code.

This fixes rdar://problem/30934619.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297528 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert r297510 "[VFS] Ignore broken symlinks in the directory iterator."
Juergen Ributzka [Fri, 10 Mar 2017 21:46:51 +0000 (21:46 +0000)]
Revert r297510 "[VFS] Ignore broken symlinks in the directory iterator."

The tests are failing on one of the bots.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297517 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[VFS] Remove the Path variable from RealFSDirIter. NFC.
Juergen Ributzka [Fri, 10 Mar 2017 21:23:29 +0000 (21:23 +0000)]
[VFS] Remove the Path variable from RealFSDirIter. NFC.

This variable is set, but never used.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297511 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[VFS] Ignore broken symlinks in the directory iterator.
Juergen Ributzka [Fri, 10 Mar 2017 21:23:27 +0000 (21:23 +0000)]
[VFS] Ignore broken symlinks in the directory iterator.

The VFS directory iterator and recursive directory iterator behave differently
from the LLVM counterparts. Once the VFS iterators hit a broken symlink they
immediately abort. The LLVM counterparts allow to recover from this issue by
clearing the error code and skipping to the next entry.

This change adds the same functionality to the VFS iterators. There should be
no change in current behavior in the current CLANG source base, because all
clients have loop exit conditions that also check the error code.

This fixes rdar://problem/30934619.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297510 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAttempt to fix Windows buildbot.
Galina Kistanova [Fri, 10 Mar 2017 19:34:15 +0000 (19:34 +0000)]
Attempt to fix Windows buildbot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297497 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[mips][msa] Remove range checks for non-immediate sld.[bhwd] instructions
Petar Jovanovic [Fri, 10 Mar 2017 17:51:01 +0000 (17:51 +0000)]
[mips][msa] Remove range checks for non-immediate sld.[bhwd] instructions

Removes immediate range checks for these instructions, since they have GPR
rt as their input operand.

Patch by Stefan Maksimovic.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297485 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OpenCL] Fix type compatibility check and generic AS mangling.
Anastasia Stulova [Fri, 10 Mar 2017 15:23:07 +0000 (15:23 +0000)]
[OpenCL] Fix type compatibility check and generic AS mangling.

1. Reimplemented conditional operator so that it checks
compatibility of unqualified pointees of the 2nd and
the 3rd operands (C99, OpenCL v2.0 6.5.15).

Define QualTypes compatibility for OpenCL as following:

   - corresponding types are compatible (C99 6.7.3)
   - CVR-qualifiers are equal (C99 6.7.3)
   - address spaces are equal (implementation defined)

2. Added generic address space to Itanium mangling.

Review: D30037

Patch by Dmitry Borisenkov!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297468 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[clang-format] Add option to break before inheritance separation operator in class...
Andi-Bogdan Postelnicu [Fri, 10 Mar 2017 15:10:37 +0000 (15:10 +0000)]
[clang-format] Add option to break before inheritance separation operator in class declaration.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297467 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoPrint nested name specifiers for typedefs and type aliases
Alex Lorenz [Fri, 10 Mar 2017 15:04:58 +0000 (15:04 +0000)]
Print nested name specifiers for typedefs and type aliases

Printing typedefs or type aliases using clang_getTypeSpelling() is missing the
namespace they are defined in. This is in contrast to other types that always
yield the full typename including namespaces.

Patch by Michael Reiher!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297465 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] Extend block in critical section check with C11 and Pthread APIs.
Gabor Horvath [Fri, 10 Mar 2017 14:50:12 +0000 (14:50 +0000)]
[analyzer] Extend block in critical section check with C11 and Pthread APIs.

Patch by Zoltan Daniel Torok!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297461 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[clang-format] Use a reference in loop variable; NFC
Krasimir Georgiev [Fri, 10 Mar 2017 13:09:29 +0000 (13:09 +0000)]
[clang-format] Use a reference in loop variable; NFC

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297455 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AMDGPU] Add builtin functions readlane ds_permute mov_dpp
Yaxun Liu [Fri, 10 Mar 2017 01:30:46 +0000 (01:30 +0000)]
[AMDGPU] Add builtin functions readlane ds_permute mov_dpp

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297436 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] Turn suppress-c++-stdlib on by default
Anna Zaks [Fri, 10 Mar 2017 00:33:19 +0000 (00:33 +0000)]
[analyzer] Turn suppress-c++-stdlib on by default

We have several reports of false positives coming from libc++. For example,
there are reports of false positives in std::regex, std::wcout, and also
a bunch of issues are reported in https://reviews.llvm.org/D30593. In many
cases, the analyzer trips over the complex libc++ code invariants. Let's turn
off the reports coming from these headers until we can re-evalate the support.

We can turn this back on once we individually suppress all known false
positives and perform deeper evaluation on large codebases that use libc++.
We'd also need to commit to doing these evaluations regularly as libc++
headers change.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297429 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd -cc1 flag -ast-dump-all to perform an AST dump including entities that haven...
Richard Smith [Thu, 9 Mar 2017 22:00:01 +0000 (22:00 +0000)]
Add -cc1 flag -ast-dump-all to perform an AST dump including entities that haven't yet been deserialized.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297412 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DebugInfo] Append extended dereferencing mechanism to variables' DIExpression for...
Konstantin Zhuravlyov [Thu, 9 Mar 2017 18:06:23 +0000 (18:06 +0000)]
[DebugInfo] Append extended dereferencing mechanism to variables' DIExpression for targets that support more than one address space

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297397 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRetry: [ubsan] Detect UB loads from bitfields
Vedant Kumar [Thu, 9 Mar 2017 16:06:27 +0000 (16:06 +0000)]
Retry: [ubsan] Detect UB loads from bitfields

It's possible to load out-of-range values from bitfields backed by a
boolean or an enum. Check for UB loads from bitfields.

This is the motivating example:

  struct S {
    BOOL b : 1; // Signed ObjC BOOL.
  };

  S s;
  s.b = 1; // This is actually stored as -1.
  if (s.b == 1) // Evaluates to false, -1 != 1.
    ...

Changes since the original commit:

- Single-bit bools are a special case (see CGF::EmitFromMemory), and we
  can't avoid dealing with them when loading from a bitfield. Don't try to
  insert a check in this case.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297389 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove a useless subsitution in doxygen2rst which was incorrectly replacing * by \*
Sylvestre Ledru [Thu, 9 Mar 2017 06:41:08 +0000 (06:41 +0000)]
Remove a useless subsitution in doxygen2rst which was incorrectly replacing * by \*

Summary: For example, "int\* a;" is displayed instead of "int* a;"

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297363 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[coroutines] Fix assertion in DependentCoawaitExpr when the argument is non-dependent.
Eric Fiselier [Thu, 9 Mar 2017 05:01:31 +0000 (05:01 +0000)]
[coroutines] Fix assertion in DependentCoawaitExpr when the argument is non-dependent.

Summary:
A `co_await arg` expression has a dependent type whenever the promise type is still dependent, even if the argument to co_await is not. This is because we cannot attempt the `await_transform(<arg>)` until after we know the promise type.

This patch fixes an assertion in the constructor of `DependentCoawaitExpr` that asserted that `arg` must also be dependent.

Reviewers: rsmith, GorNishanov, aaron.ballman

Reviewed By: GorNishanov

Subscribers: mehdi_amini, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297358 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[coroutines] Build and pass coroutine_handle to await_suspend
Gor Nishanov [Thu, 9 Mar 2017 03:09:43 +0000 (03:09 +0000)]
[coroutines] Build and pass coroutine_handle to await_suspend

Summary:
This patch adds passing a coroutine_handle object to await_suspend calls.
It builds the coroutine_handle using coroutine_handle<PromiseType>::from_address(__builtin_coro_frame()).

(a revision of https://reviews.llvm.org/D26316 that for some reason refuses to apply via arc patch)

Reviewers: GorNishanov

Subscribers: mehdi_amini, cfe-commits, EricWF

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297356 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd a cmake cache file for a stage-2 build with ThinLTO
Mehdi Amini [Thu, 9 Mar 2017 01:18:31 +0000 (01:18 +0000)]
Add a cmake cache file for a stage-2 build with ThinLTO

This is intended to be targetted by a Green Dragon stage-2 bot
I'm bringing up currently. WIP.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297351 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix handling of -fmodule-map-file=X where X has no directory component.
Richard Smith [Thu, 9 Mar 2017 00:58:22 +0000 (00:58 +0000)]
Fix handling of -fmodule-map-file=X where X has no directory component.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297349 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[ubsan] Detect UB loads from bitfields"
Vedant Kumar [Thu, 9 Mar 2017 00:18:53 +0000 (00:18 +0000)]
Revert "[ubsan] Detect UB loads from bitfields"

This reverts commit r297298. It breaks the self-host on this bot:

  http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/962/steps/build%20clang%2Fubsan/logs/stdio

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297331 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDriver/ToolChains: Remove extra semicolons. NFC
Konstantin Zhuravlyov [Thu, 9 Mar 2017 00:14:57 +0000 (00:14 +0000)]
Driver/ToolChains: Remove extra semicolons. NFC

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297329 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] Extend taint propagation and checking to support LazyCompoundVal
Anna Zaks [Thu, 9 Mar 2017 00:01:16 +0000 (00:01 +0000)]
[analyzer] Extend taint propagation and checking to support LazyCompoundVal

A patch by Vlad Tsyrklevich!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297326 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] Improve usability of ExprInspectionChecker
Anna Zaks [Thu, 9 Mar 2017 00:01:10 +0000 (00:01 +0000)]
[analyzer] Improve usability of ExprInspectionChecker

Some of the magic functions take arguments of arbitrary type. However,
for semantic correctness, the compiler still requires a declaration
of these functions with the correct type. Since C does not have
argument-type-overloaded function, this made those functions hard to
use in C code. Improve this situation by allowing arbitrary suffixes
in the affected magic functions' names, thus allowing the user to
create different declarations for different types.

A patch by Keno Fischer!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297325 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] Add bug visitor for taint checker.
Anna Zaks [Thu, 9 Mar 2017 00:01:07 +0000 (00:01 +0000)]
[analyzer] Add bug visitor for taint checker.

Add a bug visitor to the taint checker to make it easy to distinguish where
the tainted value originated. This is especially useful when the original
taint source is obscured by complex data flow.

A patch by Vlad Tsyrklevich!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297324 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] Teach the MallocChecker about about Glib API
Anna Zaks [Thu, 9 Mar 2017 00:01:01 +0000 (00:01 +0000)]
[analyzer] Teach the MallocChecker about about Glib API

A patch by Leslie Zhai!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297323 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDefensively ensure that GetExternalDeclStmt protects itself from nested deserialization
David Blaikie [Wed, 8 Mar 2017 23:57:08 +0000 (23:57 +0000)]
Defensively ensure that GetExternalDeclStmt protects itself from nested deserialization

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297322 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DebugInfo] Add address space when creating DIDerivedTypes
Konstantin Zhuravlyov [Wed, 8 Mar 2017 23:56:48 +0000 (23:56 +0000)]
[DebugInfo] Add address space when creating DIDerivedTypes

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297321 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoTake into account C++17's noexcept function types during merging -- it should
Richard Smith [Wed, 8 Mar 2017 23:00:26 +0000 (23:00 +0000)]
Take into account C++17's noexcept function types during merging -- it should
be possible to merge a declaration with an unresolved function type against one
with a resolved function type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297316 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDriver/ToolChains: Mips -> MipsLinux
Konstantin Zhuravlyov [Wed, 8 Mar 2017 22:36:04 +0000 (22:36 +0000)]
Driver/ToolChains: Mips -> MipsLinux
  - Mips is architecture, not a toolchain
  - Might help eliminate the confusion in the future by not having header files with the same name

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297312 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[scan-build-py] move argument parsing into separate module
Laszlo Nagy [Wed, 8 Mar 2017 21:22:32 +0000 (21:22 +0000)]
[scan-build-py] move argument parsing into separate module

Forgot to add the new module.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297308 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[scan-build-py] move argument parsing into separate module
Laszlo Nagy [Wed, 8 Mar 2017 21:18:51 +0000 (21:18 +0000)]
[scan-build-py] move argument parsing into separate module

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297307 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ubsan] Detect UB loads from bitfields
Vedant Kumar [Wed, 8 Mar 2017 17:38:57 +0000 (17:38 +0000)]
[ubsan] Detect UB loads from bitfields

It's possible to load out-of-range values from bitfields backed by a
boolean or an enum. Check for UB loads from bitfields.

This is the motivating example:

  struct S {
    BOOL b : 1; // Signed ObjC BOOL.
  };

  S s;
  s.b = 1; // This is actually stored as -1.
  if (s.b == 1) // Evaluates to false, -1 != 1.
    ...

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297298 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd missing implementation for AtomicChange::replace(...)
Eric Liu [Wed, 8 Mar 2017 15:53:10 +0000 (15:53 +0000)]
Add missing implementation for AtomicChange::replace(...)

Summary: Just realized the implementation is missing...

Reviewers: klimek

Reviewed By: klimek

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297289 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] Clarify 'uninitialized function argument' messages
Daniel Marjamaki [Wed, 8 Mar 2017 15:22:24 +0000 (15:22 +0000)]
[analyzer] Clarify 'uninitialized function argument' messages

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297283 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoHonor __unaligned in codegen for declarations and expressions
Roger Ferrer Ibanez [Wed, 8 Mar 2017 14:00:44 +0000 (14:00 +0000)]
Honor __unaligned in codegen for declarations and expressions

This patch honors the unaligned type qualifier (currently available through he
keyword __unaligned and -fms-extensions) in CodeGen. In the current form the
patch affects declarations and expressions. It does not affect fields of
classes.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297276 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd more examples to clang-format configuration
Sylvestre Ledru [Wed, 8 Mar 2017 13:24:46 +0000 (13:24 +0000)]
Add more examples to clang-format configuration

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297275 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[clang-format] Look at NoLineBreak and NoLineBreakInOperand before breakProtrudingToken
Krasimir Georgiev [Wed, 8 Mar 2017 12:54:50 +0000 (12:54 +0000)]
[clang-format] Look at NoLineBreak and NoLineBreakInOperand before breakProtrudingToken

Summary:
This patch makes ContinuationIndenter call breakProtrudingToken only if
NoLineBreak and NoLineBreakInOperand is false.

Previously, clang-format required two runs to converge on the following example with 24 columns:
Note that the second operand shouldn't be splitted according to NoLineBreakInOperand, but the
token breaker doesn't take that into account:
```
func(a, "long long long long", c);
```
After first run:
```
func(a, "long long "
        "long long",
         c);
```
After second run, where NoLineBreakInOperand is taken into account:
```
func(a,
     "long long "
     "long long",
     c);
```

With the patch, clang-format now obtains in one run:
```
func(a,
     "long long long"
     "long",
     c);
```
which is a better token split overall.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297274 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[XRay] Use AddCXXStdlibLibArgs. NFCI.
Jonas Hahnfeld [Wed, 8 Mar 2017 12:06:44 +0000 (12:06 +0000)]
[XRay] Use AddCXXStdlibLibArgs. NFCI.

This function already does the very same thing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297271 91177308-0d34-0410-b5e6-96231b3b80d8