Commit Graph

78040 Commits

Author SHA1 Message Date
Richard Smith e867e98314 [c++2a] Improve diagnostic for use of declaration from another TU's
global module fragment.

We know that the declaration in question should have been introduced by
a '#include', so try to figure out which one and suggest it. Don't
suggest importing the global module fragment itself!

llvm-svn: 358631
2019-04-18 00:56:58 +00:00
Alexander Kornienko 68be322987 [clang-format] Remove unused Environment constructor.
llvm-svn: 358630
2019-04-18 00:36:51 +00:00
Akira Hatanaka f8268f67f5 Move the implementation of getInnermostBlockDecl to the .cpp file to fix
failing bots.

llvm-svn: 358627
2019-04-18 00:00:16 +00:00
Douglas Yung 3333cc6643 Fix test on PS4 which defaults to gnu99 which does not emit the expected warnings.
llvm-svn: 358626
2019-04-18 00:00:06 +00:00
Akira Hatanaka ac57af3284 [Sema][ObjC] Don't warn about an implicitly retained self if the
retaining block and all of the enclosing blocks are non-escaping.

If the block implicitly retaining self doesn't escape, there is no risk
of creating retain cycles, so clang shouldn't diagnose it and force
users to add self-> to silence the diagnostic.

Also, fix a bug where clang was failing to diagnose an implicitly
retained self inside a c++ lambda nested inside a block.

rdar://problem/25059955

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

llvm-svn: 358624
2019-04-17 23:14:44 +00:00
Kristof Umann 25e592e522 [analyzer] PR41185: Fix regression where __builtin_* functions weren't recognized
For the following code snippet:

void builtin_function_call_crash_fixes(char *c) {
  __builtin_strncpy(c, "", 6);
  __builtin_memset(c, '\0', (0));
  __builtin_memcpy(c, c, 0);
}
security.insecureAPI.DeprecatedOrUnsafeBufferHandling caused a regression, as it
didn't recognize functions starting with __builtin_. Fixed exactly that.

I wanted to modify an existing test file, but the two I found didn't seem like
perfect candidates. While I was there, I prettified their RUN: lines.

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

llvm-svn: 358609
2019-04-17 19:56:40 +00:00
Alexey Bataev dc9e7dcbb0 [OPENMP][NVPTX]Run combined constructs with if clause in SPMD mode.
All target-parallel-based constructs can be run in SPMD mode from now
on. Even if num_threads clauses or if clauses are used, such constructs
can be executed in SPMD mode.

llvm-svn: 358595
2019-04-17 16:53:08 +00:00
Amy Huang 57f686310e Remove --show-includes flag in crash reduce script
llvm-svn: 358590
2019-04-17 16:20:56 +00:00
Louis Dionne 491ff04a49 Explicitly say we don't define new/delete in libc++ during Apple stage1 bootstrap
This is not necessary in stage2 because we don't even build libc++.dylib
there.

llvm-svn: 358582
2019-04-17 14:58:59 +00:00
Haojian Wu f2879d8a48 [clang-tidy] Add fix descriptions to clang-tidy checks.
Summary:
Motivation/Context: in the code review system integrating with clang-tidy,
clang-tidy doesn't provide a human-readable description of the fix. Usually
developers have to preview a code diff (before vs after apply the fix) to
understand what the fix does before applying a fix.

This patch proposes that each clang-tidy check provides a short and
actional fix description that can be shown in the UI, so that users can know
what the fix does without previewing diff.

This patch extends clang-tidy framework to support fix descriptions (will add implementations for
existing checks in the future). Fix descriptions and fixes are emitted via diagnostic::Note (rather than
attaching the main warning diagnostic).

Before this patch:

```
void MyCheck::check(...) {
   ...
   diag(loc, "my check warning") <<  FixtItHint::CreateReplacement(...);
}
```

After:

```
void MyCheck::check(...) {
   ...
   diag(loc, "my check warning"); // Emit a check warning
   diag(loc, "fix description", DiagnosticIDs::Note) << FixtItHint::CreateReplacement(...); // Emit a diagnostic note and a fix
}
```

Reviewers: sammccall, alexfh

Reviewed By: alexfh

Subscribers: MyDeveloperDay, Eugene.Zelenko, aaron.ballman, JonasToth, xazax.hun, jdoerfert, cfe-commits

Tags: #clang-tools-extra, #clang

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

llvm-svn: 358576
2019-04-17 12:53:59 +00:00
Hans Wennborg 6fe637c6f4 clang-cl: Parse /openmp:experimental
It was added to the MS docs recently here:
3951085ab7

llvm-svn: 358570
2019-04-17 10:05:58 +00:00
Sven van Haastregt c9945cca03 [libclang] Expose ext_vector_type
Differential Revision: https://reviews.llvm.org/D60775

llvm-svn: 358566
2019-04-17 09:08:50 +00:00
Fangrui Song e3576b0afa [Driver] Simplify -g level computation and its interaction with -gsplit-dwarf
Summary:
When -gsplit-dwarf is used together with other -g options, in most cases
the computed debug info level is decided by the last -g option, with one
special case (see below). This patch drops that special case and thus
makes it easy to reason about:

// If a lower debug level -g comes after -gsplit-dwarf, in some cases
// -gsplit-dwarf is cancelled.
-gsplit-dwarf -g0 => 0
-gsplit-dwarf -gline-directives-only => DebugDirectivesOnly
-gsplit-dwarf -gmlt -fsplit-dwarf-inlining => 1
-gsplit-dwarf -gmlt -fno-split-dwarf-inlining => 1 + split

// If -gsplit-dwarf comes after -g options, with this patch, the net
// effect is 2 + split for all combinations
-g0 -gsplit-dwarf => 2 + split
-gline-directives-only -gsplit-dwarf => 2 + split
-gmlt -gsplit-dwarf -fsplit-dwarf-inlining => 2 + split
-gmlt -gsplit-dwarf -fno-split-dwarf-inlining => 1 + split (before) 2 + split (after)

The last case has been changed. In general, if the user intends to lower
debug info level, place that -g option after -gsplit-dwarf.

