]> granicus.if.org Git - clang/log
clang
5 years agoMoved everything SMT-related to LLVM and updated the cmake scripts.
Mikhail R. Gadelha [Mon, 25 Mar 2019 17:47:45 +0000 (17:47 +0000)]
Moved everything SMT-related to LLVM and updated the cmake scripts.

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

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

5 years ago[clang-format] Refine structured binding detection
Krasimir Georgiev [Mon, 25 Mar 2019 17:29:16 +0000 (17:29 +0000)]
[clang-format] Refine structured binding detection

Summary:
Revision r356575 had the unfortunate consequence that now clang-format never
detects an ObjC call expression after `&&`.

This patch tries harder to distinguish between C++17 structured bindings and
ObjC call expressions and adds a few regression tests.

Reviewers: klimek

Reviewed By: klimek

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[Sema][NFCI] Don't allocate storage for the various CorrectionCandidateCallback unles...
Bruno Ricci [Mon, 25 Mar 2019 17:08:51 +0000 (17:08 +0000)]
[Sema][NFCI] Don't allocate storage for the various CorrectionCandidateCallback unless we are going to do some typo correction

The various CorrectionCandidateCallbacks are currently heap-allocated
unconditionally. This was needed because of delayed typo correction.
However these allocations represent currently 15.4% of all allocations
(number of allocations) when parsing all of Boost (!), mostly because
of ParseCastExpression, ParseStatementOrDeclarationAfterAttrtibutes
and isCXXDeclarationSpecifier. Note that all of these callback objects
are small. Let's not do this.

Instead initially allocate the callback on the stack, and only do a
heap allocation if we are going to do some typo correction. Do this by:

1. Adding a clone function to each callback, which will do a polymorphic
   clone of the callback. This clone function is required to be implemented
   by every callback (of which there is a fair amount). Make sure this is
   the case by making it pure virtual.

2. Use this clone function when we are going to try to correct a typo.

This additionally cut the time of -fsyntax-only on all of Boost by 0.5%
(not that much, but still something). No functional changes intended.

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

Reviewed By: rnk

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

5 years ago[clang] Remove cmake warning message (NFC)
Evandro Menezes [Mon, 25 Mar 2019 16:38:48 +0000 (16:38 +0000)]
[clang] Remove cmake warning message (NFC)

Recognize an empty string for CLANG_DEFAULT_UNWINDLIB as a valid option.

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

5 years agoRevert "[clang-format] Keep protobuf "package" statement on one line"
Haojian Wu [Mon, 25 Mar 2019 15:46:07 +0000 (15:46 +0000)]
Revert "[clang-format] Keep protobuf "package" statement on one line"

This reverts commit r356835. This patch causes a regression, see the
test below:

verifyFormat("// Detached comment\n\n"
             "// Leading comment\n"
             "syntax = \"proto2\"; // trailing comment\n\n"
             "// in foo.bar package\n"
             "package foo.bar; // foo.bar package\n");

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

5 years ago[OpenCL] Allow addr space spelling without __ prefix in C++.
Anastasia Stulova [Mon, 25 Mar 2019 11:54:02 +0000 (11:54 +0000)]
[OpenCL] Allow addr space spelling without __ prefix in C++.

For backwards compatibility we allow alternative spelling of address
spaces - 'private', 'local', 'global', 'constant', 'generic'.

In order to accept 'private' correctly, parsing has been changed to
understand different use cases - access specifier vs address space.

Fixes PR40707 and PR41011!

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

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

5 years ago[ASTImporter] Changed use of Import to Import_New in ASTNodeImporter.
Balazs Keri [Mon, 25 Mar 2019 09:16:39 +0000 (09:16 +0000)]
[ASTImporter] Changed use of Import to Import_New in ASTNodeImporter.

Reviewers: a.sidorin, shafik, martong, a_sidorin

Reviewed By: a_sidorin

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

Tags: #clang

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

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

5 years agoUn-revert "[coroutines][PR40978] Emit error for co_yield within catch block"
Brian Gesiak [Mon, 25 Mar 2019 00:53:10 +0000 (00:53 +0000)]
Un-revert "[coroutines][PR40978] Emit error for co_yield within catch block"

Summary:
https://reviews.llvm.org/D59076 added a new coroutine error that
prevented users from using 'co_await' or 'co_yield' within a exception
handler. However, it was reverted in https://reviews.llvm.org/rC356774
because it caused a regression in nested scopes in C++ catch statements,
as documented by https://bugs.llvm.org/show_bug.cgi?id=41171.

The issue was due to an incorrect use of a `clang::ParseScope`. To fix:

1. Add a regression test for catch statement parsing that mimics the bug
   report from https://bugs.llvm.org/show_bug.cgi?id=41171.
2. Re-apply the coroutines error patch from
   https://reviews.llvm.org/D59076, but this time with the correct
   ParseScope behavior.

Reviewers: GorNishanov, tks2103, rsmith, riccibruno, jbulow

Reviewed By: riccibruno

Subscribers: EricWF, jdoerfert, lewissbaker, cfe-commits

Tags: #clang

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

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

5 years ago[X86] Make _bswap intrinsic a function instead of a macro to hopefully fix the chromi...
Craig Topper [Sun, 24 Mar 2019 18:00:20 +0000 (18:00 +0000)]
[X86] Make _bswap intrinsic a function instead of a macro to hopefully fix the chromium build.

This intrinsic was added in r356848 but was implemented as a macro to match gcc.

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

5 years ago[X86] Add BSR/BSF/BSWAP intrinsics to ia32intrin.h to match gcc.
Craig Topper [Sun, 24 Mar 2019 00:56:52 +0000 (00:56 +0000)]
[X86] Add BSR/BSF/BSWAP intrinsics to ia32intrin.h to match gcc.

Summary:
These are all implemented by icc as well.

I made bit_scan_forward/reverse forward to the __bsfd/__bsrq since we also have
__bsfq/__bsrq.

Note, when lzcnt is enabled the bsr intrinsics generates lzcnt+xor instead of bsr.

Reviewers: RKSimon, spatel

Subscribers: cfe-commits, llvm-commits

Tags: #clang

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

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

5 years ago[WebAssembly] Fix test/Driver/wasm-toolchain.c in the presence of CLANG_DEFAULT_LINKER
Sam Clegg [Sun, 24 Mar 2019 00:03:41 +0000 (00:03 +0000)]
[WebAssembly] Fix test/Driver/wasm-toolchain.c in the presence of CLANG_DEFAULT_LINKER

