Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

WIP: Update to LLVM 5.0 #19

Closed
wants to merge 2,517 commits into from

Conversation

dylanmckay
Copy link
Contributor

This pull request updates the fastcomp clang compiler to LLVM 5.0.

It is a merge of the llvm-project/cfe/branches/release_50 branch, although I've used the official LLVM git mirror as the remote.

LLVM 5.0.1 uses the 5.0 branch, and thus this PR also adds a few commits from 5.0.1. Once LLVM tags 5.0.1 in November, we will be free to update emscripten with the new commits.

Sterling-Augustine and others added 30 commits July 6, 2017 21:02
Summary:
Most clang tools should ignore the -M
family of options because one wouldn't want them
to generate a new dependency (.d) file. However,
some tools may want this dependency file. This
patch creates a mechanism for them to do this.

This implementation just plumbs a boolean down
several layers of calls. Each of the modified calls
has several call sites, and so a single member
variable or new API entry point won't work.

An alternative would be to write a function to filter
the -M family of arguments out of CC1Args, and have
each caller call that function by hand before calling
newInvocation, Invocation::run, or buildAstFromCodeWithArgs.
This is a more complicated and error-prone solution.
Why burden all the callers to remember to use
this function?

But I could rewrite this patch to use that method if
that is deemed more appropriate.

Reviewers: klimek

Reviewed By: klimek

Subscribers: klimek, cfe-commits

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

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

Summary:
The capture() function was removed in r306625. This should fix PGO breakages
reported by Michael Zolotukhin.

Reviewers: mzolotukhin

Subscribers: sanjoy, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307320 91177308-0d34-0410-b5e6-96231b3b80d8
Summary: Use an argument adjuster to preserve behavior inadvertantly changed by D34304.

Reviewers: klimek

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

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

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307341 91177308-0d34-0410-b5e6-96231b3b80d8
requirements in protocol/class/category declarations

The unguarded availability warnings in the protocol requirements of a protocol
/class/category declaration can be avoided. This matches the behaviour of
Swift's diagnostics. The warnings for deprecated/unavailable protocols are
preserved.