Some context:

In gcc, the last of -gsplit-dwarf -g0 -g1 -g2 -g3 -ggdb[0-3] -gdwarf-*
... decides the debug info level (-gsplit-dwarf -gdwarf-* have level 2).
It is a bit unfortunate that -gsplit-dwarf -gdwarf-* ... participate in
the level computation but that is the status quo.

Reviewers: dblaikie, echristo, probinson

Reviewed By: dblaikie, probinson

Subscribers: probinson, aprantl, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 358544
2019-04-17 01:46:27 +00:00
Leonard Chan 5c09f8d6c1 [NFC] Remove unused function (Sema::pushExternalDeclIntoScope)
llvm-svn: 358538
2019-04-16 22:59:39 +00:00
Douglas Yung 1925f41872 Modify test to use -S instead of -c so that it works when an external assembler is used that is not present.
llvm-svn: 358537
2019-04-16 22:52:05 +00:00
Harlan Haskins d8f776af6e [FileSystemStatCache] Update test for new FileSystemStatCache API
Summary: Update this test to return std::error_code instead of LookupResult.

Reviewers: arphaman

Subscribers: dexonsmith, cfe-commits

Tags: #clang

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

llvm-svn: 358511
2019-04-16 18:00:43 +00:00
Harlan Haskins eec3c0f9e3 [FileSystemStatCache] Return std::error_code from stat cache methods
Summary:
Previously, we would return true/false signifying if the cache/lookup
succeeded or failed. Instead, provide clients with the underlying error
that was thrown while attempting to look up in the cache.

Since clang::FileManager doesn't make use of this information, it discards the
error that's received and casts away to bool.

This change is NFC.

Reviewers: benlangmuir, arphaman

Subscribers: dexonsmith, cfe-commits

Tags: #clang

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

llvm-svn: 358509
2019-04-16 17:34:26 +00:00
Michael Kruse f73bba3b14 [Test] Remove obsolete test.
The FIXME of this test case has been addressed in r335084/r338800. Its
execution still does not succeed because of multiple syntax errors.

First, the "clang" namespace is missing on each of the 4 pragmas.
Second, the pragma for defining the vector width is "vectorize_width(4)"
instead of "vectorize(4)". Third, the pragma for defining the interleave
factor is "interleave_count(8)" instead of "interleave(8)".

The file was already using the wrong syntax when added in
r210925 2014-06-13. The file ast-print-pragmas.cpp already checks for
the correct pragma order, making this test redundant even if fixed.

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

llvm-svn: 358507
2019-04-16 16:44:45 +00:00
Alexey Bataev 5e2879320d [OPENMP][NVPTX]Run combined constructs with if clause in SPMD mode.
Combined constructs with parallel and if clauses without modifiers may
be executed in SPMD mode since if the condition is true for the target
region, it is also true for parallel region and the threads must be run
in parallel.

llvm-svn: 358503
2019-04-16 15:39:12 +00:00
Alexey Bataev 3e8124631e [OPENMP]Require aarch arch for the tests, NFC.
llvm-svn: 358493
2019-04-16 14:26:10 +00:00
Alexey Bataev a0a2264ef7 [AArch64] Implement Vector Funtion ABI name mangling.
Summary:
The name mangling scheme is defined in section 3.5 of the "Vector function application binary interface specification for AArch64" [1].

[1] https://developer.arm.com/products/software-development-tools/hpc/arm-compiler-for-hpc/vector-function-abi

Reviewers: rengolin, ABataev

Reviewed By: ABataev

Subscribers: sdesmalen, javed.absar, kristof.beyls, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 358490
2019-04-16 13:56:21 +00:00
Hans Wennborg 21eb771dcb Re-commit r357452: SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)
The original commit caused false positives from AddressSanitizer's
use-after-scope checks, which have now been fixed in r358478.