This was broken in rL356817 (See https://reviews.llvm.org/D59721)

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

5 years agolibclang/CIndexer.cpp: Use loadquery() on AIX for path to library
Hubert Tong [Sat, 23 Mar 2019 18:10:45 +0000 (18:10 +0000)]
libclang/CIndexer.cpp: Use loadquery() on AIX for path to library

Summary:
`dladdr` is not available on AIX. Similar functionality is presented
through `loadquery`. This patch replaces a use of `dladdr` with a
version based on `loadquery`.

Reviewers: sfertile, xingxue, jasonliu

Reviewed By: xingxue

Subscribers: jsji, lhames, majnemer, asb, arphaman, cfe-commits

Tags: #clang

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

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

5 years agoSync some doc changes ClangFormatStyleOptions.rst with doc comments in `Format.h`
Sylvestre Ledru [Sat, 23 Mar 2019 17:57:31 +0000 (17:57 +0000)]
Sync some doc changes ClangFormatStyleOptions.rst with doc comments in `Format.h`

Summary:
These changes were corrected directly in ClangFormatStyleOptions.rst (llvm-svn: 350192 and llvm-svn: 351976) but these sections can be produced automatically using `dump_format_style.py` so sync the corresponding doc comments in `Format.h` as well.

Patch by Ronald Wampler

Reviewers: eugene, sylvestre.ledru, djasper

Reviewed By: sylvestre.ledru

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

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

5 years agoFix unused variable warning. NFCI.
Simon Pilgrim [Sat, 23 Mar 2019 16:16:46 +0000 (16:16 +0000)]
Fix unused variable warning. NFCI.

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

5 years ago[clang-format] Keep protobuf "package" statement on one line
Paul Hoad [Sat, 23 Mar 2019 14:43:41 +0000 (14:43 +0000)]
[clang-format] Keep protobuf "package" statement on one line

Summary:
Top-level "package" and "import" statements should generally be kept on one
line, for all languages.

Reviewers: sammccall, krasimir, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: MyDeveloperDay, cfe-commits

Tags: #clang

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

Patch By: dchai (Donald Chai)

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

5 years agoClang-format: add finer-grained options for putting all arguments on one line
Paul Hoad [Sat, 23 Mar 2019 14:37:58 +0000 (14:37 +0000)]
Clang-format: add finer-grained options for putting all arguments on one line

Summary:
Add two new options,
AllowAllArgumentsOnNextLine and
AllowAllConstructorInitializersOnNextLine.  These mirror the existing
AllowAllParametersOfDeclarationOnNextLine and allow me to support an
internal style guide where I work.  I think this would be generally
useful, some have asked for it on stackoverflow:

https://stackoverflow.com/questions/30057534/clang-format-binpackarguments-not-working-as-expected

https://stackoverflow.com/questions/38635106/clang-format-how-to-prevent-all-function-arguments-on-next-line

Reviewers: djasper, krasimir, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: jkorous, MyDeveloperDay, aol-nnov, lebedev.ri, uohcsemaj, cfe-commits, klimek

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

Patch By: russellmcc  (Russell McClellan)

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

5 years ago[clang-format] correctly format protobuf fields named "enum".
Paul Hoad [Sat, 23 Mar 2019 14:24:30 +0000 (14:24 +0000)]
[clang-format] correctly format protobuf fields named "enum".

Summary: Similar to TypeScript, "enum" is not a reserved word.

Reviewers: krasimir, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: MyDeveloperDay, cfe-commits

Tags: #clang, #clang-tools-extra

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

Patch by: dchai (Donald Chai)

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

5 years agoIRGen: Remove StructorType; thread GlobalDecl through more code. NFCI.
Peter Collingbourne [Fri, 22 Mar 2019 23:05:10 +0000 (23:05 +0000)]
IRGen: Remove StructorType; thread GlobalDecl through more code. NFCI.

This should make it easier to add more structor variants.

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

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

5 years ago[clang-format][NFC] correct the release notes
Paul Hoad [Fri, 22 Mar 2019 22:47:34 +0000 (22:47 +0000)]
[clang-format][NFC] correct the release notes

Move the clang-format notes to the correct section

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

5 years ago[WebAssembly] Make driver -pthread imply linker --shared-memory
Thomas Lively [Fri, 22 Mar 2019 22:25:37 +0000 (22:25 +0000)]
[WebAssembly] Make driver -pthread imply linker --shared-memory

Summary:
This eliminates a linker error the user might otherwise see about how
using the 'atomics' feature requires --shared-memory.

Reviewers: sbc100, aheejin

Subscribers: dschuff, jgravelle-google, sunfish, jfb, cfe-commits

Tags: #clang

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

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

5 years ago[clang] Add support for Exynos M5 (NFC)
Evandro Menezes [Fri, 22 Mar 2019 18:44:09 +0000 (18:44 +0000)]
[clang] Add support for Exynos M5 (NFC)

Add Exynos M5 test cases.

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

5 years agoIR: Support parsing numeric block ids, and emit them in textual output.
James Y Knight [Fri, 22 Mar 2019 18:27:13 +0000 (18:27 +0000)]
IR: Support parsing numeric block ids, and emit them in textual output.

Just as as llvm IR supports explicitly specifying numeric value ids
for instructions, and emits them by default in textual output, now do
the same for blocks.

This is a slightly incompatible change in the textual IR format.

Previously, llvm would parse numeric labels as string names. E.g.
  define void @f() {
    br label %"55"
  55:
    ret void
  }
defined a label *named* "55", even without needing to be quoted, while
the reference required quoting. Now, if you intend a block label which
looks like a value number to be a name, you must quote it in the
definition too (e.g. `"55":`).

Previously, llvm would print nameless blocks only as a comment, and
would omit it if there was no predecessor. This could cause confusion
for readers of the IR, just as unnamed instructions did prior to the
addition of "%5 = " syntax, back in 2008 (PR2480).

Now, it will always print a label for an unnamed block, with the
exception of the entry block. (IMO it may be better to print it for
the entry-block as well. However, that requires updating many more
tests.)

Thus, the following is supported, and is the canonical printing:
  define i32 @f(i32, i32) {
    %3 = add i32 %0, %1
    br label %4

  4:
    ret i32 %3
  }

New test cases covering this behavior are added, and other tests
updated as required.

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

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

5 years ago[ARM] Fix bug 39982 - pcs("aapcs-vfp") is not consistent
Carey Williams [Fri, 22 Mar 2019 16:20:45 +0000 (16:20 +0000)]
[ARM] Fix bug 39982 - pcs("aapcs-vfp") is not consistent

Correctly handle homogeneous aggregates when a
function's ABI is specified via the pcs attribute.

Bug: https://bugs.llvm.org/show_bug.cgi?id=39982
Differential Revision: https://reviews.llvm.org/D59094

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

5 years agoRevert "[coroutines][PR40978] Emit error for co_yield within catch block"
Brian Gesiak [Fri, 22 Mar 2019 16:08:29 +0000 (16:08 +0000)]
Revert "[coroutines][PR40978] Emit error for co_yield within catch block"

The commit https://reviews.llvm.org/rC356296 is causing a regression in nested
catch scopes, https://bugs.llvm.org/show_bug.cgi?id=41171. Revert this change
for now in order to un-break that problem report.

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

5 years ago[OPENMP]Add missing comment, NFC.
Alexey Bataev [Fri, 22 Mar 2019 15:32:02 +0000 (15:32 +0000)]
[OPENMP]Add missing comment, NFC.

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

5 years ago[OPENMP]Allow no allocator clause in target regions with requires
Alexey Bataev [Fri, 22 Mar 2019 15:25:12 +0000 (15:25 +0000)]
[OPENMP]Allow no allocator clause in target regions with requires
dynamic_allocators.

According to the OpenMP 5.0, 2.11.3 allocate Directive, Restrictions,
allocate directives that appear in a target region must specify an
allocator clause unless a requires directive with the dynamic_allocators
clause is present in the same compilation unit. Patch adds a check for a
presence of the requires directive with the dynamic_allocators clause.

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

5 years ago[OPENMP]Emit error message for allocate directive without allocator
Alexey Bataev [Fri, 22 Mar 2019 14:41:39 +0000 (14:41 +0000)]
[OPENMP]Emit error message for allocate directive without allocator
clause in target region.

According to the OpenMP 5.0, 2.11.3 allocate Directive, Restrictions,
allocate directives that appear in a target region must specify an
allocator clause unless a requires directive with the dynamic_allocators
clause is present in the same compilation unit.

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

5 years ago[AST] OMPStructuredBlockTest: avoid using multiline string literals in macros
Roman Lebedev [Fri, 22 Mar 2019 13:40:36 +0000 (13:40 +0000)]
[AST] OMPStructuredBlockTest: avoid using multiline string literals in macros

That is what i have been doing elsewhere in these tests, maybe that's it?

Maybe this helps with failing builds:
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/17921
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-global-isel/builds/10248

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

5 years ago[Tooling] Avoid working-dir races in AllTUsToolExecutor
Ilya Biryukov [Fri, 22 Mar 2019 11:01:13 +0000 (11:01 +0000)]
[Tooling] Avoid working-dir races in AllTUsToolExecutor

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[ARM] Add Cortex-M35P Support
Luke Cheeseman [Fri, 22 Mar 2019 10:58:15 +0000 (10:58 +0000)]
[ARM] Add Cortex-M35P Support

- Add clang frontend testing for Cortex-M35P

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

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

5 years agoThis test assumes that -rtlib defaults to libgcc. But that isn't true in the face...
Sterling Augustine [Thu, 21 Mar 2019 23:30:50 +0000 (23:30 +0000)]
This test assumes that -rtlib defaults to libgcc. But that isn't true in the face of -DCLANG_DEFAULT_RTLIB=compiler-rt.

Subscribers: dberris, jdoerfert, llvm-commits

Tags: #llvm

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

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

5 years ago[AArch64] Split the neon.addp intrinsic into integer and fp variants.
Amara Emerson [Thu, 21 Mar 2019 22:31:37 +0000 (22:31 +0000)]
[AArch64] Split the neon.addp intrinsic into integer and fp variants.

This is the result of discussions on the list about how to deal with intrinsics
which require codegen to disambiguate them via only the integer/fp overloads.
It causes problems for GlobalISel as some of that information is lost during
translation, while with other operations like IR instructions the information is
encoded into the instruction opcode.

This patch changes clang to emit the new faddp intrinsic if the vector operands
to the builtin have FP element types. LLVM IR AutoUpgrade has been taught to
upgrade existing calls to aarch64.neon.addp with fp vector arguments, and
we remove the workarounds introduced for GlobalISel in r355865.

This is a more permanent solution to PR40968.

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

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

5 years ago[OPENMP]Fix a warning about unused variable, NFC.
Alexey Bataev [Thu, 21 Mar 2019 20:52:04 +0000 (20:52 +0000)]
[OPENMP]Fix a warning about unused variable, NFC.

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

5 years agoImprove the diagnostic for #include_next occurring in a file not found
Richard Smith [Thu, 21 Mar 2019 20:42:13 +0000 (20:42 +0000)]
Improve the diagnostic for #include_next occurring in a file not found
in the include path.

Instead of making the incorrect claim that the included file has an
absolute path, describe the actual problem: the including file was found
either by absolute path, or relative to such a file, or relative to the
primary source file.

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

5 years ago[OPENMP] Simplify codegen for allocate directive on local variables.
Alexey Bataev [Thu, 21 Mar 2019 20:36:16 +0000 (20:36 +0000)]
[OPENMP] Simplify codegen for allocate directive on local variables.

Simplified codegen for the allocate directive for local variables,
initial implementation of the codegen for NVPTX target.

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

5 years ago[X86] Correct the value of MaxAtomicInlineWidth for pre-586 cpus
Craig Topper [Thu, 21 Mar 2019 20:36:08 +0000 (20:36 +0000)]
[X86] Correct the value of MaxAtomicInlineWidth for pre-586 cpus

Use the new cx8 feature flag that was added to the backend to represent support for cmpxchg8b. Use this flag to set the MaxAtomicInlineWidth.

This also assumes all the cmpxchg instructions are enabled for CK_Generic which is what cc1 defaults to when nothing is specified.

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

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

5 years ago[Driver] Pass -malign-double from the driver to the cc1 command line
Craig Topper [Thu, 21 Mar 2019 20:07:24 +0000 (20:07 +0000)]
[Driver] Pass -malign-double from the driver to the cc1 command line

-malign-double is currently only implemented in the -cc1 interface. But its declared in Options.td so it is a driver option too. But you try to use it with the driver you'll get a message about the option being unused.

This patch teaches the driver to pass the option through to cc1 so it won't be unused. The Options.td says the option is x86 only but I didn't see any x86 specific code in its impementation in cc1 so not sure if the documentation is wrong or if I should only pass this option through the driver on x86 targets.

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

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

5 years ago[CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue
Akira Hatanaka [Thu, 21 Mar 2019 19:59:49 +0000 (19:59 +0000)]
[CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue
with notail on x86-64.

On x86-64, the epilogue code inserted before the tail jump blocks the
autoreleased return optimization.

rdar://problem/38675807

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

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

5 years agoRefactor handling of #include directives to cleanly separate the
Richard Smith [Thu, 21 Mar 2019 19:44:17 +0000 (19:44 +0000)]
Refactor handling of #include directives to cleanly separate the
"skipped header because it should be imported as a module" cases from
the "skipped header because of some other reason" cases.

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

5 years ago[OPENMP]Codegen support for allocate directive on global variables.
Alexey Bataev [Thu, 21 Mar 2019 19:35:27 +0000 (19:35 +0000)]
[OPENMP]Codegen support for allocate directive on global variables.

For the global variables the allocate directive must specify only the
predefined allocator. This allocator must be translated into the correct
form of the address space for the targets that support different address
spaces.

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

5 years ago[clang][OpenMP] Fix another test when using libgomp.
Jordan Rupprecht [Thu, 21 Mar 2019 19:13:22 +0000 (19:13 +0000)]
[clang][OpenMP] Fix another test when using libgomp.

Similarly to r356614, -fopenmp=libomp needs to be used for some omp-related AST matching.

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

5 years ago[OPENMP]Simplify the check for the predefined allocators, NFC.
Alexey Bataev [Thu, 21 Mar 2019 19:05:07 +0000 (19:05 +0000)]
[OPENMP]Simplify the check for the predefined allocators, NFC.

Previously implemented check required the reevaluation of the already
evaluated predefined allocator kind for the global variables. Patch
simplifies this evaluation and removes extra code.

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

5 years ago[X86] Add __popcntd and __popcntq to ia32intrin.h to match gcc and icc. Remove popcnt...
Craig Topper [Thu, 21 Mar 2019 17:43:53 +0000 (17:43 +0000)]
[X86] Add __popcntd and __popcntq to ia32intrin.h to match gcc and icc. Remove popcnt feature flag from _popcnt32/_popcnt64 and move to ia32intrin.h to match gcc

gcc and icc both implement popcntd and popcntq which we did not. gcc doesn't seem to require a feature flag for the _popcnt32/_popcnt64 spelling and will use a libcall if its not supported.

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

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

5 years ago[X86] Use the CPUKind enum from PROC_ALIAS to directly get the CPUKind in fillValidCP...
Craig Topper [Thu, 21 Mar 2019 17:33:20 +0000 (17:33 +0000)]
[X86] Use the CPUKind enum from PROC_ALIAS to directly get the CPUKind in fillValidCPUList.

We were using getCPUKind which translates the string to the enum also using PROC_ALIAS. This just cuts out the string compares.

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

5 years ago[AST] OMPStructuredBlockTest: two matchers were promoted into ASTMatchers.h
Roman Lebedev [Thu, 21 Mar 2019 15:50:54 +0000 (15:50 +0000)]
[AST] OMPStructuredBlockTest: two matchers were promoted into ASTMatchers.h

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

5 years ago[ASTMatcher] Add clang-query disclaimer to two more matchers that take enum
Roman Lebedev [Thu, 21 Mar 2019 15:33:43 +0000 (15:33 +0000)]
[ASTMatcher] Add clang-query disclaimer to two more matchers that take enum

As we have figured out in
https://reviews.llvm.org/D57112
and
https://bugs.llvm.org/show_bug.cgi?id=41176

this kind-of works, but needs special care.

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

5 years ago[ASTMatchers][OpenMP] OpenMP Structured-block-related matchers
Roman Lebedev [Thu, 21 Mar 2019 15:33:35 +0000 (15:33 +0000)]
[ASTMatchers][OpenMP] OpenMP Structured-block-related matchers

Summary: Exposes to the  for ASTMatchers the interface/modelling
of OpenMP structured-block.

Reviewers: gribozavr, aaron.ballman, JonasToth, george.karpenkov

Reviewed By: gribozavr, aaron.ballman

Subscribers: guansong, jdoerfert, cfe-commits

Tags: #clang, #openmp

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

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

5 years ago[ASTTypeTraits][ASTMatchers][OpenMP] OMPClause handling
Roman Lebedev [Thu, 21 Mar 2019 15:33:24 +0000 (15:33 +0000)]
[ASTTypeTraits][ASTMatchers][OpenMP] OMPClause handling

Summary:
`OMPClause` is the base class, it is not descendant from **any**
other class, therefore for it to work with e.g.
`VariadicDynCastAllOfMatcher<>`, it needs to be handled here.

Reviewers: sbenza, bkramer, pcc, klimek, hokein, gribozavr, aaron.ballman, george.karpenkov

Reviewed By: gribozavr, aaron.ballman

Subscribers: guansong, jdoerfert, alexfh, ABataev, cfe-commits

Tags: #openmp, #clang

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

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

5 years ago[ASTMatchers][OpenMP] Add base ompExecutableDirective() matcher.
Roman Lebedev [Thu, 21 Mar 2019 15:33:10 +0000 (15:33 +0000)]
[ASTMatchers][OpenMP] Add base ompExecutableDirective() matcher.

Summary:
A simple matcher for `OMPExecutableDirective` Stmt type.
Split off from D57113.

Reviewers: gribozavr, aaron.ballman, JonasToth, george.karpenkov

Reviewed By: gribozavr, aaron.ballman

Subscribers: guansong, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years agoPermit redeclarations of a builtin to specify calling convention.
Erich Keane [Thu, 21 Mar 2019 13:30:56 +0000 (13:30 +0000)]
Permit redeclarations of a builtin to specify calling convention.

After https://reviews.llvm.org/rL355317 we noticed that quite a decent
amount of code redeclares builtins (memcpy in particular, I believe
reduced from an MSVC header) with a calling convention specified.
This gets particularly troublesome when the user specifies a new
'default' calling convention on the command line.

When looking to add a diagnostic for this case, it was noticed that we
had 3 other diagnostics that differed only slightly.  This patch ALSO
unifies those under a 'select'.  Unfortunately, the order of words in
ONE of these diagnostics was reversed ("'thiscall' calling convention"
vs "calling convention 'thiscall'"), so this patch also standardizes on
the former.

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

Change-Id: I79f99fe7c2301640755ffdd774b46eb44526bb22

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

5 years ago[clang-format] Add basic support for formatting C# files
Paul Hoad [Thu, 21 Mar 2019 13:09:22 +0000 (13:09 +0000)]
[clang-format] Add basic support for formatting C# files

Summary:

This revision adds basic support for formatting C# files with clang-format, I know the barrier to entry is high here  so I'm sending this revision in to test the water as to whether this might be something we'd consider landing.

Tracking in Bugzilla as:
https://bugs.llvm.org/show_bug.cgi?id=40850

Justification:
C# code just looks ugly in comparison to the C++ code in our source tree which is clang-formatted.

I've struggled with Visual Studio reformatting to get a clean and consistent style, I want to format our C# code on saving like I do now for C++ and i want it to have the same style as defined in our .clang-format file, so it consistent as it can be with C++.  (Braces/Breaking/Spaces/Indent etc..)

Using clang format without this patch leaves the code in a bad state, sometimes when the BreakStringLiterals is set, it  fails to compile.

Mostly the C# is similar to Java, except instead of JavaAnnotations I try to reuse the TT_AttributeSquare.

Almost the most valuable portion is to have a new Language in order to partition the configuration for C# within a common .clang-format file, with the auto detection on the .cs extension. But there are other C# specific styles that could be added later if this is accepted. in particular how  `{ set;get }` is formatted.

Reviewers: djasper, klimek, krasimir, benhamilton, JonasToth

Reviewed By: klimek

Subscribers: llvm-commits, mgorny, jdoerfert, cfe-commits

Tags: #clang, #clang-tools-extra

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

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

5 years agocreduce-clang-crash.py: preprocess file + reduce commandline
George Burgess IV [Thu, 21 Mar 2019 01:01:53 +0000 (01:01 +0000)]
creduce-clang-crash.py: preprocess file + reduce commandline

This CL causes our creduce-clang-crash.py util to:

- try to preprocess the file before reducing
- try to remove some command line arguments
- now require a llvm bin directory, since the generated crash script
  doesn't have an absolute path for clang

It also marks it as executable, since I forgot to do that in the last
commit. :)

Patch by Amy Huang!

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

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

5 years ago[CFG] [analyzer] pr41142: C++17: Skip transparent InitListExprs in constructors.
Artem Dergachev [Thu, 21 Mar 2019 00:15:07 +0000 (00:15 +0000)]
[CFG] [analyzer] pr41142: C++17: Skip transparent InitListExprs in constructors.

When searching for construction contexts, i.e. figuring out which statements
define the object that is constructed by each construct-expression, ignore
transparent init-list expressions because they don't add anything to the
context. This allows the Static Analyzer to model construction, destruction,
materialization, lifetime extension correctly in more cases. Also fixes
a crash caused by incorrectly evaluating initial values of variables
initialized with such expressions.

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

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

5 years agoRemove extra white spaces
Jennifer Yu [Wed, 20 Mar 2019 23:05:18 +0000 (23:05 +0000)]
Remove extra white spaces

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

5 years agoRevert "[clangd] Print arguments in template specializations"
Jordan Rupprecht [Wed, 20 Mar 2019 22:51:56 +0000 (22:51 +0000)]
Revert "[clangd] Print arguments in template specializations"

This reverts commit 44a63f6a150dec72dea43730d2a89d292e58bd6f. It segfaults on an internal test case (will follow up off thread).

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

5 years ago[clang-format][NFC] fix release notes build issue
Paul Hoad [Wed, 20 Mar 2019 21:02:12 +0000 (21:02 +0000)]
[clang-format][NFC] fix release notes build issue

build issue from r356613

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

5 years ago[clang][OpenMP] Fix build when using libgomp
Jordan Rupprecht [Wed, 20 Mar 2019 21:01:56 +0000 (21:01 +0000)]
[clang][OpenMP] Fix build when using libgomp

Summary: rL356570 introduced a test which only passes with the default openmp library, libomp, and fails with other openmp libraries, such as libgomp. Explicitly choose libomp.

Reviewers: lebedev.ri

Subscribers: guansong, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[clang-format] BeforeHash added to IndentPPDirectives
Paul Hoad [Wed, 20 Mar 2019 20:49:43 +0000 (20:49 +0000)]
[clang-format] BeforeHash added to IndentPPDirectives

Summary:
The option BeforeHash added to IndentPPDirectives.
Fixes Bug 36019. https://bugs.llvm.org/show_bug.cgi?id=36019

Reviewers: djasper, klimek, krasimir, sammccall, mprobst, Nicola, MyDeveloperDay

Reviewed By: klimek, MyDeveloperDay

Subscribers: kadircet, MyDeveloperDay, mnussbaum, geleji, ufna, cfe-commits

Patch by to-mix.

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

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

5 years ago[X86] Add __crc32b/__crc32w/__crc32d/__crc32q intrinsics to match gcc and icc.
Craig Topper [Wed, 20 Mar 2019 20:25:28 +0000 (20:25 +0000)]
[X86] Add __crc32b/__crc32w/__crc32d/__crc32q intrinsics to match gcc and icc.

gcc has these intrinsics in ia32intrin.h as well. And icc implements them
though they aren't documented in the Intel Intrinsics Guide.

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

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

5 years ago[OPENMP]Improve detection of omp_allocator_handle_t type and predefined
Alexey Bataev [Wed, 20 Mar 2019 20:14:22 +0000 (20:14 +0000)]
[OPENMP]Improve detection of omp_allocator_handle_t type and predefined
allocators.

It is better to deduce omp_allocator_handle_t type from the predefined
allocators, because omp.h header might not define it explicitly. Plus,
it allows to identify the predefined allocators correctly when trying to
build the allcoator for the global variables.

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

5 years agoFix implicit ios -> watchOS availability version mapping for
Alex Lorenz [Wed, 20 Mar 2019 20:02:00 +0000 (20:02 +0000)]
Fix implicit ios -> watchOS availability version mapping for
versions that have the major number only

rdar://48018651

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

5 years agoAdd a __has_extension check for '#pragma clang attribute' as an external-declaration
Erik Pilkington [Wed, 20 Mar 2019 19:26:37 +0000 (19:26 +0000)]
Add a __has_extension check for '#pragma clang attribute' as an external-declaration

This was added in r356075.

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

5 years ago[Sema] Deduplicate some availability checking logic
Erik Pilkington [Wed, 20 Mar 2019 19:26:33 +0000 (19:26 +0000)]
[Sema] Deduplicate some availability checking logic

Before this commit, we emit unavailable errors for calls to functions during
overload resolution, and for references to all other declarations in
DiagnoseUseOfDecl. The early checks during overload resolution aren't as good as
the DiagnoseAvailabilityOfDecl based checks, as they error on the code from
PR40991. This commit fixes this by removing the early checking.

llvm.org/PR40991
rdar://48564179

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

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

5 years agoRecommit "Support attribute used in member funcs of class templates"
Rafael Auler [Wed, 20 Mar 2019 19:22:24 +0000 (19:22 +0000)]
Recommit "Support attribute used in member funcs of class templates"

This diff previously exposed a bug in LLVM's IRLinker, breaking
buildbots that tried to self-host LLVM with monolithic LTO.
The bug is now in LLVM by D59552

Original commit message:
As PR17480 describes, clang does not support the used attribute
for member functions of class templates. This means that if the member
function is not used, its definition is never instantiated. This patch
changes clang to emit the definition if it has the used attribute.

Test Plan: Added a testcase

Reviewed By: aaron.ballman

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

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

5 years agoRemove the unused return value in ASTImporter::Imported [NFC]
Raphael Isemann [Wed, 20 Mar 2019 19:00:25 +0000 (19:00 +0000)]
Remove the unused return value in ASTImporter::Imported [NFC]

Summary:
`ASTImporter::Imported` currently returns a Decl, but that return value is not used by the ASTImporter (or anywhere else)
nor is it documented.

Reviewers: balazske, martong, a.sidorin, shafik

Reviewed By: balazske, martong

Subscribers: rnkovacs, cfe-commits

Tags: #clang

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

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

5 years ago[X86] Remove getCPUKindCanonicalName which is unused.
Craig Topper [Wed, 20 Mar 2019 17:26:51 +0000 (17:26 +0000)]
[X86] Remove getCPUKindCanonicalName which is unused.

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

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

5 years ago[NFC][ASTMatchers] Alphabetically sort REGISTER_MATCHER() macros in RegistryMaps...
Roman Lebedev [Wed, 20 Mar 2019 17:15:47 +0000 (17:15 +0000)]
[NFC][ASTMatchers] Alphabetically sort REGISTER_MATCHER() macros in RegistryMaps::RegistryMaps()

As noted in https://reviews.llvm.org/D59453#inline-526253

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

5 years ago[AST] Disable ast-dump-openmp-parallel-master-XFAIL.c test
Roman Lebedev [Wed, 20 Mar 2019 17:14:49 +0000 (17:14 +0000)]
[AST] Disable ast-dump-openmp-parallel-master-XFAIL.c test

Fails on MSVC buildbot (but not locally).
Not important as it is 'testing' something that isn't supported yet anyway:
https://bugs.llvm.org/show_bug.cgi?id=41022

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

5 years ago[clang-format] structured binding in range for detected as Objective C
Paul Hoad [Wed, 20 Mar 2019 17:10:23 +0000 (17:10 +0000)]
[clang-format] structured binding in range for detected as Objective C

Summary:
Sometime after 6.0.0 and the current trunk 9.0.0 the following code would be considered as objective C and not C++

Reported by: https://twitter.com/mattgodbolt/status/1096188576503644160

$ clang-format.exe test.h
Configuration file(s) do(es) not support Objective-C: C:\clang\build\.clang-format

--- test.h --
```

std::vector<std::pair<std::string,std::string>> C;

void foo()
{
   for (auto && [A,B] : C)
   {
       std::string D = A + B;
   }
}
```
The following code fixes this issue of incorrect detection

Reviewers: djasper, klimek, JonasToth, reuk

Reviewed By: klimek

Subscribers: cfe-commits

Tags: #clang-tools-extra

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

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

5 years ago[OpenCL] Generate 'unroll.enable' metadata for __attribute__((opencl_unroll_hint))
Andrew Savonichev [Wed, 20 Mar 2019 16:43:07 +0000 (16:43 +0000)]
[OpenCL] Generate 'unroll.enable' metadata for  __attribute__((opencl_unroll_hint))

Summary:
[OpenCL] Generate 'unroll.enable' metadata for  __attribute__((opencl_unroll_hint))

For both !{!"llvm.loop.unroll.enable"} and !{!"llvm.loop.unroll.full"} the unroller
will try to fully unroll a loop unless the trip count is not known at compile time.
In that case for '.full' metadata no unrolling will be processed, while for '.enable'
the loop will be partially unrolled with a heuristically chosen unroll factor.

See: docs/LanguageExtensions.rst

From https://www.khronos.org/registry/OpenCL/sdk/2.0/docs/man/xhtml/attributes-loopUnroll.html

    __attribute__((opencl_unroll_hint))
    for (int i=0; i<2; i++)
    {
        ...
    }

In the example above, the compiler will determine how much to unroll the loop.

Before the patch for  __attribute__((opencl_unroll_hint)) was generated metadata
!{!"llvm.loop.unroll.full"}, which limits ability of loop unroller to decide, how
much to unroll the loop.

Reviewers: Anastasia, yaxunl

Reviewed By: Anastasia

Subscribers: zzheng, dmgreen, jdoerfert, cfe-commits, asavonic, AlexeySotkin

Tags: #clang

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

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

5 years ago[clang][OpeMP] Model OpenMP structured-block in AST (PR40563)
Roman Lebedev [Wed, 20 Mar 2019 16:32:36 +0000 (16:32 +0000)]
[clang][OpeMP] Model OpenMP structured-block in AST (PR40563)

Summary:
https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-5.0.pdf, page 3:
```
structured block

For C/C++, an executable statement, possibly compound, with a single entry at the
top and a single exit at the bottom, or an OpenMP construct.

COMMENT: See Section 2.1 on page 38 for restrictions on structured
blocks.
```
```
2.1 Directive Format

Some executable directives include a structured block. A structured block:
• may contain infinite loops where the point of exit is never reached;
• may halt due to an IEEE exception;
• may contain calls to exit(), _Exit(), quick_exit(), abort() or functions with a
_Noreturn specifier (in C) or a noreturn attribute (in C/C++);
• may be an expression statement, iteration statement, selection statement, or try block, provided
that the corresponding compound statement obtained by enclosing it in { and } would be a
structured block; and

Restrictions
Restrictions to structured blocks are as follows:
• Entry to a structured block must not be the result of a branch.
• The point of exit cannot be a branch out of the structured block.
C / C++
• The point of entry to a structured block must not be a call to setjmp().
• longjmp() and throw() must not violate the entry/exit criteria.
```

Of particular note here is the fact that OpenMP structured blocks are as-if `noexcept`,
in the same sense as with the normal `noexcept` functions in C++.
I.e. if throw happens, and it attempts to travel out of the `noexcept` function
(here: out of the current structured-block), then the program terminates.

Now, one of course can say that since it is explicitly prohibited by the Specification,
then any and all programs that violate this Specification contain undefined behavior,
and are unspecified, and thus no one should care about them. Just don't write broken code /s

But i'm not sure this is a reasonable approach.
I have personally had oss-fuzz issues of this origin - exception thrown inside
of an OpenMP structured-block that is not caught, thus causing program termination.
This issue isn't all that hard to catch, it's not any particularly different from
diagnosing the same situation with the normal `noexcept` function.

Now, clang static analyzer does not presently model exceptions.
But clang-tidy has a simplisic [[ https://clang.llvm.org/extra/clang-tidy/checks/bugprone-exception-escape.html | bugprone-exception-escape ]] check,
and it is even refactored as a `ExceptionAnalyzer` class for reuse.
So it would be trivial to use that analyzer to check for
exceptions escaping out of OpenMP structured blocks. (D59466)

All that sounds too great to be true. Indeed, there is a caveat.
Presently, it's practically impossible to do. To check a OpenMP structured block
you need to somehow 'get' the OpenMP structured block, and you can't because
it's simply not modelled in AST. `CapturedStmt`/`CapturedDecl` is not it's representation.

Now, it is of course possible to write e.g. some AST matcher that would e.g.
match every OpenMP executable directive, and then return the whatever `Stmt` is
the structured block of said executable directive, if any.
But i said //practically//. This isn't practical for the following reasons:
1. This **will** bitrot. That matcher will need to be kept up-to-date,
   and refreshed with every new OpenMP spec version.
2. Every single piece of code that would want that knowledge would need to
   have such matcher. Well, okay, if it is an AST matcher, it could be shared.
   But then you still have `RecursiveASTVisitor` and friends.
   `2 > 1`, so now you have code duplication.

So it would be reasonable (and is fully within clang AST spirit) to not
force every single consumer to do that work, but instead store that knowledge
in the correct, and appropriate place - AST, class structure.

Now, there is another hoop we need to get through.
It isn't fully obvious //how// to model this.
The best solution would of course be to simply add a `OMPStructuredBlock` transparent
node. It would be optimal, it would give us two properties:
* Given this `OMPExecutableDirective`, what's it OpenMP structured block?
* It is trivial to  check whether the `Stmt*` is a OpenMP structured block (`isa<OMPStructuredBlock>(ptr)`)

But OpenMP structured block isn't **necessarily** the first, direct child of `OMP*Directive`.
(even ignoring the clang's `CapturedStmt`/`CapturedDecl` that were inserted inbetween).
So i'm not sure whether or not we could re-create AST statements after they were already created?
There would be other costs to a new AST node: https://bugs.llvm.org/show_bug.cgi?id=40563#c12
```
1. You will need to break the representation of loops. The body should be replaced by the "structured block" entity.
2. You will need to support serialization/deserialization.
3. You will need to support template instantiation.
4. You will need to support codegen and take this new construct to account in each OpenMP directive.
```

Instead, there **is** an functionally-equivalent, alternative solution, consisting of two parts.

Part 1:
* Add a member function `isStandaloneDirective()` to the `OMPExecutableDirective` class,
  that will tell whether this directive is stand-alone or not, as per the spec.
  We need it because we can't just check for the existance of associated statements,
  see code comment.
* Add a member function `getStructuredBlock()` to the OMPExecutableDirective` class itself,
  that assert that this is not a stand-alone directive, and either return the correct loop body
  if this is a loop-like directive, or the captured statement.
This way, given an `OMPExecutableDirective`, we can get it's structured block.
Also, since the knowledge is ingrained into the clang OpenMP implementation,
it will not cause any duplication, and //hopefully// won't bitrot.

Great we achieved 1 of 2 properties of `OMPStructuredBlock` approach.

Thus, there is a second part needed:
* How can we check whether a given `Stmt*` is `OMPStructuredBlock`?
Well, we can't really, in general. I can see this workaround:
```
class FunctionASTVisitor : public RecursiveASTVisitor<FunctionASTVisitor> {
  using Base = RecursiveASTVisitor<FunctionASTVisitor>;
public:
  bool VisitOMPExecDir(OMPExecDir *D) {
    OmpStructuredStmts.emplace_back(D.getStructuredStmt());
  }
  bool VisitSOMETHINGELSE(???) {
    if(InOmpStructuredStmt)
      HI!
  }
  bool TraverseStmt(Stmt *Node) {
    if (!Node)
      return Base::TraverseStmt(Node);
    if (OmpStructuredStmts.back() == Node)
      ++InOmpStructuredStmt;
    Base::TraverseStmt(Node);
    if (OmpStructuredStmts.back() == Node) {
      OmpStructuredStmts.pop_back();
      --InOmpStructuredStmt;
    }
    return true;
  }
  std::vector<Stmt*> OmpStructuredStmts;
  int InOmpStructuredStmt = 0;
};
```
But i really don't see using it in practice.
It's just too intrusive; and again, requires knowledge duplication.

.. but no. The solution lies right on the ground.
Why don't we simply store this `i'm a openmp structured block` in the bitfield of the `Stmt` itself?
This does not appear to have any impact on the memory footprint of the clang AST,
since it's just a single extra bit in the bitfield. At least the static assertions don't fail.
Thus, indeed, we can achieve both of the properties without a new AST node.

We can cheaply set that bit right in sema, at the end of `Sema::ActOnOpenMPExecutableDirective()`,
by just calling the `getStructuredBlock()` that we just added.
Test coverage that demonstrates all this has been added.

This isn't as great with serialization though. Most of it does not use abbrevs,
so we do end up paying the full price (4 bytes?) instead of a single bit.
That price, of course, can be reclaimed by using abbrevs.
In fact, i suspect that //might// not just reclaim these bytes, but pack these PCH significantly.

I'm not seeing a third solution. If there is one, it would be interesting to hear about it.
("just don't write code that would require `isa<OMPStructuredBlock>(ptr)`" is not a solution.)

Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=40563 | PR40563 ]].

Reviewers: ABataev, rjmccall, hfinkel, rsmith, riccibruno, gribozavr

Reviewed By: ABataev, gribozavr

Subscribers: mgorny, aaron.ballman, steveire, guansong, jfb, jdoerfert, cfe-commits

Tags: #clang, #openmp

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

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

5 years ago[NFC][clang][astdump] Some baseline tests for OpenMP
Roman Lebedev [Wed, 20 Mar 2019 16:31:47 +0000 (16:31 +0000)]
[NFC][clang][astdump] Some baseline tests for OpenMP

Summary:
Split off from D59214.
Not a fully exhaustive test coverage, but better than what there currently is.

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

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

5 years ago[ASTImporter] Remove obsolete function ImportTemplateParameterList.
Balazs Keri [Wed, 20 Mar 2019 15:42:42 +0000 (15:42 +0000)]
[ASTImporter] Remove obsolete function ImportTemplateParameterList.

Summary:
The ASTNodeImporter::ImportTemplateParameterList is replaced by a
template specialization of 'import' that already exists and does
(almost) the same thing.

Reviewers: martong, a.sidorin, shafik, a_sidorin

Reviewed By: martong

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

Tags: #clang

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

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

5 years agoCorrect this attribute group documentation to have a heading, which fixes the docs...
Aaron Ballman [Wed, 20 Mar 2019 11:58:38 +0000 (11:58 +0000)]
Correct this attribute group documentation to have a heading, which fixes the docs builder.

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

5 years agoFix -Wdocumentation warning. NFCI.
Simon Pilgrim [Wed, 20 Mar 2019 10:28:08 +0000 (10:28 +0000)]
Fix -Wdocumentation warning. NFCI.

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

5 years ago[clangd] Print arguments in template specializations
Kadir Cetinkaya [Wed, 20 Mar 2019 09:43:38 +0000 (09:43 +0000)]
[clangd] Print arguments in template specializations

Reviewers: ilya-biryukov

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

Tags: #clang

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

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

5 years ago[X86] Separate PentiumPro and i686. They aren't aliases in the backend.
Craig Topper [Wed, 20 Mar 2019 07:31:18 +0000 (07:31 +0000)]
[X86] Separate PentiumPro and i686. They aren't aliases in the backend.

PentiumPro has HasNOPL set in the backend. i686 does not.

Despite having a function that looks like it canonicalizes alias names. It
doesn't seem to be called. So I don't think this is a functional change. But its
good to be consistent between the backend and frontend.

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

5 years agoReplace tok::angle_string_literal with new tok::header_name.
Richard Smith [Tue, 19 Mar 2019 22:09:55 +0000 (22:09 +0000)]
Replace tok::angle_string_literal with new tok::header_name.

Use the new kind for both angled header-name tokens and for
double-quoted header-name tokens.

This is in preparation for C++20's context-sensitive header-name token
formation rules.

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

5 years agoFix CodeGen/arm64-microsoft-status-reg.cpp test
Jordan Rupprecht [Tue, 19 Mar 2019 20:55:14 +0000 (20:55 +0000)]
Fix CodeGen/arm64-microsoft-status-reg.cpp test

Summary: This test is failing after r356499 (verified with `ninja check-clang-codegen`). Update the register selection used in the test from x0 to x8.

Reviewers: arsenm, MatzeB, efriedma

Reviewed By: efriedma

Subscribers: efriedma, wdng, javed.absar, kristof.beyls, cfe-commits

Tags: #clang

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

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

5 years agoAdd a spelling of pass_object_size that uses __builtin_dynamic_object_size
Erik Pilkington [Tue, 19 Mar 2019 20:44:18 +0000 (20:44 +0000)]
Add a spelling of pass_object_size that uses __builtin_dynamic_object_size

The attribute pass_dynamic_object_size(n) behaves exactly like
pass_object_size(n), but instead of evaluating __builtin_object_size on calls,
it evaluates __builtin_dynamic_object_size, which has the potential to produce
runtime code when the object size can't be determined statically.

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

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

5 years ago[OPENMP]Warn if the different allocator is used for the variable.
Alexey Bataev [Tue, 19 Mar 2019 20:33:44 +0000 (20:33 +0000)]
[OPENMP]Warn if the different allocator is used for the variable.

If the allocator was specified for the variable and next one is found
with the different allocator, the warning is emitted, and the allocator
is ignored.

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

5 years agoAdd --unwindlib=[libgcc|compiler-rt] to parallel --rtlib= [take 2]
Sterling Augustine [Tue, 19 Mar 2019 20:01:59 +0000 (20:01 +0000)]
Add --unwindlib=[libgcc|compiler-rt] to parallel --rtlib= [take 2]

"clang++ hello.cc --rtlib=compiler-rt"

now can works without specifying additional unwind or exception
handling libraries.

This reworked version of the feature no longer modifies today's default
unwind library for compiler-rt: which is nothing. Rather, a user
can specify -DCLANG_DEFAULT_UNWINDLIB=libunwind when configuring
the compiler.

This should address the issues from the previous version.

Update tests for new --unwindlib semantics.

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

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

5 years agoMove options to separate checks that do not need to immediately follow the previous...
Douglas Yung [Tue, 19 Mar 2019 19:34:15 +0000 (19:34 +0000)]
Move options to separate checks that do not need to immediately follow the previous option. NFCI

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

5 years agoFix unused variable warning. NFCI.
Simon Pilgrim [Tue, 19 Mar 2019 18:39:46 +0000 (18:39 +0000)]
Fix unused variable warning. NFCI.

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

5 years ago[OPENMP]Check that global vars require predefined allocator.
Alexey Bataev [Tue, 19 Mar 2019 18:39:11 +0000 (18:39 +0000)]
[OPENMP]Check that global vars require predefined allocator.

According to OpenMP, 2.11.3 allocate Directive, Restrictions, C / C++,
if a list item has a static storage type, the allocator expression in
  the allocator clause must be a constant expression that evaluates to
  one of the predefined memory allocator values. Added check for this
  restriction.

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

5 years ago[OPENMP]Remove unused parameter, NFC.
Alexey Bataev [Tue, 19 Mar 2019 17:09:52 +0000 (17:09 +0000)]
[OPENMP]Remove unused parameter, NFC.

Parameter CodeGenModule &CGM is not required for CGOpenMPRuntime member
functions, since class holds the reference to the CGM.

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

5 years ago[OpenCL] Minor improvements in default header testing
Anastasia Stulova [Tue, 19 Mar 2019 17:09:06 +0000 (17:09 +0000)]
[OpenCL] Minor improvements in default header testing

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

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

5 years ago[Sema] Adjust addr space of reference operand in compound assignment
Anastasia Stulova [Tue, 19 Mar 2019 16:50:21 +0000 (16:50 +0000)]
[Sema] Adjust addr space of reference operand in compound assignment

When we create overloads for the builtin compound assignment operators
we need to preserve address space for the reference operand taking it
from the argument that is passed in.

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

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

5 years ago[OPENMP] Codegen for local variables with the allocate pragma.
Alexey Bataev [Tue, 19 Mar 2019 16:41:16 +0000 (16:41 +0000)]
[OPENMP] Codegen for local variables with the allocate pragma.

Added initial codegen for the local variables with the #pragma omp
allocate directive. Instead of allocating the variables on the stack,
__kmpc_alloc|__kmpc_free functions are used for memory (de-)allocation.

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

5 years agoEnsure that const variables declared at namespace scope correctly have external linka...
Aaron Ballman [Tue, 19 Mar 2019 14:53:52 +0000 (14:53 +0000)]
Ensure that const variables declared at namespace scope correctly have external linkage when marked as dllexport and targeting the MSVC ABI.

Patch thanks to Zahira Ammarguellat.

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

5 years ago[ASTImporter] Fix redecl failures of FunctionTemplateSpec
Gabor Marton [Tue, 19 Mar 2019 14:04:50 +0000 (14:04 +0000)]
[ASTImporter] Fix redecl failures of FunctionTemplateSpec

Summary:
Redecl chains of function template specializations are not handled well
currently. We want to handle them similarly to functions, i.e. try to
keep the structure of the original AST as much as possible. The aim is
to not squash a prototype with a definition, rather we create both and
put them in a redecl chain.

Reviewers: a_sidorin, shafik, a.sidorin

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

Tags: #clang

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

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

5 years ago[ASTImporter] Fix redecl failures of ClassTemplateSpec
Gabor Marton [Tue, 19 Mar 2019 13:34:10 +0000 (13:34 +0000)]
[ASTImporter] Fix redecl failures of ClassTemplateSpec

Summary:
Redecl chains of class template specializations are not handled well
currently. We want to handle them similarly to functions, i.e. try to
keep the structure of the original AST as much as possible. The aim is
to not squash a prototype with a definition, rather we create both and
put them in a redecl chain.

Reviewers: a_sidorin, shafik, a.sidorin

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

Tags: #clang

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

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

5 years ago[OpenCL] Improved testing of default header.
Anastasia Stulova [Tue, 19 Mar 2019 13:04:17 +0000 (13:04 +0000)]
[OpenCL] Improved testing of default header.

Improved some checks and moved testing of the default header
in C++ mode into the Headers folder.

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

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

5 years ago[clang-format] [JS] handle private members.
Martin Probst [Tue, 19 Mar 2019 12:28:41 +0000 (12:28 +0000)]
[clang-format] [JS] handle private members.

Addresses PR40999 https://bugs.llvm.org/show_bug.cgi?id=40999

Private fields and methods in JavaScript would get incorrectly indented
(it sees them as preprocessor directives and hence left aligns them)

In this revision `#identifier` tokens `tok::hash->tok::identifier` are
merged into a single new token `tok::identifier` with the `#` contained
inside the TokenText.

Before:

```
class Example {
  pub = 1;

  static pub2 = "foo";
  static #priv2 = "bar";

  method() { this.#priv = 5; }

  static staticMethod() {
    switch (this.#priv) {
    case '1':
      break;
    }
  }

  this.#privateMethod(); // infinite loop
}

static #staticPrivateMethod() {}
}
```

After this fix the code will be correctly indented

```
class Example {
  pub = 1;
  #priv = 2;

  static pub2 = "foo";
  static #priv2 = "bar";

  method() { this.#priv = 5; }

  static staticMethod() {
    switch (this.#priv) {
    case '1':
      #priv = 3;
      break;
    }
  }

  #privateMethod() {
    this.#privateMethod(); // infinite loop
  }

  static #staticPrivateMethod() {}
}
```

NOTE: There might be some JavaScript code out there which uses the C
processor to preprocess .js files
http://www.nongnu.org/espresso/js-cpp.html. It's not clear how this
revision or even private fields and methods would interact.

Patch originally by MyDeveloperDays (thanks!).

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

5 years ago[clang-format] [JS] Don't break between template string and tag
Martin Probst [Tue, 19 Mar 2019 11:15:52 +0000 (11:15 +0000)]
[clang-format] [JS] Don't break between template string and tag

Before:
    const x = veryLongIdentifier
        `hello`;
After:
    const x =
        veryLongIdentifier`hello`;

While it's allowed to have the template string and tag identifier
separated by a line break, currently the clang-format output is not
stable when a break is forced. Additionally, disallowing a line break
makes it clear that the identifier is actually a tag for a template
string.

Patch originally by mitchellwills (thanks!).

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

5 years ago[Tooling] Add more scope specifiers until spelling is not ambiguous.
Eric Liu [Tue, 19 Mar 2019 10:12:15 +0000 (10:12 +0000)]
[Tooling] Add more scope specifiers until spelling is not ambiguous.

Summary:
Previously, when the renamed spelling is ambiguous, we simply use the
full-qualfied name (with leading "::"). This patch makes it try adding
additional specifiers one at a time until name is no longer ambiguous,
which allows us to find better disambuguated spelling.

Reviewers: kadircet, gribozavr

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

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

5 years agoRefactor cast<>'s in if conditionals, which can only assert on failure.
Don Hinton [Tue, 19 Mar 2019 06:14:14 +0000 (06:14 +0000)]
Refactor cast<>'s in if conditionals, which can only assert on failure.

Summary:
This patch refactors several instances of cast<> used in if
conditionals.  Since cast<> asserts on failure, the else branch can
never be taken.

In some cases, the fix is to replace cast<> with dyn_cast<>.  While
others required the removal of the conditional and some minor
refactoring.

A discussion can be seen here: http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20190318/265044.html

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

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

5 years ago[WebAssembly] Change wasm.throw's first argument to an immediate
Heejin Ahn [Tue, 19 Mar 2019 04:58:59 +0000 (04:58 +0000)]
[WebAssembly] Change wasm.throw's first argument to an immediate

Summary:
`wasm.throw` builtin's first 'tag' argument should be an immediate index
into the event section.

Reviewers: dschuff, craig.topper

Subscribers: sbc100, jgravelle-google, sunfish, cfe-commits

Tags: #clang

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

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

5 years agoFactor out repeated code parsing and concatenating header-names from
Richard Smith [Tue, 19 Mar 2019 01:51:19 +0000 (01:51 +0000)]
Factor out repeated code parsing and concatenating header-names from
tokens.

We now actually form an angled_string_literal token for a header name by
concatenation rather than just working out what its contents would be.
This substantially simplifies downstream processing and is necessary for
C++20 header unit imports.

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

5 years agoDon't apply the include depth limit until we actually decide to enter
Richard Smith [Tue, 19 Mar 2019 01:51:17 +0000 (01:51 +0000)]
Don't apply the include depth limit until we actually decide to enter
the file.

NFC unless a skipped #include is found at the final permitted #include
level.

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