rdar://33156429

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307368 91177308-0d34-0410-b5e6-96231b3b80d8
The code in the test caused a crash with this backtrace:

 RecordLayoutBuilder.cpp:2934: const clang::ASTRecordLayout &clang::ASTContext::getASTRecordLayout(const clang::RecordDecl *) const: Assertion `!D->isInvalidDecl() && "Cannot get layout of invalid decl!"' failed.
 [...]
 emscripten-core#7 0x00007f63963d845a __assert_fail_base (/usr/lib/libc.so.6+0x2c45a)
 emscripten-core#8 0x00007f63963d84d2 (/usr/lib/libc.so.6+0x2c4d2)
 emscripten-core#9 0x00007f63937a0631 clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const /home/olivier/prog/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp:2935:3
 emscripten-core#10 0x00007f63937a1ad5 getFieldOffset(clang::ASTContext const&, clang::FieldDecl const*) /home/olivier/prog/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp:3057:37
 emscripten-core#11 0x00007f6391869f14 clang::Sema::RefersToMemberWithReducedAlignment(clang::Expr*, llvm::function_ref<void (clang::Expr*, clang::RecordDecl*, clang::FieldDecl*, clang::CharUnits)>) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaChecking.cpp:12139:23
 emscripten-core#12 0x00007f639186a2f8 clang::Sema::CheckAddressOfPackedMember(clang::Expr*) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaChecking.cpp:12190:1
 emscripten-core#13 0x00007f6391a7a81c clang::Sema::CheckAddressOfOperand(clang::ActionResult<clang::Expr*, true>&, clang::SourceLocation) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaExpr.cpp:11111:10
 emscripten-core#14 0x00007f6391a7f5d2 clang::Sema::CreateBuiltinUnaryOp(clang::SourceLocation, clang::UnaryOperatorKind, clang::Expr*) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaExpr.cpp:11932:18

Fixing by bailing out for invalid classes.

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

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

Clang should avoid calling report_fatal_error when the file with the serialised
diagnostics is empty. This commit changes Clang's serialised diagnostic reader,
now it reports an appropriate error instead of crashing.

rdar://31939877

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307384 91177308-0d34-0410-b5e6-96231b3b80d8
Check the `-mlong-calls` command line option and pass the `long-calls`
feature flag to the backend. Handling of this feature flag in the backend
needs to be implemented by a separate commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307386 91177308-0d34-0410-b5e6-96231b3b80d8
deployment target if the SDK is newer than the system

This commit reverts the revert commit r305891. Now the change from r305678
should be correct because `llvm::sys::getProcessTriple` now returns the correct
macOS version of the system after the LLVM change r307372.

Original commit message:

This commit improves the driver by making sure that it picks the system version
for the deployment target when the version of the macOS SDK is newer than the
system version.

rdar://29449467

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307388 91177308-0d34-0410-b5e6-96231b3b80d8
Summary:
Breaks after "readonly" trigger automatic semicolon insertion in field
declarations.

Reviewers: krasimir, djasper

Subscribers: klimek

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307394 91177308-0d34-0410-b5e6-96231b3b80d8
In addition to the formal linkage rules, the Modules TS includes cases where
internal-linkage symbols within a module interface unit can be referenced from
outside the module via exported inline functions / templates. We give such
declarations "module-internal linkage", which is formally internal linkage, but
results in an externally-visible symbol.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307434 91177308-0d34-0410-b5e6-96231b3b80d8
Summary: This patch should be enabled after https://reviews.llvm.org/D34895

Reviewers: chandlerc, tejohnson, davidxl

Reviewed By: tejohnson

Subscribers: sanjoy, mehdi_amini, inglorion, eraman, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307438 91177308-0d34-0410-b5e6-96231b3b80d8
Accidentally left this out of the original commit.


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

Summary: The patch makes the integration test cover major sample PGO components.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: sanjoy, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307445 91177308-0d34-0410-b5e6-96231b3b80d8
Summary:
r306137 made dllimport pointers to member functions non-constant. This
is correct because a load must be executed to resolve any dllimported
data. However, r306137 did not account for the use of dllimport member
function pointers used as template arguments.

This change re-lands r306137 with a template instantiation fix.

This fixes PR33570.

Reviewers: rnk, majnemer

Subscribers: cfe-commits

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

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

There are two other features before it that we don't currently support in the the frontend or backend so I left placeholders to keep the encoding correct.

I think the compiler-rt implementation of this feature is even further out of date.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307456 91177308-0d34-0410-b5e6-96231b3b80d8
Patch by: Reka Nikolett Kovacs


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307468 91177308-0d34-0410-b5e6-96231b3b80d8
Certain targets (e.g. amdgcn) require global variable to stay in global or constant address
space. In C or C++ global variables are emitted in the default (generic) address space.
This patch introduces virtual functions TargetCodeGenInfo::getGlobalVarAddressSpace
and TargetInfo::getConstantAddressSpace to handle this in a general approach.

It only affects IR generated for amdgcn target.

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307470 91177308-0d34-0410-b5e6-96231b3b80d8
Avoids warnings in Release builds.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307472 91177308-0d34-0410-b5e6-96231b3b80d8
Summary: Fixed a bug that -foo=bar wasn't handled properly on old version of bash.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307478 91177308-0d34-0410-b5e6-96231b3b80d8
Summary:
We don't want to autocomplete flags whose Flags class has `NoDriverOption` when argv[1] is not `-cc1`.

Another idea for this implementation is to make --autocomplete a cc1
option and handle it in clang Frontend, by porting --autocomplete
handler from Driver to Frontend, so that we can handle Driver options
and CC1 options in unified manner.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307479 91177308-0d34-0410-b5e6-96231b3b80d8
Summary: We probably want to use this useful templates in other pieces of code (e.g. the one from D34329), so we should make this public.

Reviewers: NoQ

Reviewed By: NoQ

Subscribers: cfe-commits, xazax.hun, v.g.vassilev, johannes

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307501 91177308-0d34-0410-b5e6-96231b3b80d8
…he maximum level support before accessing the leaf. Rename level to leaf everywhere.

This matches gcc behavior.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307506 91177308-0d34-0410-b5e6-96231b3b80d8
zmodem and others added 18 commits August 23, 2017 19:56
------------------------------------------------------------------------
r311330 | ibiryukov | 2017-08-21 05:03:08 -0700 (Mon, 21 Aug 2017) | 16 lines

Fixed a crash on replaying Preamble's PP conditional stack.

Summary:
The crash occurs when the first token after a preamble is a macro
expansion.
Fixed by moving replayPreambleConditionalStack from Parser into
Preprocessor. It is now called right after the predefines file is
processed.

Reviewers: erikjv, bkramer, klimek, yvvan

Reviewed By: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D36872
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@311591 91177308-0d34-0410-b5e6-96231b3b80d8
The header change caused problems; see PR34182, and PR33858 from emscripten-core#9 onwards, as
well as the discussion on the r309226 cfe-commits thread.

These changes don't seem to be addressing any regression from 4.0.0, so rather
than scrambling to fix this on the branch, let's revert to safety.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@311597 91177308-0d34-0410-b5e6-96231b3b80d8
Patch by Marek Kurdej!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@311668 91177308-0d34-0410-b5e6-96231b3b80d8
------------------------------------------------------------------------
r311601 | adrian | 2017-08-23 14:24:12 -0700 (Wed, 23 Aug 2017) | 5 lines

Fix a bug in CGDebugInfo::EmitInlineFunctionStart causing DILocations to be
parented in function declarations.

Fixes PR33997.
https://bugs.llvm.org/show_bug.cgi?id=33997
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@311671 91177308-0d34-0410-b5e6-96231b3b80d8
------------------------------------------------------------------------
r311695 | rsmith | 2017-08-24 13:10:33 -0700 (Thu, 24 Aug 2017) | 9 lines

[ubsan] PR34266: When sanitizing the 'this' value for a member function that happens to be a lambda call operator, use the lambda's 'this' pointer, not the captured enclosing 'this' pointer (if any).

Do not sanitize the 'this' pointer of a member call operator for a lambda with
no capture-default, since that call operator can legitimately be called with a
null this pointer from the static invoker function. Any actual call with a null
this pointer should still be caught in the caller (if it is being sanitized).

This reinstates r311589 (reverted in r311680) with the above fix.

------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@311799 91177308-0d34-0410-b5e6-96231b3b80d8
------------------------------------------------------------------------
r311792 | djasper | 2017-08-25 12:14:53 -0700 (Fri, 25 Aug 2017) | 9 lines

[Format] Invert nestingAndIndentLevel pair in WhitespaceManager used for
alignments

Indent should be compared before nesting level to determine if a token
is on the same scope as the one we align with. Because it was inverted,
clang-format sometimes tried to align tokens with tokens from outer
scopes, causing the assert(Shift >= 0) to fire.

This fixes bug #33507. Patch by Beren Minor, thank you!
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@311800 91177308-0d34-0410-b5e6-96231b3b80d8
------------------------------------------------------------------------
r311823 | rsmith | 2017-08-25 18:04:35 -0700 (Fri, 25 Aug 2017) | 16 lines

Add flag to request Clang is ABI-compatible with older versions of itself

This patch adds a flag -fclang-abi-compat that can be used to request that
Clang attempts to be ABI-compatible with some older version of itself.

This is provided on a best-effort basis; right now, this can be used to undo
the ABI change in r310401, reverting Clang to its prior C++ ABI for pass/return
by value of class types affected by that change, and to undo the ABI change in
r262688, reverting Clang to using integer registers rather than SSE registers
for passing <1 x long long> vectors. The intent is that we will maintain this
backwards compatibility path as we make ABI-breaking fixes in future.

The reversion to the old behavior for r310401 is also applied to the PS4 target
since that change is not part of its platform ABI (which is essentially to do
whatever Clang 3.2 did).

------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@312013 91177308-0d34-0410-b5e6-96231b3b80d8
------------------------------------------------------------------------
r312149 | hans | 2017-08-30 11:35:44 -0700 (Wed, 30 Aug 2017) | 1 line

docs: typo fix
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@312150 91177308-0d34-0410-b5e6-96231b3b80d8
------------------------------------------------------------------------
r314354 | dylanmckay | 2017-09-28 11:09:01 +1300 (Thu, 28 Sep 2017) | 3 lines

[AVR] Update data layout to match current LLVM trunk

The data layout was changed in r314179 to fix atomic loads and stores.
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@314381 91177308-0d34-0410-b5e6-96231b3b80d8
------------------------------------------------------------------------
r312622 | jbcoe | 2017-09-06 00:33:32 -0700 (Wed, 06 Sep 2017) | 13 lines

Fix __repr__ for Diagnostic in clang.cindex

Summary: Also move misplaced tests for exception specification to fix failing Python tests.

Reviewers: hans, compnerd

Reviewed By: compnerd

Subscribers: cfe-commits

Tags: #clang-c

Differential Revision: https://reviews.llvm.org/D37490
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@314434 91177308-0d34-0410-b5e6-96231b3b80d8
------------------------------------------------------------------------
r312651 | jroelofs | 2017-09-06 10:09:25 -0700 (Wed, 06 Sep 2017) | 23 lines

Fix ARM bare metal driver to support atomics

The new bare metal support only supports the single thread model. This causes
the builtin atomic functions (e.g.: __atomic_fetch_add) to not generate
thread-safe assembly for these operations, which breaks our firmware. We target
bare metal, and need to atomically modify variables in our interrupt routines,
and task threads.

Internally, the -mthread-model flag determines whether to lower or expand
atomic operations (see D4984).

This change removes the overridden thread model methods, and instead relies on
the base ToolChain class to validate the thread model (which already includes
logic to validate single thread model support). If the single thread model is
required, the -mthread-model flag will have to be provided.

As a workaround "-mthread-model posix" could be provided, but it only works due
to a bug in the validation of the -mthread-model flag (separate patch coming to
fix this).

https://reviews.llvm.org/D37493

Patch by: Ian Tessier!
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@314464 91177308-0d34-0410-b5e6-96231b3b80d8
@dylanmckay dylanmckay changed the title Update to LLVM 5.0 WIP: Update to LLVM 5.0 Sep 29, 2017
@dylanmckay dylanmckay changed the base branch from master to incoming September 29, 2017 12:30
@kripken
Copy link
Member

kripken commented Feb 21, 2018

We recently merged @juj's PRs for an LLVM update, which brought us somewhere into the 5.0svn time period. Is this PR still necessary after that?

@dylanmckay
Copy link
Contributor Author

I don't think so

@dylanmckay dylanmckay closed this Feb 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.