Commit Graph

68951 Commits

Author SHA1 Message Date
Martin Probst 384232766b 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

llvm-svn: 304791
2017-06-06 12:38:29 +00:00
Florian Hahn 28f03bbcbb [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

llvm-svn: 304781
2017-06-06 09:26:15 +00:00
Sylvestre Ledru 121224d4a4 Fix a mistake in the clang format documentation (BreakBeforeTernaryOperators)
Patch sent through github by Jason Hsu

llvm-svn: 304776
2017-06-06 07:26:19 +00:00
Shoaib Meenai 462f36d36d [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

llvm-svn: 304761
2017-06-06 02:06:28 +00:00
Richard Smith b301806c4b 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.

llvm-svn: 304760
2017-06-06 01:34:24 +00:00
Richard Smith 1893475d95 Retain header search and preprocessing options from AST file when emitting
preprocessed text for an AST file.

llvm-svn: 304756
2017-06-06 00:32:01 +00:00
Richard Smith 3092d728cd 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

llvm-svn: 304745
2017-06-05 22:29:36 +00:00
Richard Smith f878a84cc4 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.

llvm-svn: 304740
2017-06-05 22:05:31 +00:00
Richard Smith 27e5aa0892 Factor out and unify emission of "module is unavailable" diagnostics.
Inspired by post-commit review of r304190.

llvm-svn: 304728
2017-06-05 18:57:56 +00:00
Richard Smith 6b19934915 Attempt to fix Windows buildbot failure due to mismatching directory separators in preprocessed output.
llvm-svn: 304727
2017-06-05 18:39:31 +00:00
Richard Smith ab75597dda 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.

llvm-svn: 304726
2017-06-05 18:10:11 +00:00
Michal Gorny 997f7764be [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

llvm-svn: 304715
2017-06-05 14:13:37 +00:00
Artem Dergachev 7c0ab86932 [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

llvm-svn: 304713
2017-06-05 13:36:28 +00:00
Artem Dergachev fbe891ee05 [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

llvm-svn: 304710
2017-06-05 12:40:03 +00:00
Anastasia Stulova b3398936ab [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

llvm-svn: 304708
2017-06-05 11:27:03 +00:00
Javed Absar 2a67c9ee39 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

llvm-svn: 304705
2017-06-05 10:11:57 +00:00
Renato Golin de72b918f3 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.

llvm-svn: 304697
2017-06-05 07:35:45 +00:00
Krasimir Georgiev 59ed77b813 [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

llvm-svn: 304687
2017-06-04 19:27:02 +00:00
Serge Pavlov 10673c98bd 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.

llvm-svn: 304684
2017-06-04 12:53:12 +00:00
Galina Kistanova 8a338ea43a Fixed warning: enum constant in boolean context.
llvm-svn: 304663
2017-06-03 16:47:06 +00:00
Saleem Abdulrasool 3347b3ab83 tests: silence -Wobjc-root-class warnings
Silence warnings about no ObjC class root for the types defined for the
tests.

llvm-svn: 304662
2017-06-03 16:18:13 +00:00
Saleem Abdulrasool 13d73d53c4 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).

llvm-svn: 304661
2017-06-03 16:18:09 +00:00
Galina Kistanova ddcd2812f5 Added missing break.
llvm-svn: 304653
2017-06-03 06:40:10 +00:00
Galina Kistanova 96088f4d41 Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 304652
2017-06-03 06:38:22 +00:00
Galina Kistanova 333991138b Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 304651
2017-06-03 06:35:06 +00:00
Galina Kistanova f87496d107 Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 304650
2017-06-03 06:31:42 +00:00
Galina Kistanova 0872d6c275 Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 304649
2017-06-03 06:30:46 +00:00
Galina Kistanova efa712444c Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 304648
2017-06-03 06:30:08 +00:00
Galina Kistanova 4c7705c849 Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 304647
2017-06-03 06:29:40 +00:00
Galina Kistanova 27daec6870 Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 304646
2017-06-03 06:29:16 +00:00
Galina Kistanova e37ad5a79e Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 304645
2017-06-03 06:27:16 +00:00
Galina Kistanova a65d5785d8 Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 304644
2017-06-03 06:26:27 +00:00
Galina Kistanova 39edaaa65c Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 304643
2017-06-03 06:25:47 +00:00
Galina Kistanova d321611bfb Added LLVM_FALLTHROUGH to address warning: this statement may fall through + formatted. NFC.
llvm-svn: 304642
2017-06-03 06:25:29 +00:00
Galina Kistanova de7e22123a Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 304641
2017-06-03 06:23:51 +00:00
Galina Kistanova 83b8a6c170 Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 304640
2017-06-03 06:23:19 +00:00
Kostya Serebryany e425aada63 [sanitizer-coverage] one more flavor of coverage: -fsanitize-coverage=inline-8bit-counters. Experimental so far, not documenting yet. (clang part)
llvm-svn: 304631
2017-06-03 01:36:23 +00:00
Eric Fiselier de7943b947 [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

llvm-svn: 304620
2017-06-03 00:22:18 +00:00
Richard Trieu d064d1b6e8 Revert r304592
r304592 - [ODRHash] Add support for TemplateArgument types.
Possibly causing one of the errors in modules build bot.

llvm-svn: 304618
2017-06-03 00:11:23 +00:00
Richard Smith f8ba3fd8e6 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.

llvm-svn: 304604
2017-06-02 22:53:06 +00:00
Richard Trieu 24c302b915 [ODRHash] Add support for TemplateArgument types.
llvm-svn: 304592
2017-06-02 20:35:29 +00:00
Alexey Bader 037dbe9535 [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

llvm-svn: 304575
2017-06-02 18:08:58 +00:00
Benjamin Kramer ee021d54d7 [Modules] Fix use after scope.
Found by asan.

llvm-svn: 304568
2017-06-02 17:30:24 +00:00
Alex Lorenz bbf4f7091f ASTPrinter: Objective-C method declarations don't need a space after
the return type

rdar://32332039

llvm-svn: 304553
2017-06-02 15:02:59 +00:00
Alex Lorenz 01bf58d6ec 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.

llvm-svn: 304542
2017-06-02 11:26:35 +00:00
Alex Lorenz 0bafa02709 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

llvm-svn: 304538
2017-06-02 10:36:56 +00:00
NAKAMURA Takumi c226303d3e clang/test/CodeGenCXX/unaligned-member-qualifier.cpp: Satisfy x86_thiscallcc.
llvm-svn: 304535
2017-06-02 09:53:05 +00:00
Roger Ferrer Ibanez b4aef7963e Remove file that I forgot to remove as part of rL304523
llvm-svn: 304524
2017-06-02 07:21:27 +00:00
Roger Ferrer Ibanez fd9384a229 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

llvm-svn: 304523
2017-06-02 07:14:34 +00:00
Richard Trieu 5fb874a484 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.

llvm-svn: 304519
2017-06-02 04:24:46 +00:00