]> granicus.if.org Git - clang/log
clang
7 years agoWhen determining the target function of an explicit instantiation, make
John McCall [Wed, 7 Jun 2017 23:00:05 +0000 (23:00 +0000)]
When determining the target function of an explicit instantiation, make
sure that non-template functions don't end up in the candidate set.

Fixes PR14211.

Patch by Don Hinton!

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

7 years ago[c++1z] Support deducing B in noexcept(B).
Richard Smith [Wed, 7 Jun 2017 21:46:22 +0000 (21:46 +0000)]
[c++1z] Support deducing B in noexcept(B).

This is not required by the standard (yet), but there seems to be reasonable
support for this being a defect according to CWG discussion, and libstdc++ 7.1
relies on it working.

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

7 years agoFinish revert of "r304929, [mips] Add runtime options to enable/disable madd/sub...
Simon Dardis [Wed, 7 Jun 2017 20:02:24 +0000 (20:02 +0000)]
Finish revert of "r304929, [mips] Add runtime options to enable/disable madd/sub.fmt"

The r304935 missed deleting the test case.

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

7 years agoRevert r304929 [mips] Add runtime options to enable/disable madd/sub.fmt
Petar Jovanovic [Wed, 7 Jun 2017 18:57:56 +0000 (18:57 +0000)]
Revert r304929 [mips] Add runtime options to enable/disable madd/sub.fmt

Revert r304929 since the test broke buildbots.

Original commit:

  [mips] Add runtime options to enable/disable madd.fmt and msub.fmt

  Add options to clang: -mmadd4 and -mno-madd4, use it to enable or disable
  generation of madd.fmt and similar instructions respectively, as per GCC.

  Patch by Stefan Maksimovic.

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

7 years ago[mips] Add runtime options to enable/disable madd.fmt and msub.fmt
Petar Jovanovic [Wed, 7 Jun 2017 17:17:57 +0000 (17:17 +0000)]
[mips] Add runtime options to enable/disable madd.fmt and msub.fmt

Add options to clang: -mmadd4 and -mno-madd4, use it to enable or disable
generation of madd.fmt and similar instructions respectively, as per GCC.

Patch by Stefan Maksimovic.

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

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

7 years ago[clang-format] Fix alignment of preprocessor trailing comments
Krasimir Georgiev [Wed, 7 Jun 2017 14:05:06 +0000 (14:05 +0000)]
[clang-format] Fix alignment of preprocessor trailing comments

Summary:
This patch is a follow-up of https://reviews.llvm.org/rL304687, which fixed an
overflow in the comment alignment code in clang-format. The token length of
trailing comments of preprocessor directives is calculated incorrectly by
including the text between consecutive directives. That causes them to not being
aligned.

For example, in this code with column limit 20
```
#if A
#else  // A
int iiii;
#endif // B
```
the length of the token `// A` was wrongly calculated as 14 = 5 (the size of `// A\n`) plus 9 (the size of `int iiii;`) and so `// A` wouldn't be aligned with `// B` and this was produced:
```
#if A
#else // A
int iiii;
#endif // B
```

This patch fixes this case.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: cfe-commits, klimek

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

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

7 years agoclang-format: [JS] recognize exported type definitions.
Martin Probst [Wed, 7 Jun 2017 12:53:22 +0000 (12:53 +0000)]
clang-format: [JS] recognize exported type definitions.

Summary: Support "export type T = {...};", in addition to just "type T = {...};".

Reviewers: klimek

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

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

7 years agoOnly print registered targets for `--version`
Dimitry Andric [Wed, 7 Jun 2017 12:05:41 +0000 (12:05 +0000)]
Only print registered targets for `--version`

Summary:
In D33900, I added printing of the registered targets in clang's
`PrintVersion` function, which is not only used for `--version` output,
but also for `-v` (verbose mode) and `-###`.  Especially the latter
seems to trip up some test cases, so it is probably better to only print
the registered targets for `--version`.

Reviewers: nemanjai, mehdi_amini

Reviewed By: nemanjai

Subscribers: cfe-commits

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

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

7 years ago[CodeGen] Add thumb-mode to target-features for arm/thumb triples.
Florian Hahn [Wed, 7 Jun 2017 11:50:45 +0000 (11:50 +0000)]
[CodeGen] Add thumb-mode to target-features for arm/thumb triples.

Summary:
The thumb-mode target feature is used to force Thumb or ARM code
generation on a per-function basis. Explicitly adding +thumb-mode to
functions for thumbxx triples enables mixed ARM/Thumb code generation in
places where compilation units with thumbxx and armxx triples are merged
together (e.g. the IR linker or LTO).

For armxx triples, -thumb-mode is added in a similar fashion.

Reviewers: echristo, t.p.northover, kristof.beyls, rengolin

Reviewed By: echristo