> The code was previously checking that candidates for sinking had exactly
> one use or were a store instruction (which can't have uses). This meant
> we could sink call instructions only if they had a use.
>
> That limitation seemed a bit arbitrary, so this patch changes it to
> "instruction has zero or one use" which seems more natural and removes
> the need to special-case stores.
>
> Differential revision: https://reviews.llvm.org/D59936

llvm-svn: 358483
2019-04-16 12:13:25 +00:00
Richard Smith 4ed54ee3db Tweak test to pass when using a non-integrated assembler.
llvm-svn: 358470
2019-04-16 01:44:53 +00:00
Richard Smith 1600e24521 PR41192: fix cases where "missing ';' after class" error would
incorrectly fire.

llvm-svn: 358467
2019-04-16 00:47:45 +00:00
David Blaikie b068f92d94 DebugInfo: Default to standalone debug when tuning for LLDB
LLDB can't currently handle Clang's default (limit/no-standalone) DWARF,
so platforms that default to LLDB (Darwin) or anyone else manually
requesting LLDB tuning, should also get standalone DWARF.

That doesn't mean a user can't explicitly enable (because they have
other reasons to prefer standalone DWARF (such as that they're only
building half their application with debug info enabled, and half
without - or because they're tuning for GDB, but want to be able to use
it under LLDB too (this is the default on FreeBSD))) or disable (testing
LLDB fixes/improvements that handle no-standalone mode, building C code,
perhaps, which wouldn't have the LLDB<>no-standalone conflict, etc) the
feature regardless of the tuning.

llvm-svn: 358464
2019-04-16 00:16:29 +00:00
Richard Smith 728780bfad Simplify diagnosis of misplaced attributes in module-declarations.
No functional change intended.

llvm-svn: 358463
2019-04-15 23:55:58 +00:00
Anton Afanasyev 2653672859 Time profiler: small fixes and optimizations
Summary: Fixes from Roman's review here: https://reviews.llvm.org/D58675#1465336

Reviewers: lebedev.ri

Subscribers: hiraditya, mgrang, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 358448
2019-04-15 21:02:47 +00:00
Alexey Bataev e0eb13135f [OPENMP][NVPTX]Run parallel regions with num_threads clauses in SPMD
mode.

After the previous patch with the more correct handling of the number of
threads in parallel regions, the parallel regions with num_threads
clauses can be executed in SPMD mode.

llvm-svn: 358445
2019-04-15 20:38:10 +00:00
Reuben Thomas 407dd4d169 [clang-format] Fix -Wconversion-null warning in GCC
GCC -Wconversion-null warning appeared after 9a63380260860b657b72f07c4f0e61e382ab934a.
There was a similar problem already in the past:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20131230/096230.html

Patch committed on behalf of @dendibakh

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

llvm-svn: 358441
2019-04-15 20:13:20 +00:00
Louis Dionne 0fa94ee318 Revert "[clang] Aligned allocation is actually supported in macosx 10.13"
This reverts r358409, which I think broke the bots in compiler-rt.
Since I'm having trouble reproducing the failure, I'm reverting this
until I can investigate locally.

llvm-svn: 358437
2019-04-15 19:08:52 +00:00
Craig Topper a54a11e22a [X86] Improve avx512-kconstraints-att_inline_asm.c to not be easily defeated by deadcode elimination. Improve CHECK lines to check IR types used. NFC
I plan to use this as the basis for backend IR test cases. We currently crash hard for using 32 or 64 bit mask registers without avx512bw.

llvm-svn: 358435
2019-04-15 18:39:36 +00:00
Don Hinton b85f74a283 [CommandLineParser] Add DefaultOption flag
Summary: Add DefaultOption flag to CommandLineParser which provides a
default option or alias, but allows users to override it for some
other purpose as needed.

Also, add `-h` as a default alias to `-help`, which can be seamlessly
overridden by applications like llvm-objdump and llvm-readobj which
use `-h` as an alias for other options.

(relanding after revert, r358414)
Added DefaultOptions.clear() to reset().

Reviewers: alexfh, klimek

Reviewed By: klimek

Subscribers: kristina, MaskRay, mehdi_amini, inglorion, dexonsmith, hiraditya, llvm-commits, jhenderson, arphaman, cfe-commits

Tags: #clang, #llvm

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

llvm-svn: 358428
2019-04-15 17:18:10 +00:00
Craig Topper 8e364c680f [X86] Restore the pavg intrinsics.
The pattern we replaced these with may be too hard to match as demonstrated by
PR41496 and PR41316.

This patch restores the intrinsics and then we can start focusing
on the optimizing the intrinsics.

I've mostly reverted the original patch that removed them. Though I modified
the avx512 intrinsics to not have masking built in.

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

llvm-svn: 358427
2019-04-15 17:17:35 +00:00
Ilya Biryukov 70921d4a86 Revert r358337: "[CommandLineParser] Add DefaultOption flag"
The change causes test failures under asan. Reverting to unbreak our
integrate.

llvm-svn: 358414
2019-04-15 14:43:50 +00:00
Louis Dionne f2073321c9 [clang] Aligned allocation is actually supported in macosx 10.13
Summary:
In r350649, I changed aligned allocation from being available starting
in macosx10.13 to macosx10.14. However, aligned allocation is indeed
available starting with macosx10.13, my investigation had been based
on the wrong libc++abi dylib.

This means that Clang before the fix will be more stringent when it
comes to aligned allocation -- it will not allow it when back-deploying
to macosx 10.13, when it would actually be safe to do so.

Note that a companion change will be coming to fix the libc++ tests.

Reviewers: ahatanak

Subscribers: jkorous, dexonsmith, cfe-commits

Tags: #clang

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

llvm-svn: 358409
2019-04-15 14:14:45 +00:00
Hans Wennborg 5db281cd4e clang-format vs plugin: Visual Studio 2019 support
llvm-svn: 358402
2019-04-15 13:02:03 +00:00
Martin Storsjo 7844031d46 [MinGW] Remove some supefluous calls to MakeArgString. NFC.
llvm-svn: 358393
2019-04-15 10:57:09 +00:00
Eric Liu dc8d8fb20b [Lookup] Invisible decls should not be ambiguous when renaming.
Summary:
For example, a renamed type in a header file can conflict with declaration in
a random file that includes the header, but we should not consider the decl ambiguous if
it's not visible at the rename location. This improves consistency of generated replacements
when header file is included in different TUs.

Reviewers: hokein

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 358378
2019-04-15 08:46:34 +00:00
Paul Hoad bd8a1ce7bb [clang-format] [PR41170] Break after return type ignored with certain comments positions
Summary:
Addresses https://bugs.llvm.org/show_bug.cgi?id=41170

The AlwaysBreakAfterReturn type setting can go wrong if the line ends with a comment
```
void foo() /* comment */
```
or

```
void foo() // comment
```

It will incorrectly see such functions as Declarations and not Definitions

The following code addresses this by looking for function which end with `; <comment>` rather than just `;` or `<comment>`

Reviewers: klimek, djasper, reuk, russellmcc, owenpan, sammccall
Reviewed By: owenpan
Subscribers: lebedev.ri, cfe-commits, sammccall
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60363

llvm-svn: 358375
2019-04-15 07:47:15 +00:00
Richard Smith b1b580e047 [c++20] Enable driver and frontend support for building and using
modules when -std=c++2a is specified.

llvm-svn: 358355
2019-04-14 11:11:37 +00:00
Richard Smith d652bdd05f [c++20] Parsing support for module-declarations, import-declarations,
and the global and private module fragment.

For now, the private module fragment introducer is ignored, but use of
the global module fragment introducer should be properly enforced.

llvm-svn: 358353
2019-04-14 08:06:59 +00:00
Don Hinton 7d2021defc [CommandLineParser] Add DefaultOption flag
Summary: Add DefaultOption flag to CommandLineParser which provides a
default option or alias, but allows users to override it for some
other purpose as needed.

Also, add `-h` as a default alias to `-help`, which can be seamlessly
overridden by applications like llvm-objdump and llvm-readobj which
use `-h` as an alias for other options.

Reviewers: alexfh, klimek

Reviewed By: klimek

Subscribers: MaskRay, mehdi_amini, inglorion, dexonsmith, hiraditya, llvm-commits, jhenderson, arphaman, cfe-commits

Tags: #clang, #llvm

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

llvm-svn: 358337
2019-04-13 16:55:28 +00:00
Richard Smith 4e8144a0d1 [verify] Add support for location markers in directives.
A marker (matching /#[A-Za-z0-9_-]/) is specified by attaching a comment
containing the marker to the line at which the diagnostic is expected,
and then can be referenced from an expected-* directive after an @:

  foo // #1
  // expected-error@#1 {{undeclared identifier 'foo'}}

The intent is for markers to be used in situations where relative line
numbers are currently used, to avoid the need to renumber when the test
case is rearranged.

llvm-svn: 358326
2019-04-13 04:33:39 +00:00
Artem Dergachev 7d4694547a [analyzer] Escape pointers stored into top-level parameters with destructors.
Writing stuff into an argument variable is usually equivalent to writing stuff
to a local variable: it will have no effect outside of the function.
There's an important exception from this rule: if the argument variable has
a non-trivial destructor, the destructor would be invoked on
the parent stack frame, exposing contents of the otherwise dead
argument variable to the caller.

If such argument is the last place where a pointer is stored before the function
exits and the function is the one we've started our analysis from (i.e., we have
no caller context for it), we currently diagnose a leak. This is incorrect
because the destructor of the argument still has access to the pointer.
The destructor may deallocate the pointer or even pass it further.

Treat writes into such argument regions as "escapes" instead, suppressing
spurious memory leak reports but not messing with dead symbol removal.

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

llvm-svn: 358321
2019-04-13 02:01:45 +00:00
Amy Huang 0d0334fe1b Relanding r357928 with fixed debuginfo check.
[MS] Add metadata for __declspec(allocator)

Original summary:
Emit !heapallocsite in the metadata for calls to functions marked with
__declspec(allocator). Eventually this will be emitted as S_HEAPALLOCSITE debug
info in codeview.

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

llvm-svn: 358307
2019-04-12 20:25:30 +00:00
Yaxun Liu 7bd8c37b17 [HIP] Use -mlink-builtin-bitcode to link device library
Use -mlink-builtin-bitcode instead of llvm-link to link
device library so that device library bitcode and user
device code can be compiled in a consistent way.

This is the same approach used by CUDA and OpenMP.

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

llvm-svn: 358290
2019-04-12 16:23:31 +00:00
Bruno Ricci 061865093f [AST][NFC] Add const children() accessors to all AST nodes
Systematically add the const-qualified version of children()
to all statement/expression nodes. Previously the const-qualified
variant was only defined for some nodes. NFC.

Patch by: Nicolas Manichon

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

Reviewed By: riccibruno

llvm-svn: 358288
2019-04-12 15:36:02 +00:00
Pierre Gousseau 1e39fc1faa [asan] Add gcc 8's driver option -fsanitize=pointer-compare and -fsanitize=pointer-substract.
Disabled by default as this is still an experimental feature.

Reviewed By: thakis

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

llvm-svn: 358285
2019-04-12 14:14:58 +00:00
Bruno Ricci f6c7692d60 [AST] Forbid copy/move of statements/types
Statements, expressions and types are not supposed to be copied/moved,
and trying to do so is only going to result in tears. Someone tripped
on this a few days ago on the mailing list. NFC.

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

Reviewed By: aaron.ballman

llvm-svn: 358283
2019-04-12 13:26:55 +00:00
Diogo N. Sampaio eb312ddfdf [Aarch64] Add v8.2-a half precision element extract intrinsics
Summary:
Implements the intrinsics define on the ACLE to extract half precision fp scalar elements from float16x4_t and float16x8_t vector types.
a.k.a:
vduph_lane_f16
vduph_laneq_f16

Reviewers: pablooliveira, olista01, LukeGeeson, DavidSpickett

Reviewed By: DavidSpickett

Subscribers: DavidSpickett, javed.absar, kristof.beyls, cfe-commits

Tags: #clang

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

llvm-svn: 358276
2019-04-12 10:43:48 +00:00
Krasimir Georgiev 69150467b0 [clang-format] Use SpacesBeforeTrailingComments for "option" directive
Summary:
AnnotatingParser::next() is needed to implicitly set TT_BlockComment
versus TT_LineComment.  On most other paths through
AnnotatingParser::parseLine(), all tokens are consumed to achieve that.
This change updates one place where this wasn't done.

Contributed by @dchai!

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 358275
2019-04-12 10:11:34 +00:00
Kadir Cetinkaya a80a52283c [clangd] Print template arguments helper
Summary:
Prepares ground for printing template arguments as written in the
source code, part of re-landing rC356541 with D59599 applied.

Reviewers: ioeric, ilya-biryukov

Subscribers: mgorny, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 358272
2019-04-12 10:09:14 +00:00
Brad Smith 21375ca136 Enable frame pointer elimination for OpenBSD on x86 and mips64.
llvm-svn: 358245
2019-04-12 01:29:18 +00:00
JF Bastien ef202c308b Variable auto-init: also auto-init alloca
Summary:
alloca isn’t auto-init’d right now because it’s a different path in clang that
all the other stuff we support (it’s a builtin, not an expression).
Interestingly, alloca doesn’t have a type (as opposed to even VLA) so we can
really only initialize it with memset.

<rdar://problem/49794007>

Subscribers: jkorous, dexonsmith, cfe-commits, rjmccall, glider, kees, kcc, pcc

Tags: #clang

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

llvm-svn: 358243
2019-04-12 00:11:27 +00:00
Nico Weber 20118355aa Revert r357610, it caused PR41471
llvm-svn: 358232
2019-04-11 21:26:34 +00:00
Richard Smith 8af8b8611c [C++20] Implement context-sensitive header-name lexing and pp-import parsing in the preprocessor.
llvm-svn: 358231
2019-04-11 21:18:23 +00:00
Richard Smith 75f9681874 Remove use of lookahead from _Pragma handling and from all other
internal lexing steps in the preprocessor.

It is not safe to use the preprocessor's token lookahead except when
operating on the final sequence of tokens that would be produced by
phase 4 of translation. Doing so corrupts the token lookahead cache used
by the parser. (See added testcase for an example.) Lookahead should
instead be viewed as a layer on top of the normal lexer.

Added assertions to catch any further incorrect uses of lookahead within
lexing actions.

llvm-svn: 358230
2019-04-11 21:18:22 +00:00
Aaron Smith fa7745be7a [DebugInfo] Combine Trivial and NonTrivial flags
Summary:
These flags are used when emitting debug info and needed to initialize subprogram and member function attributes (function options) for Codeview. These function options are used to create an accurate compiler type for UDT symbols (class/struct/union) from PDBs.

The Trivial flag was introduced in https://reviews.llvm.org/D45122

It's been pointed out that Trivial and NonTrivial may imply each other and that seems to be the case in the current tests. This change combines them into a single flag -- NonTrivial -- and updates the corresponding unit tests. There is an additional change to llvm to update the flags.

Reviewers: rnk, zturner, dblaikie, probinson, Hui

Reviewed By: dblaikie

Subscribers: aprantl, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 358219
2019-04-11 20:24:54 +00:00
Erik Pilkington 1138d8c892 Support objc_nonlazy_class attribute on Objective-C implementations
Fixes rdar://49523079

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

llvm-svn: 358201
2019-04-11 17:55:34 +00:00
Erik Pilkington c5a0583400 Add support for attributes on @implementations in Objective-C
We want to make objc_nonlazy_class apply to implementations, but ran into this.
There doesn't seem to be any reason that this isn't supported.

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

llvm-svn: 358200
2019-04-11 17:55:30 +00:00
Mikael Holmen 58c080a3b1 Add { } to silence compiler warning [NFC]
At least clang 3.6 warns on the original code:

../tools/clang/lib/CodeGen/CGNonTrivialStruct.cpp:829:34: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
  return std::array<Address, 1>({Address(nullptr, CharUnits::Zero())});
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                 {                                  }
../tools/clang/lib/CodeGen/CGNonTrivialStruct.cpp:833:34: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
  return std::array<Address, 2>({Address(nullptr, CharUnits::Zero()),
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

llvm-svn: 358152
2019-04-11 06:57:12 +00:00
Alexey Sotkin 1b01f9728f [OpenCL] Re-fix invalid address space generation for clk_event_t arguments of enqueue_kernel builtin function
Summary:
https://reviews.llvm.org/D53809 fixed wrong address space(assert in debug build)
generated for event_ret argument. But exactly the same problem exists for
event_wait_list argument. This patch should fix both.

Reviewers: Anastasia, yaxunl

Reviewed By:  Anastasia

Subscribers: kristina, ebevhan, cfe-commits

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

llvm-svn: 358151
2019-04-11 06:18:17 +00:00
Erik Pilkington de051dfe02 Fix a test, NFC
This test was duplicated, and the last declaration had some syntax errors since
the invalid attribute caused the @implementation to be skipped by the parser.

llvm-svn: 358136
2019-04-10 21:18:21 +00:00
Dmitri Gribenko 66b6bb1766 Check i < FD->getNumParams() before querying
Summary:
As was already stated in a previous comment, the parameter isn't
necessarily referring to one of the DeclContext's parameter. We
should check the index is within the range to avoid out-of-boundary
access.

Reviewers: gribozavr, rsmith, lebedev.ri

Reviewed By: gribozavr, rsmith

Subscribers: lebedev.ri, cfe-commits

Tags: #clang

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

Patch by Violet.

llvm-svn: 358134
2019-04-10 20:25:07 +00:00
Jan Korous 6644d014dd [clang][ASTContext] Try to exit early before loading serialized comments from AST files
Loading external comments is expensive. This change probably doesn't apply to common cases but is almost for free and would save some work in case none of the declaration needs external comments to be loaded.

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

llvm-svn: 358133
2019-04-10 20:23:33 +00:00
John McCall 827aeb461c Add IRGen APIs to fetch ctor/dtor helper functions for non-trivial structs.
Patch by Tony Allevato!

llvm-svn: 358132
2019-04-10 19:57:20 +00:00
Alexey Bataev 5c4273620d [OPENMP]Improve detection of number of teams, threads in target
regions.

Added more complex analysis for number of teams and number of threads in
the target regions, also merged related common code between CGOpenMPRuntime
and CGOpenMPRuntimeNVPTX classes.

llvm-svn: 358126
2019-04-10 19:11:33 +00:00
John McCall 103556279f Fix for different build configurations.
llvm-svn: 358125
2019-04-10 19:11:32 +00:00
John McCall 7ae29f5742 Fix an off-by-one mistake in IRGen's copy-construction
special cases in the presence of zero-length arrays.

Patch by Joran Bigalet!

llvm-svn: 358115
2019-04-10 18:07:18 +00:00
John McCall 8b36ac818c Don't emit an unreachable return block.
Patch by Brad Moody.

llvm-svn: 358104
2019-04-10 17:03:09 +00:00
Hans Wennborg 3ecb04a9da clang-cl: Fix parsing of the /F option (PR41405)
llvm-svn: 358087
2019-04-10 14:27:47 +00:00
Akira Hatanaka 60c3a3b6d0 [CodeGen][ObjC] Emit the retainRV marker as a module flag instead of
named metadata.

This fixes a bug where ARC contract wasn't inserting the retainRV
marker when LTO was enabled, which caused objects returned from a
function to be auto-released.

rdar://problem/49464214

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

llvm-svn: 358048
2019-04-10 06:20:23 +00:00
Alexey Bataev 366f4d45c0 [OPENMP]Allow allocate directive on parameters.
Patch allows to use allocate directives on the function parameters.

llvm-svn: 358016
2019-04-09 16:31:37 +00:00
Raphael Isemann fa26c20eba Fixed comment as pointed out by post-commit review of D59845
llvm-svn: 358006
2019-04-09 14:18:23 +00:00
Tom Stellard 32b65345c5 Add support for detection of devtoolset-8
Summary:
The current llvm/clang et al. project can be built with the latest developer toolset (devtoolset-8) on RHEL, which provides GCC 8.2.1.
However, the result compiler will not identify this toolset itself when compiling programs, which is of course not desirable.

After the patch - which simply adds the name of the developer toolset to the existing list - it gets identified and selected, as shown below:

[bamboo@bamboo llvm-project]$ clang -v
clang version 9.0.0 (https://github.com/llvm/llvm-project.git e5ac385fb1)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/bamboo/llvm/bin
Found candidate GCC installation: /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.2.1
Found candidate GCC installation: /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7
Found candidate GCC installation: /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Selected GCC installation: /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64

Patch By: Radu-Adrian Popescu

Reviewers: tstellar, fedor.sergeev

Reviewed By: tstellar

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 358002
2019-04-09 13:26:10 +00:00
Alex Bradbury 91542e14c7 [RISCV] Unbreak test from r357989
There were some errors in the committed test checks, left in due to a git
stash apply mishap.

llvm-svn: 357993
2019-04-09 10:44:47 +00:00
Alex Bradbury fa3eb12010 [RISCV][NFC] Minor fixup for r357989
One of the tests in riscv64-lp64-lp64f-lp64d would have had a different
lowering for lp64f/lp64d as a float argument was missed.

llvm-svn: 357991
2019-04-09 10:25:05 +00:00
Alex Bradbury c0e8231cdd [RISCV][NFC] Refactor RISC-V ABI lowering tests in preparation for hard float patches
Split tests in to files representing the subset of RISC-V ABIs they should
have identical output for.

llvm-svn: 357989
2019-04-09 10:12:49 +00:00
Bjorn Pettersson 5cca2c25a7 [ASTImporter] Fix in ASTImporter::Import_New(const Decl *)
Make sure ASTImporter::Import_New(const Decl *) returns
a Expected<const Decl *> and not Expected<Decl *> to
make the clang/unittests/AST/ASTImporterTest.cpp compile
without the warning

 clang/unittests/AST/ASTImporterTest.cpp:117:12: error: no viable conversion from 'Expected<clang::Decl *>' to 'Expected<const clang::Decl *>'
    return Imported;

(I got the above when building with clang 3.6).

llvm-svn: 357985
2019-04-09 09:12:32 +00:00
Owen Pan 806d5741aa [clang-format] Add AfterCaseLabel to BraceWrapping
Fixes PR38686

> llvm-svn: 52527

llvm-svn: 357957
2019-04-08 23:36:25 +00:00
Amy Huang 8a96fa23e6 Revert "[MS] Add metadata for __declspec(allocator)"
This reverts commit e7bd735bb0.
Reverting because of buildbot failure.

llvm-svn: 357952
2019-04-08 22:46:41 +00:00
Chandler Carruth 4cf5743b77 Move the builtin headers to use the new license file header.
Summary:
These all had somewhat custom file headers with different text from the
ones I searched for previously, and so I missed them. Thanks to Hal and
Kristina and others who prompted me to fix this, and sorry it took so
long.

Reviewers: hfinkel

Subscribers: mcrosier, javed.absar, cfe-commits

Tags: #clang

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

llvm-svn: 357941
2019-04-08 20:51:30 +00:00
Shafik Yaghmour d4263123ab [ASTImporter] Call to HandleNameConflict in VisitEnumDecl mistakeningly using Name instead of SearchName
Summary:
https://reviews.llvm.org/D51633 added error handling to the ASTNodeImporter::VisitEnumDecl(...) for the conflicting names case. This could lead to erroneous return of an error in that case since we should have been using SearchName. Name may be empty in the case where we find the name via getTypedefNameForAnonDecl(...).

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

llvm-svn: 357940
2019-04-08 20:50:21 +00:00
David Goldman fa8185c504 Clean up ObjCPropertyDecl printing
Summary:
- `@property(attr, attr2)` instead of `@property ( attr,attr2 )`.
- Change priority of attributes (see code/comments inline).
- Support for printing weak and unsafe_unretained attributes.

Subscribers: arphaman, jfb, cfe-commits

Tags: #clang

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

llvm-svn: 357937
2019-04-08 19:52:45 +00:00
Alexey Bataev 6cf7b715a0 [OPENMP] Sync __kmpc_alloc/_kmpc_free function with the runtime.
Functions __kmpc_alloc/__kmpc_free are updated with the new interfaces.
Patch synchronizes the compiler with the runtime.

llvm-svn: 357933
2019-04-08 19:06:42 +00:00
Amy Huang e7bd735bb0 [MS] Add metadata for __declspec(allocator)
Summary:
Emit !heapallocsite in the metadata for calls to functions marked with
__declspec(allocator). Eventually this will be emitted as S_HEAPALLOCSITE debug
info in codeview.

Reviewers: rnk

Subscribers: jfb, cfe-commits

Tags: #clang

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

llvm-svn: 357928
2019-04-08 17:58:29 +00:00
Craig Topper 1b62c758d0 [X86] Add some fp to integer conversion intrinsics to Sema::CheckX86BuiltinRoundingOrSAE so their rounding controls will be checked.
If we don't check this in the frontend we'll get an isel error in the backend later. This is far less friendly to users.

llvm-svn: 357924
2019-04-08 17:05:57 +00:00
Alexey Bataev 1db9bfeba5 [OPENMP][NVPTX]Fixed processing of memory management directives.
Added special processing of the memory management directives/clauses for
NVPTX target. For private locals, omp_default_mem_alloc and
omp_thread_mem_alloc result in allocation in local memory.
omp_const_mem_alloc allocates const memory, omp_teams_mem_alloc
allocates shared memory, and omp_cgroup_mem_alloc and
omp_large_cap_mem_alloc allocate global memory.

llvm-svn: 357923
2019-04-08 16:53:57 +00:00
Alexander Kornienko 10d6008f85 Remove a bogus sed option in test.
llvm-svn: 357922
2019-04-08 16:34:38 +00:00
Alexander Kornienko fb7338b6a5 Remove a useless assertion in clang-check.
Re-commit r357915 with a fix for windows.

The assertion prevents it from applying fixes when used along with compilation
databases with relative paths. Added a test that demonstrates the assertion
failure.

An example of the assertion:
input.cpp:11:14: error: expected ';' after top level declarator
typedef int T
             ^
             ;
input.cpp:11:14: note: FIX-IT applied suggested code changes
clang-check: clang/tools/clang-check/ClangCheck.cpp:94: virtual std::string (anonymous namespace)::FixItOptions::RewriteFilename(const std::string &, int &): Assertion `llvm::sys::path::is_absolute(filename) && "clang-fixit expects absolute paths only."' failed.
  #0 llvm::sys::PrintStackTrace(llvm::raw_ostream&) llvm/lib/Support/Unix/Signals.inc:494:13
  #1 llvm::sys::RunSignalHandlers() llvm/lib/Support/Signals.cpp:69:18
  #2 SignalHandler(int) llvm/lib/Support/Unix/Signals.inc:357:1
  #3 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x110c0)
  #4 raise (/lib/x86_64-linux-gnu/libc.so.6+0x32fcf)
  #5 abort (/lib/x86_64-linux-gnu/libc.so.6+0x343fa)
  #6 (/lib/x86_64-linux-gnu/libc.so.6+0x2be37)
  #7 (/lib/x86_64-linux-gnu/libc.so.6+0x2bee2)
  #8 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag)
  #9 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char*>(char*, char*, std::__false_type)
 #10 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*)
 #11 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
 #12 (anonymous namespace)::FixItOptions::RewriteFilename(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int&) clang/tools/clang-check/ClangCheck.cpp:101:0
 #13 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const
 #14 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const
 #15 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()
 #16 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
 #17 clang::FixItRewriter::WriteFixedFiles(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >*) clang/lib/Frontend/Rewrite/FixItRewriter.cpp:98:0
 #18 std::__shared_ptr<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2>::get() const
 #19 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::_M_get() const
 #20 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::operator->() const
 #21 clang::CompilerInstance::getFrontendOpts() clang/include/clang/Frontend/CompilerInstance.h:290:0
 #22 clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:966:0
 #23 __gnu_cxx::__normal_iterator<clang::FrontendInputFile*, std::vector<clang::FrontendInputFile, std::allocator<clang::FrontendInputFile> > >::operator++()
 #24 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:943:0
 #25 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) clang/lib/Tooling/Tooling.cpp:369:33
 #26 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) clang/lib/Tooling/Tooling.cpp:344:18
 #27 clang::tooling::ToolInvocation::run() clang/lib/Tooling/Tooling.cpp:329:10
 #28 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) clang/lib/Tooling/Tooling.cpp:518:11
 #29 main clang/tools/clang-check/ClangCheck.cpp:187:15

llvm-svn: 357921
2019-04-08 16:29:43 +00:00
Simon Pilgrim 5058ca6d9b Revert rL357915 from cfe/trunk: Remove a useless assertion in clang-check.
The assertion prevents it from applying fixes when used along with compilation
databases with relative paths. Added a test that demonstrates the assertion
failure.

An example of the assertion:
input.cpp:11:14: error: expected ';' after top level declarator
typedef int T
             ^
             ;
input.cpp:11:14: note: FIX-IT applied suggested code changes
clang-check: clang/tools/clang-check/ClangCheck.cpp:94: virtual std::string (anonymous namespace)::FixItOptions::RewriteFilename(const std::string &, int &): Assertion `llvm::sys::path::is_absolute(filename) && "clang-fixit expects absolute paths only."' failed.
  #0 llvm::sys::PrintStackTrace(llvm::raw_ostream&) llvm/lib/Support/Unix/Signals.inc:494:13
  #1 llvm::sys::RunSignalHandlers() llvm/lib/Support/Signals.cpp:69:18
  #2 SignalHandler(int) llvm/lib/Support/Unix/Signals.inc:357:1
  #3 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x110c0)
  #4 raise (/lib/x86_64-linux-gnu/libc.so.6+0x32fcf)
  #5 abort (/lib/x86_64-linux-gnu/libc.so.6+0x343fa)
  #6 (/lib/x86_64-linux-gnu/libc.so.6+0x2be37)
  #7 (/lib/x86_64-linux-gnu/libc.so.6+0x2bee2)
  #8 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag)
  #9 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char*>(char*, char*, std::__false_type)
 #10 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*)
 #11 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
 #12 (anonymous namespace)::FixItOptions::RewriteFilename(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int&) clang/tools/clang-check/ClangCheck.cpp:101:0
 #13 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const
 #14 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const
 #15 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()
 #16 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
 #17 clang::FixItRewriter::WriteFixedFiles(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >*) clang/lib/Frontend/Rewrite/FixItRewriter.cpp:98:0
 #18 std::__shared_ptr<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2>::get() const
 #19 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::_M_get() const
 #20 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::operator->() const
 #21 clang::CompilerInstance::getFrontendOpts() clang/include/clang/Frontend/CompilerInstance.h:290:0
 #22 clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:966:0
 #23 __gnu_cxx::__normal_iterator<clang::FrontendInputFile*, std::vector<clang::FrontendInputFile, std::allocator<clang::FrontendInputFile> > >::operator++()
 #24 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:943:0
 #25 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) clang/lib/Tooling/Tooling.cpp:369:33
 #26 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) clang/lib/Tooling/Tooling.cpp:344:18
 #27 clang::tooling::ToolInvocation::run() clang/lib/Tooling/Tooling.cpp:329:10
 #28 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) clang/lib/Tooling/Tooling.cpp:518:11
 #29 main clang/tools/clang-check/ClangCheck.cpp:187:15
........
Breaks windows buildbots

llvm-svn: 357918
2019-04-08 15:49:19 +00:00
Rainer Orth 04ee339ada [python, tests] Disable Clang Python tests on SPARC
Running `make check-all` fails on Solaris 11/SPARC since the clang python
tests FAIL:

  ............................
  ======================================================================
  FAIL: test_extent (tests.cindex.test_location.TestLocation)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "tests/cindex/test_location.py", line 87, in test_extent
      self.assert_location(one.extent.start,line=1,column=1,offset=0)
    File "tests/cindex/test_location.py", line 22, in assert_location
      self.assertEqual(loc.column, column)
  AssertionError: 5 != 1
  
  ======================================================================
  FAIL: test_get_children (tests.cindex.test_cursor.TestCursor)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "tests/cindex/test_cursor.py", line 70, in test_get_children
      self.assertEqual(tu_nodes[0].is_definition(), True)
  AssertionError: False != True
  
  ----------------------------------------------------------------------
  Ran 126 tests in 2.123s
  
  FAILED (failures=2, skipped=6)
  
Unfortunately, this aborts the rest of `make check-all`, even with `-k`, so
this patch disables the test as is already done on a couple of other
targets.
  
This allowed the `sparc-sun-solaris2.11` test to finish.

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

llvm-svn: 357917
2019-04-08 15:01:06 +00:00
Alexander Kornienko c70d38e997 Remove a useless assertion in clang-check.
The assertion prevents it from applying fixes when used along with compilation
databases with relative paths. Added a test that demonstrates the assertion
failure.

An example of the assertion:
input.cpp:11:14: error: expected ';' after top level declarator
typedef int T
             ^
             ;
input.cpp:11:14: note: FIX-IT applied suggested code changes
clang-check: clang/tools/clang-check/ClangCheck.cpp:94: virtual std::string (anonymous namespace)::FixItOptions::RewriteFilename(const std::string &, int &): Assertion `llvm::sys::path::is_absolute(filename) && "clang-fixit expects absolute paths only."' failed.
  #0 llvm::sys::PrintStackTrace(llvm::raw_ostream&) llvm/lib/Support/Unix/Signals.inc:494:13
  #1 llvm::sys::RunSignalHandlers() llvm/lib/Support/Signals.cpp:69:18
  #2 SignalHandler(int) llvm/lib/Support/Unix/Signals.inc:357:1
  #3 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x110c0)
  #4 raise (/lib/x86_64-linux-gnu/libc.so.6+0x32fcf)
  #5 abort (/lib/x86_64-linux-gnu/libc.so.6+0x343fa)
  #6 (/lib/x86_64-linux-gnu/libc.so.6+0x2be37)
  #7 (/lib/x86_64-linux-gnu/libc.so.6+0x2bee2)
  #8 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag)
  #9 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char*>(char*, char*, std::__false_type)
 #10 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*)
 #11 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
 #12 (anonymous namespace)::FixItOptions::RewriteFilename(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int&) clang/tools/clang-check/ClangCheck.cpp:101:0
 #13 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const
 #14 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const
 #15 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()
 #16 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
 #17 clang::FixItRewriter::WriteFixedFiles(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >*) clang/lib/Frontend/Rewrite/FixItRewriter.cpp:98:0
 #18 std::__shared_ptr<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2>::get() const
 #19 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::_M_get() const
 #20 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::operator->() const
 #21 clang::CompilerInstance::getFrontendOpts() clang/include/clang/Frontend/CompilerInstance.h:290:0
 #22 clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:966:0
 #23 __gnu_cxx::__normal_iterator<clang::FrontendInputFile*, std::vector<clang::FrontendInputFile, std::allocator<clang::FrontendInputFile> > >::operator++()
 #24 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:943:0
 #25 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) clang/lib/Tooling/Tooling.cpp:369:33
 #26 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) clang/lib/Tooling/Tooling.cpp:344:18
 #27 clang::tooling::ToolInvocation::run() clang/lib/Tooling/Tooling.cpp:329:10
 #28 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) clang/lib/Tooling/Tooling.cpp:518:11
 #29 main clang/tools/clang-check/ClangCheck.cpp:187:15

llvm-svn: 357915
2019-04-08 14:18:26 +00:00
Balazs Keri a1f6b103f3 Changed every use of ASTImporter::Import to Import_New
Reviewers: a.sidorin, shafik, martong, a_sidorin

Reviewed By: a_sidorin

Subscribers: rnkovacs, dkrupp, martong, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

llvm-svn: 357913
2019-04-08 13:59:15 +00:00
Reuben Thomas 91f60b4495 [clang-format] Optionally insert a space after unary ! operator
llvm-svn: 357908
2019-04-08 12:54:48 +00:00
Brad Smith 5f1e87ad40 IAS is now enabled for all OS on MIPS64
llvm-svn: 357879
2019-04-08 00:03:01 +00:00
Brad Smith 0e5ccd9cec Enable IAS for FreeBSD SPARC64.
llvm-svn: 357878
2019-04-07 23:12:31 +00:00
Owen Pan e4f95e8e39 [clang-format] Fix bug https://bugs.llvm.org/show_bug.cgi?id=41413
Differential Revision: https://reviews.llvm.org/D60374

llvm-svn: 357877
2019-04-07 21:05:52 +00:00
Owen Pan fca07890a9 [clang-format] Fix Bug 41407
Differential Revision: https://reviews.llvm.org/D60359

llvm-svn: 357851
2019-04-06 23:10:11 +00:00
Paul Hoad 1db96ac88b [clang-format] BreakAfterReturnType ignored on functions with numeric template parameters
Summary:
Addresses PR40696 - https://bugs.llvm.org/show_bug.cgi?id=40696

The BreakAfterReturnType didn't work if it had a single arguments which was a template with an integer template parameter

```
int  foo(A<8> a) { return a; }
```

When run with the Mozilla style. would not break after the `int`

```
int TestFn(A<8> a)
{
  return a;
}

```

This revision resolves this issue by allowing numeric constants to be considered function parameters if if seen inside `<>`

Reviewers: djasper, klimek, JonasToth, krasimir, reuk, alexfh

Reviewed By: klimek

Subscribers: cfe-commits, llvm-commits

Tags: #clang-tools-extra

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

llvm-svn: 357837
2019-04-06 10:13:04 +00:00