Subscribers: rinon, aemerson, mehdi_amini, javed.absar, cfe-commits

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

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

7 years ago[Sema] Silence unused variable warning.
Benjamin Kramer [Wed, 7 Jun 2017 10:23:17 +0000 (10:23 +0000)]
[Sema] Silence unused variable warning.

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

7 years ago[ARM] Fix Neon vector type alignment to 64-bit
Javed Absar [Wed, 7 Jun 2017 10:02:02 +0000 (10:02 +0000)]
[ARM] Fix Neon vector type alignment to 64-bit

This is restricted version of patch - https://reviews.llvm.org/D33205
that I reverted as it was leading to ABI breaks on darwin etc.
This patch restricts the fix to AAPCS (Android remains 128-bit).
Reviewed by: Renato Golin, Stephen Hines
Differential Revision: https://reviews.llvm.org/D33786

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

7 years ago[Driver] Add test to cover case when LSan is not supported
Maxim Ostapenko [Wed, 7 Jun 2017 08:51:15 +0000 (08:51 +0000)]
[Driver] Add test to cover case when LSan is not supported

This commit adds a testcase for uncovered code paths in LSan options parsing logic in driver.

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

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Wed, 7 Jun 2017 06:31:55 +0000 (06:31 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Wed, 7 Jun 2017 06:25:05 +0000 (06:25 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoUpdate libdeps to add BinaryFormat, introduced in r304864.
NAKAMURA Takumi [Wed, 7 Jun 2017 04:48:49 +0000 (04:48 +0000)]
Update libdeps to add BinaryFormat, introduced in r304864.

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

7 years agoReorder and reformat.
NAKAMURA Takumi [Wed, 7 Jun 2017 04:48:45 +0000 (04:48 +0000)]
Reorder and reformat.

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

7 years agoFixed warning: 'virtual void clang::ExternalASTSource::CompleteType(clang::ObjCInterf...
Galina Kistanova [Wed, 7 Jun 2017 02:44:42 +0000 (02:44 +0000)]
Fixed warning: 'virtual void clang::ExternalASTSource::CompleteType(clang::ObjCInterfaceDecl*)' was hidden.

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

7 years agoFix a couple of class template argument deduction crashes with libc++'s tuple.
Richard Smith [Wed, 7 Jun 2017 02:42:27 +0000 (02:42 +0000)]
Fix a couple of class template argument deduction crashes with libc++'s tuple.

RecursiveASTVisitor was not properly recursing through a
SubstTemplateTypeParmTypes, resulting in crashes in pack expansion where we
couldn't always find an unexpanded pack within a pack expansion.

We also have an issue where substitution of deduced template arguments for an
implicit deduction guide creates the "impossible" case of naming a
non-dependent member of the current instantiation, but within a specialization
that is actually instantiated from a different (partial/explicit)
specialization of the template. We resolve this by declaring that constructors
that do so can only be used to deduce specializations of the primary template.
I'm running this past CWG to see if people agree this is the right thing to do.

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

7 years ago[WebAssembly] Set MaxAtomicInlineWidth to 64.
Dan Gohman [Wed, 7 Jun 2017 02:22:40 +0000 (02:22 +0000)]
[WebAssembly] Set MaxAtomicInlineWidth to 64.

The WebAssembly threads proposal has changed such that C++
implementations can now declare that atomics up to 64 bits are
"lock free" in C++'s terms.

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

7 years agoImprove error recovery for missing 'template' keyword in contexts where the
Richard Smith [Wed, 7 Jun 2017 00:29:44 +0000 (00:29 +0000)]
Improve error recovery for missing 'template' keyword in contexts where the
template is valid with or without it (with different meanings).

If we see "dependent.x<...", and what follows the '<' is a valid expression,
we must parse the '<' as a comparison rather than a template angle bracket.
When we later come to instantiate, if we find that the LHS of the '<' actually
names an overload set containing function templates, produce a diagnostic
suggesting that the 'template' keyword was missed rather than producing a
mysterious diagnostic saying that the function must be called (and pointing
at what looks to already be a function call!).

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

7 years ago[DOXYGEN] Corrected several typos and incorrect parameters description that Sony...
Ekaterina Romanova [Tue, 6 Jun 2017 22:58:01 +0000 (22:58 +0000)]
[DOXYGEN] Corrected several typos and incorrect parameters description that Sony's techinical writer found during review.

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

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

7 years agoPrint registered targets in clang's version information
Dimitry Andric [Tue, 6 Jun 2017 21:54:21 +0000 (21:54 +0000)]
Print registered targets in clang's version information

Summary:
Other llvm tools display their registered targets when showing version
information, but for some reason clang has never done this.

To support this, D33899 adds the llvm parts, which make it possible to
print version information to arbitrary raw_ostreams.  This change adds
a call to printRegisteredTargetsForVersion in clang's PrintVersion, and
adds a raw_ostream parameter to two other PrintVersion functions.

Reviewers: beanz, chandlerc, dberris, mehdi_amini, zturner

Reviewed By: mehdi_amini

Subscribers: cfe-commits

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

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

7 years ago[clang] Remove double semicolons. NFC.
Mandeep Singh Grang [Tue, 6 Jun 2017 19:47:56 +0000 (19:47 +0000)]
[clang] Remove double semicolons. NFC.

Reviewers: rsmith, craig.topper, efriedma

Reviewed By: efriedma

Subscribers: efriedma, cfe-commits

Tags: #clang-c

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

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

7 years agoclang-format: [JS] Correctly Indent Nested JavaScript Literals.
Martin Probst [Tue, 6 Jun 2017 12:38:29 +0000 (12:38 +0000)]
clang-format: [JS] Correctly Indent Nested JavaScript Literals.

Nested literals are sometimes only indented by 2 spaces, instead of
respecting the IndentWidth option.
There are existing unit tests (FormatTestJS.ArrayLiterals) that only
pass because the style used to test them uses an IndentWidth of 2.
This change removes the magic 2 and always uses the IndentWidth.
I've added 6 tests. The first 4 of these tests fail before this change,
while the last 2 already pass, but were added just to make sure it the
change works with all types of braces.

Patch originally by Jared Neil, thanks!

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

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

7 years ago[ARM] Add support for target("arm") and target("thumb").
Florian Hahn [Tue, 6 Jun 2017 09:26:15 +0000 (09:26 +0000)]
[ARM] Add support for target("arm") and target("thumb").

Summary:
This patch adds support for the target("arm") and target("thumb")
attributes, which can be used to force the compiler to generated ARM or
Thumb code for a function.

In LLVM, ARM or Thumb code generation can be controlled by the
thumb-mode target feature. But GCC already uses target("arm") and
target("thumb"), so we have to substitute "arm" with -thumb-mode and
"thumb" with +thumb-mode.

Reviewers: echristo, pcc, kristof.beyls

Reviewed By: echristo

Subscribers: ahatanak, aemerson, javed.absar, kristof.beyls, cfe-commits

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

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

7 years agoFix a mistake in the clang format documentation (BreakBeforeTernaryOperators)
Sylvestre Ledru [Tue, 6 Jun 2017 07:26:19 +0000 (07:26 +0000)]
Fix a mistake in the clang format documentation (BreakBeforeTernaryOperators)
Patch sent through github by Jason Hsu

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

7 years ago[Driver] Don't force .exe suffix for lld
Shoaib Meenai [Tue, 6 Jun 2017 02:06:28 +0000 (02:06 +0000)]
[Driver] Don't force .exe suffix for lld

When cross-compiling to Windows using lld, we want the driver to invoke
it as lld-link rather than lld-link.exe. On Windows, the LLVM fs
functions take care of adding the .exe suffix where necessary, so we can
just drop the addition in the toolchain entirely.

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

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

7 years agoPR33318: Add missing full-expression checking to static_assert expression.
Richard Smith [Tue, 6 Jun 2017 01:34:24 +0000 (01:34 +0000)]
PR33318: Add missing full-expression checking to static_assert expression.

This fixes missing lambda-captures for variables referenced only inside a
static_assert (!), among other things.

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

7 years agoRetain header search and preprocessing options from AST file when emitting
Richard Smith [Tue, 6 Jun 2017 00:32:01 +0000 (00:32 +0000)]
Retain header search and preprocessing options from AST file when emitting
preprocessed text for an AST file.

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

7 years agoFix crash when an 'import a module' TypoCorrection has its CorrectionDecls
Richard Smith [Mon, 5 Jun 2017 22:29:36 +0000 (22:29 +0000)]
Fix crash when an 'import a module' TypoCorrection has its CorrectionDecls
replaced by visible decls.

Make sure that all paths through checkCorrectionVisibility set the
RequiresImport flag appropriately, so we don't end up using a stale value.
Patch by Jorge Gorbe!

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

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

7 years agoFix memory leak exposed by r304726.
Richard Smith [Mon, 5 Jun 2017 22:05:31 +0000 (22:05 +0000)]
Fix memory leak exposed by r304726.

When giving a ContentCache a null buffer, ignore the DoNotFree flag rather than
inheriting it onto whatever buffer we end up using for the file. Also ensure
that the main buffer is properly destroyed.

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

7 years agoFactor out and unify emission of "module is unavailable" diagnostics.
Richard Smith [Mon, 5 Jun 2017 18:57:56 +0000 (18:57 +0000)]
Factor out and unify emission of "module is unavailable" diagnostics.

Inspired by post-commit review of r304190.

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

7 years agoAttempt to fix Windows buildbot failure due to mismatching directory separators in...
Richard Smith [Mon, 5 Jun 2017 18:39:31 +0000 (18:39 +0000)]
Attempt to fix Windows buildbot failure due to mismatching directory separators in preprocessed output.

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

7 years agoRather than rejecting attempts to run preprocessor-only actions on AST files,
Richard Smith [Mon, 5 Jun 2017 18:10:11 +0000 (18:10 +0000)]
Rather than rejecting attempts to run preprocessor-only actions on AST files,
replay the steps taken to create the AST file with the preprocessor-only action
installed to produce preprocessed output.

This can be used to produce the preprocessed text for an existing .pch or .pcm
file.

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

7 years ago[test] Fix baremetal test to allow any -resource-dir
Michal Gorny [Mon, 5 Jun 2017 14:13:37 +0000 (14:13 +0000)]
[test] Fix baremetal test to allow any -resource-dir

The baremetal test (r303873) has been added with expectance of very
specific -resource-dir. However, the test itself nor the BareMetal
driver does not enforce any specific -resource-dir, making this
constraint invalid. It already has been altered twice -- in r303910 for
Windows compatibility, and in r304085 for systems using lib64. To
account for even more systems, just use [[RESOURCE_DIR]] like a number
of other tests do. This is needed for Gentoo where RESOURCE_DIR starts
with ../ (uses relative path to a parent directory).

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

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

7 years ago[analyzer] Don't add arrow to the inlined function's decl when it has no body.
Artem Dergachev [Mon, 5 Jun 2017 13:36:28 +0000 (13:36 +0000)]
[analyzer] Don't add arrow to the inlined function's decl when it has no body.

In plist output mode with alternate path diagnostics, when entering a function,
we draw an arrow from the caller to the beginning of the callee's declaration.
Upon exiting, however, we draw the arrow from the last statement in the
callee function. The former makes little sense when the declaration is
not a definition, i.e. has no body, which may happen in case the body
is coming from a body farm, eg. Objective-C autosynthesized property accessor.

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

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

7 years ago[analyzer] Nullability: fix notes around synthesized ObjC property accessors.
Artem Dergachev [Mon, 5 Jun 2017 12:40:03 +0000 (12:40 +0000)]
[analyzer] Nullability: fix notes around synthesized ObjC property accessors.

Nullable-to-nonnull checks used to crash when the custom bug visitor was trying
to add its notes to autosynthesized accessors of Objective-C properties.

Now we avoid this, mostly automatically outside of checker control, by
moving the diagnostic to the parent stack frame where the accessor has been
called.

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

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

7 years ago[OpenCL] Fix pipe size in TypeInfo.
Anastasia Stulova [Mon, 5 Jun 2017 11:27:03 +0000 (11:27 +0000)]
[OpenCL] Fix pipe size in TypeInfo.

Pipes are now the size of pointers rather than the size
of the type that they contain.

Patch by Simon Perretta!

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

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

7 years agoAdd support for #pragma clang section
Javed Absar [Mon, 5 Jun 2017 10:11:57 +0000 (10:11 +0000)]
Add support for #pragma clang section

This patch provides a means to specify section-names for global variables,
functions and static variables, using #pragma directives.
This feature is only defined to work sensibly for ELF targets.
One can specify section names as:
#pragma clang section bss="myBSS" data="myData" rodata="myRodata" text="myText"
One can "unspecify" a section name with empty string e.g.
#pragma clang section bss="" data="" text="" rodata=""

Reviewers: Roger Ferrer, Jonathan Roelofs, Reid Kleckner
Differential Revision: https://reviews.llvm.org/D33412

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

7 years agoRevert "[sanitizer-coverage] one more flavor of coverage: -fsanitize-coverage=inline...
Renato Golin [Mon, 5 Jun 2017 07:35:45 +0000 (07:35 +0000)]
Revert "[sanitizer-coverage] one more flavor of coverage: -fsanitize-coverage=inline-8bit-counters. Experimental so far, not documenting yet. (clang part)"

This reverts commit r304631, as it broke ARM/AArch64 bots for 2 days.

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

7 years ago[clang-format] Don't align too long broken trailing comments
Krasimir Georgiev [Sun, 4 Jun 2017 19:27:02 +0000 (19:27 +0000)]
[clang-format] Don't align too long broken trailing comments

Summary:
This patch fixes a bug where clang-format will align newly broken trailing
comments even if this will make them exceed the line limit. The bug was caused
by a combination of unsigned arithmetic overflow and an imprecise computation
of the length of broken comment lines.

Reviewers: djasper, alexfh

Reviewed By: alexfh

Subscribers: klimek

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

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

7 years agoImplement isDefined by call to isThisDeclarationADefinition.
Serge Pavlov [Sun, 4 Jun 2017 12:53:12 +0000 (12:53 +0000)]
Implement isDefined by call to isThisDeclarationADefinition.

Modifies FunctionDecl::isThisDeclarationADefinition so that it covers
all the cases checked by FunctionDecl::isDefined. Implements the latter
method by call to isThisDeclarationADefinition.

This change is a part of the patch D30170.

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

7 years agoFixed warning: enum constant in boolean context.
Galina Kistanova [Sat, 3 Jun 2017 16:47:06 +0000 (16:47 +0000)]
Fixed warning: enum constant in boolean context.

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

7 years agotests: silence -Wobjc-root-class warnings
Saleem Abdulrasool [Sat, 3 Jun 2017 16:18:13 +0000 (16:18 +0000)]
tests: silence -Wobjc-root-class warnings

Silence warnings about no ObjC class root for the types defined for the
tests.

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

7 years agoCodeGen: fix section names for different file formats
Saleem Abdulrasool [Sat, 3 Jun 2017 16:18:09 +0000 (16:18 +0000)]
CodeGen: fix section names for different file formats

This changes the codegen to match the section names according to the
ObjC rewriter as well as the runtime.  The changes to the test are
simply whitespace changes to the section attributes and names and are
functionally equivalent (the whitespace is ignored by the linker).

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

7 years agoAdded missing break.
Galina Kistanova [Sat, 3 Jun 2017 06:40:10 +0000 (06:40 +0000)]
Added missing break.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Sat, 3 Jun 2017 06:38:22 +0000 (06:38 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Sat, 3 Jun 2017 06:35:06 +0000 (06:35 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Sat, 3 Jun 2017 06:31:42 +0000 (06:31 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Sat, 3 Jun 2017 06:30:46 +0000 (06:30 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Sat, 3 Jun 2017 06:30:08 +0000 (06:30 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Sat, 3 Jun 2017 06:29:40 +0000 (06:29 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Sat, 3 Jun 2017 06:29:16 +0000 (06:29 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Sat, 3 Jun 2017 06:27:16 +0000 (06:27 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Sat, 3 Jun 2017 06:26:27 +0000 (06:26 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Sat, 3 Jun 2017 06:25:47 +0000 (06:25 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through + formatte...
Galina Kistanova [Sat, 3 Jun 2017 06:25:29 +0000 (06:25 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through + formatted. NFC.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Sat, 3 Jun 2017 06:23:51 +0000 (06:23 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Sat, 3 Jun 2017 06:23:19 +0000 (06:23 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years ago[sanitizer-coverage] one more flavor of coverage: -fsanitize-coverage=inline-8bit...
Kostya Serebryany [Sat, 3 Jun 2017 01:36:23 +0000 (01:36 +0000)]
[sanitizer-coverage] one more flavor of coverage: -fsanitize-coverage=inline-8bit-counters. Experimental so far, not documenting yet. (clang part)

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

7 years ago[coroutines] Fix rebuilding of dependent coroutine parameters
Eric Fiselier [Sat, 3 Jun 2017 00:22:18 +0000 (00:22 +0000)]
[coroutines] Fix rebuilding of dependent coroutine parameters

Summary:
We were not handling correctly rebuilding of parameter and were not creating copies for them.
Now we will always rebuild parameter moves in TreeTransform's TransformCoroutineBodyStmt.

Reviewers: rsmith, GorNishanov

Reviewed By: rsmith

Subscribers: cfe-commits

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

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

7 years agoRevert r304592
Richard Trieu [Sat, 3 Jun 2017 00:11:23 +0000 (00:11 +0000)]
Revert r304592

r304592 - [ODRHash] Add support for TemplateArgument types.
Possibly causing one of the errors in modules build bot.

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

7 years agoFix assertion failure if we can't deduce a template argument for a variable
Richard Smith [Fri, 2 Jun 2017 22:53:06 +0000 (22:53 +0000)]
Fix assertion failure if we can't deduce a template argument for a variable
template partial specialization.

In passing, fix the deduction-crash.cpp test to actually run all the tests. Due
to a typo, the last third of the file was being skipped by the parser and some
of the tests were not actually testing anything as a result. Switch from
FileCheck to -verify to make the problem more obvious and prevent this
happening again.

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

7 years ago[ODRHash] Add support for TemplateArgument types.
Richard Trieu [Fri, 2 Jun 2017 20:35:29 +0000 (20:35 +0000)]
[ODRHash] Add support for TemplateArgument types.

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

7 years ago[OpenCL] Harden function pointer diagnostics.
Alexey Bader [Fri, 2 Jun 2017 18:08:58 +0000 (18:08 +0000)]
[OpenCL] Harden function pointer diagnostics.

Summary: Improve OpenCL type checking by rejecting function pointer types.

Reviewers: Anastasia, yaxunl

Reviewed By: Anastasia

Subscribers: cfe-commits

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

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

7 years ago[Modules] Fix use after scope.
Benjamin Kramer [Fri, 2 Jun 2017 17:30:24 +0000 (17:30 +0000)]
[Modules] Fix use after scope.

Found by asan.

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

7 years agoASTPrinter: Objective-C method declarations don't need a space after
Alex Lorenz [Fri, 2 Jun 2017 15:02:59 +0000 (15:02 +0000)]
ASTPrinter: Objective-C method declarations don't need a space after
the return type

rdar://32332039

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

7 years agoTie the macOS tests in test/Integration to the latest macOS SDK
Alex Lorenz [Fri, 2 Jun 2017 11:26:35 +0000 (11:26 +0000)]
Tie the macOS tests in test/Integration to the latest macOS SDK

This change will ensure that these tests won't fail when a new SDK that
utilizes new compiler features is used.
See https://reviews.llvm.org/D32178 for more context.

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

7 years agoAvoid calling report_fatal_error in the destructor of raw_fd_ostream
Alex Lorenz [Fri, 2 Jun 2017 10:36:56 +0000 (10:36 +0000)]
Avoid calling report_fatal_error in the destructor of raw_fd_ostream
when saving a module timestamp file

This commit doesn't include a test as it requires a test that reproduces
a file write/close error that couldn't really be constructed artificially.

rdar://31860650

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

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

7 years agoclang/test/CodeGenCXX/unaligned-member-qualifier.cpp: Satisfy x86_thiscallcc.
NAKAMURA Takumi [Fri, 2 Jun 2017 09:53:05 +0000 (09:53 +0000)]
clang/test/CodeGenCXX/unaligned-member-qualifier.cpp: Satisfy x86_thiscallcc.

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

7 years agoRemove file that I forgot to remove as part of rL304523
Roger Ferrer Ibanez [Fri, 2 Jun 2017 07:21:27 +0000 (07:21 +0000)]
Remove file that I forgot to remove as part of rL304523

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

7 years agoMangle __unaligned in Itanium ABI
Roger Ferrer Ibanez [Fri, 2 Jun 2017 07:14:34 +0000 (07:14 +0000)]
Mangle __unaligned in Itanium ABI

__unaligned is not currently mangled in any way in the Itanium ABI. This causes
failures when using -fms-extensions and C++ in targets using Itanium ABI.

As suggested by @rsmith the simplest thing to do here is actually mangle the
qualifier as a vendor extension.

This patch also removes the change done in D31976 and updates its test to the
new reality.

This fixes
  https://bugs.llvm.org/show_bug.cgi?id=33080
  https://bugs.llvm.org/show_bug.cgi?id=33178

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

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

7 years agoMinor fixes to for-loop warning.
Richard Trieu [Fri, 2 Jun 2017 04:24:46 +0000 (04:24 +0000)]
Minor fixes to for-loop warning.

The warning for unchanged loop variables outputted a diagnostic that was
dependent on iteration order from a pointer set, which is not always
deterministic.  Switch to a set vector, which allows fast querying and
preserves ordering.

Also make other minor changes in this area.
Use more range-based for-loops.
Remove limitation on SourceRanges that no logner exists.

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

7 years agoSupport lazy stat'ing of files referenced by module maps.
Richard Smith [Fri, 2 Jun 2017 01:55:39 +0000 (01:55 +0000)]
Support lazy stat'ing of files referenced by module maps.

This patch adds support for a `header` declaration in a module map to specify
certain `stat` information (currently, size and mtime) about that header file.
This has two purposes:

- It removes the need to eagerly `stat` every file referenced by a module map.
  Instead, we track a list of unresolved header files with each size / mtime
  (actually, for simplicity, we track submodules with such headers), and when
  attempting to look up a header file based on a `FileEntry`, we check if there
  are any unresolved header directives with that `FileEntry`'s size / mtime and
  perform deferred `stat`s if so.

- It permits a preprocessed module to be compiled without the original files
  being present on disk. The only reason we used to need those files was to get
  the `stat` information in order to do header -> module lookups when using the
  module. If we're provided with the `stat` information in the preprocessed
  module, we can avoid requiring the files to exist.

Unlike most `header` directives, if a `header` directive with `stat`
information has no corresponding on-disk file the enclosing module is *not*
marked unavailable (so that behavior is consistent regardless of whether we've
resolved a header directive, and so that preprocessed modules don't get marked
unavailable). We could actually do this for all `header` directives: the only
reason we mark the module unavailable if headers are missing is to give a
diagnostic slightly earlier (rather than waiting until we actually try to build
the module / load and validate its .pcm file).

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

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

7 years agoRevert "[AArch64] Add ARMv8.2-A FP16 vefctor intrinsics"
Vedant Kumar [Fri, 2 Jun 2017 01:22:14 +0000 (01:22 +0000)]
Revert "[AArch64] Add ARMv8.2-A FP16 vefctor intrinsics"

This reverts commit r304493. It breaks all the Darwin bots:
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental_check/37168

Failure:
Failing Tests (2):
    Clang :: CodeGen/aarch64-v8.2a-neon-intrinsics.c
    Clang :: CodeGen/arm_neon_intrinsics.c

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

7 years ago[Sema] Improve -Wstrict-prototypes diagnostic message for blocks.
Akira Hatanaka [Fri, 2 Jun 2017 01:07:08 +0000 (01:07 +0000)]
[Sema] Improve -Wstrict-prototypes diagnostic message for blocks.

Print "this block declaration is not a prototype" for non-prototype
declarations of blocks instead of "this function declaration ...".

rdar://problem/32461723

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

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

7 years agoPR32848: There isn't necessarily a FileChanged or FileSkipped for every InclusionDire...
Richard Smith [Fri, 2 Jun 2017 01:05:44 +0000 (01:05 +0000)]
PR32848: There isn't necessarily a FileChanged or FileSkipped for every InclusionDirective callback.

In particular, you don't get one if the inclusion directive encountered an
error. Don't assert in that case.

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

7 years ago[ThinLTO] Add x86 requires to thin_link_bitcode. NFC.
Tim Shen [Fri, 2 Jun 2017 00:08:58 +0000 (00:08 +0000)]
[ThinLTO] Add x86 requires to thin_link_bitcode. NFC.

It already specifies the triples, so the intention was to test x86 for
now (or then).

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

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

7 years ago[CodeGen] Surround assertion with parentheses.
Davide Italiano [Thu, 1 Jun 2017 23:55:18 +0000 (23:55 +0000)]
[CodeGen] Surround assertion with parentheses.

This should placate GCC's -Wparentheses.

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

7 years ago[ThinLTO] Wire up ThinLTO and new PM
Tim Shen [Thu, 1 Jun 2017 23:27:51 +0000 (23:27 +0000)]
[ThinLTO] Wire up ThinLTO and new PM

Summary: This patch teaches clang to use and propagate new PM in ThinLTO.

Reviewers: davide, chandlerc, tejohnson

Subscribers: mehdi_amini, Prazek, inglorion, cfe-commits

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

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

7 years ago[AArch64] Add ARMv8.2-A FP16 vefctor intrinsics
Abderrazek Zaafrani [Thu, 1 Jun 2017 23:22:29 +0000 (23:22 +0000)]
[AArch64] Add ARMv8.2-A FP16 vefctor intrinsics

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

7 years agoRelax test to try and appease builders. NFC.
Vedant Kumar [Thu, 1 Jun 2017 22:27:39 +0000 (22:27 +0000)]
Relax test to try and appease builders. NFC.

I'm not sure why, but on some bots, the order of two instructions are
swapped (as compared to the output on my machine). Loosen up the
CHECK-NEXT directives to deal with this.

Failing bot: http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/3097

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Thu, 1 Jun 2017 21:29:45 +0000 (21:29 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Thu, 1 Jun 2017 21:28:26 +0000 (21:28 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Thu, 1 Jun 2017 21:26:38 +0000 (21:26 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Thu, 1 Jun 2017 21:23:52 +0000 (21:23 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Thu, 1 Jun 2017 21:21:49 +0000 (21:21 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Thu, 1 Jun 2017 21:19:06 +0000 (21:19 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Thu, 1 Jun 2017 21:15:34 +0000 (21:15 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years ago[CGDebugInfo] Finalize SubPrograms when we're done with them
Keno Fischer [Thu, 1 Jun 2017 21:14:03 +0000 (21:14 +0000)]
[CGDebugInfo] Finalize SubPrograms when we're done with them

`GenerateVarArgsThunk` in `CGVTables` clones a function before the frontend
is done emitting the compilation unit. Because of the way that DIBuilder
works, this means that the attached subprogram had incomplete (temporary)
metadata. Cloning such metadata is semantically disallowed, but happened
to work anyway due to bugs in the cloning logic. rL304226 attempted to fix
up that logic, but in the process exposed the incorrect API use here and
had to be reverted. To be able to fix this, I added a new method to
DIBuilder in rL304467, to allow finalizing a subprogram independently
of the entire compilation unit. Use that here, in preparation of re-applying
rL304226.

Reviewers: aprantl, dblaikie
Differential Revision: https://reviews.llvm.org/D33705

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

7 years agoDon't assume that a store source is a vector type just because the destination is...
Simon Pilgrim [Thu, 1 Jun 2017 20:13:34 +0000 (20:13 +0000)]
Don't assume that a store source is a vector type just because the destination is (PR26099)

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

7 years agoEscape filenames in module map line marker directives, to unbreak Windows build bots.
Richard Smith [Thu, 1 Jun 2017 20:10:35 +0000 (20:10 +0000)]
Escape filenames in module map line marker directives, to unbreak Windows build bots.

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

7 years ago[Modules] Handle sanitizer feature mismatches when importing modules
Vedant Kumar [Thu, 1 Jun 2017 20:01:01 +0000 (20:01 +0000)]
[Modules] Handle sanitizer feature mismatches when importing modules

This patch makes it an error to have a mismatch between the enabled
sanitizers in a CU, and in any module being imported into the CU. Only
mismatches between non-modular sanitizers are treated as errors.

This patch also includes non-modular sanitizers in module hashes, in
order to ensure module rebuilds occur when -fsanitize=X is toggled on
and off for non-modular sanitizers, and to cut down on module rebuilds
when the option is toggled for modular sanitizers.

This fixes a longstanding issue with implicit modules and sanitizers,
which Duncan originally diagnosed.

When building with implicit modules it's possible to hit a scenario
where modules are built without -fsanitize=address, and are subsequently
imported into CUs with -fsanitize=address enabled. This causes strange
failures at runtime. The case Duncan found affects libcxx, since its
vector implementation behaves differently when ASan is enabled.

Implicit module builds should "just work" when -fsanitize=X is toggled
on and off across multiple compiler invocations, which is what this
patch does.

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

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

7 years ago[ubsan] Add a check for pointer overflow UB
Vedant Kumar [Thu, 1 Jun 2017 19:22:18 +0000 (19:22 +0000)]
[ubsan] Add a check for pointer overflow UB

Check pointer arithmetic for overflow.

For some more background on this check, see:

  https://wdtz.org/catching-pointer-overflow-bugs.html
  https://reviews.llvm.org/D20322

Patch by Will Dietz and John Regehr!

This version of the patch is different from the original in a few ways:

  - It introduces the EmitCheckedInBoundsGEP utility which inserts
    checks when the pointer overflow check is enabled.

  - It does some constant-folding to reduce instrumentation overhead.

  - It does not check some GEPs in CGExprCXX. I'm not sure that
    inserting checks here, or in CGClass, would catch many bugs.

Possible future directions for this check:

  - Introduce CGF.EmitCheckedStructGEP, to detect overflows when
    accessing structures.

Testing: Apart from the added lit test, I ran check-llvm and check-clang
with a stage2, ubsan-instrumented clang. Will and John have also done
extensive testing on numerous open source projects.

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

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

7 years agoAdd compatibility alias for -Wno-#warnings
David Blaikie [Thu, 1 Jun 2017 19:08:34 +0000 (19:08 +0000)]
Add compatibility alias for -Wno-#warnings

GCC uses -Wno-cpp for this, so seems reasonable to add an alias to
match.

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

7 years agoFixed broken test (strict-vtable-pointers)
Piotr Padlewski [Thu, 1 Jun 2017 19:08:05 +0000 (19:08 +0000)]
Fixed broken test (strict-vtable-pointers)

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

7 years ago[SemaCXX] Add diagnostics to require_constant_initialization
Keno Fischer [Thu, 1 Jun 2017 18:54:16 +0000 (18:54 +0000)]
[SemaCXX] Add diagnostics to require_constant_initialization

Summary:
This hooks up the detailed diagnostics of why constant initialization was
not possible if require_constant_initialization reports an error.
I have updated the test to account for the new notes.

Reviewed By: EricWF
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D24371

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

7 years ago[CodeGen][ObjC] Fix assertion failure in EmitARCStoreStrongCall.
Akira Hatanaka [Thu, 1 Jun 2017 18:41:25 +0000 (18:41 +0000)]
[CodeGen][ObjC] Fix assertion failure in EmitARCStoreStrongCall.

The assertion fails because EmitValueForIvarAtOffset doesn't get the
correct type of the ivar when the class the ivar belongs to is
parameterized. This commit fixes the function to compute the ivar's type
based on the type argument provided to the parameterized class.

rdar://problem/32461723

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

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

7 years agoEmit invariant.group.barrier when using union field
Piotr Padlewski [Thu, 1 Jun 2017 18:39:34 +0000 (18:39 +0000)]
Emit invariant.group.barrier when using union field

Summary:
We need to emit barrier if the union field
is CXXRecordDecl because it might have vptrs. The testcode
was wrongly devirtualized. It also proves that having different
groups for different dynamic types is not sufficient.

Reviewers: rjmccall, rsmith, mehdi_amini

Subscribers: amharc, cfe-commits

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

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

7 years agoStrip trailing whitespace. NFCI.
Simon Pilgrim [Thu, 1 Jun 2017 18:17:18 +0000 (18:17 +0000)]
Strip trailing whitespace. NFCI.

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