Skip to content

Commit b0c6218

Browse files
committed
Merge remote-tracking branch 'upstream/release/10.x' into ldc-release/10.x
2 parents 0bd0759 + ef32c61 commit b0c6218

File tree

317 files changed

+10603
-1757
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

317 files changed

+10603
-1757
lines changed

.github/workflows/clang-tests.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Clang Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- 'release/**'
7+
paths:
8+
- 'clang/**'
9+
- 'llvm/**'
10+
- '.github/workflows/clang-tests.yml'
11+
pull_request:
12+
paths:
13+
- 'clang/**'
14+
- 'llvm/**'
15+
16+
jobs:
17+
build_clang:
18+
name: clang check-all
19+
runs-on: ${{ matrix.os }}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
os:
24+
- ubuntu-latest
25+
- windows-latest
26+
- macOS-latest
27+
steps:
28+
- name: Setup Windows
29+
if: startsWith(matrix.os, 'windows')
30+
uses: llvm/actions/setup-windows@master
31+
with:
32+
arch: amd64
33+
- name: Install Ninja
34+
uses: llvm/actions/install-ninja@master
35+
- uses: actions/checkout@v1
36+
with:
37+
fetch-depth: 1
38+
- name: Test clang
39+
uses: llvm/actions/build-test-llvm-project@master
40+
with:
41+
cmake_args: -G Ninja -DLLVM_ENABLE_PROJECTS="clang" -DCMAKE_BUILD_TYPE=Release
42+
build_target: check-clang

.github/workflows/libclc-tests.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: libclc Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- 'release/**'
7+
paths:
8+
- 'clang/**'
9+
- 'llvm/**'
10+
- 'libclc/**'
11+
- '.github/workflows/libclc-tests.yml'
12+
pull_request:
13+
paths:
14+
- 'clang/**'
15+
- 'llvm/**'
16+
- 'libclc/**'
17+
- '.github/workflows/libclc-tests.yml'
18+
19+
jobs:
20+
build_libclc:
21+
name: libclc test
22+
runs-on: ${{ matrix.os }}
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
os:
27+
- ubuntu-latest
28+
# Disable build on windows, because I can't figure out where llvm-config is.
29+
#- windows-latest
30+
- macOS-latest
31+
steps:
32+
- name: Setup Windows
33+
if: startsWith(matrix.os, 'windows')
34+
uses: llvm/actions/setup-windows@master
35+
with:
36+
arch: amd64
37+
- name: Install Ninja
38+
uses: llvm/actions/install-ninja@master
39+
- uses: actions/checkout@v1
40+
with:
41+
fetch-depth: 1
42+
- name: Build clang
43+
uses: llvm/actions/build-test-llvm-project@master
44+
with:
45+
cmake_args: -G Ninja -DLLVM_ENABLE_PROJECTS="clang" -DCMAKE_BUILD_TYPE=Release
46+
build_target: ""
47+
- name: Build and test libclc
48+
run: |
49+
mkdir libclc-build
50+
cd libclc-build
51+
cmake -G Ninja ../libclc -DLLVM_CONFIG=../build/bin/llvm-config
52+
ninja
53+
ninja test

.github/workflows/lld-tests.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: LLD Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- 'release/**'
7+
paths:
8+
- 'lld/**'
9+
- 'llvm/**'
10+
- '.github/workflows/lld-tests.yml'
11+
pull_request:
12+
paths:
13+
- 'lld/**'
14+
- 'llvm/**'
15+
16+
jobs:
17+
build_lld:
18+
name: lld check-all
19+
runs-on: ${{ matrix.os }}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
os:
24+
- ubuntu-latest
25+
- windows-latest
26+
- macOS-latest
27+
steps:
28+
- name: Setup Windows
29+
if: startsWith(matrix.os, 'windows')
30+
uses: llvm/actions/setup-windows@master
31+
with:
32+
arch: amd64
33+
- name: Install Ninja
34+
uses: llvm/actions/install-ninja@master
35+
- uses: actions/checkout@v1
36+
with:
37+
fetch-depth: 1
38+
- name: Test lld
39+
uses: llvm/actions/build-test-llvm-project@master
40+
with:
41+
cmake_args: -G Ninja -DLLVM_ENABLE_PROJECTS="lld" -DCMAKE_BUILD_TYPE=Release
42+
build_target: check-lld

.github/workflows/lldb-tests.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: lldb Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- 'release/**'
7+
paths:
8+
- 'clang/**'
9+
- 'llvm/**'
10+
- 'lldb/**'
11+
- '.github/workflows/lldb-tests.yml'
12+
pull_request:
13+
paths:
14+
- 'clang/**'
15+
- 'llvm/**'
16+
- 'lldb/**'
17+
- '.github/workflows/lldb-tests.yml'
18+
19+
jobs:
20+
build_lldb:
21+
name: lldb build
22+
runs-on: ${{ matrix.os }}
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
os:
27+
- ubuntu-latest
28+
- windows-latest
29+
- macOS-latest
30+
steps:
31+
- name: Setup Windows
32+
if: startsWith(matrix.os, 'windows')
33+
uses: llvm/actions/setup-windows@master
34+
with:
35+
arch: amd64
36+
- name: Install Ninja
37+
uses: llvm/actions/install-ninja@master
38+
- uses: actions/checkout@v1
39+
with:
40+
fetch-depth: 1
41+
- name: Build lldb
42+
uses: llvm/actions/build-test-llvm-project@master
43+
with:
44+
# Mac OS requries that libcxx is enabled for lldb tests, so we need to disable them.
45+
cmake_args: -G Ninja -DLLVM_ENABLE_PROJECTS="clang;lldb" -DCMAKE_BUILD_TYPE=Release -DLLDB_INCLUDE_TESTS=OFF
46+
# check-lldb is not consistent, so we only build lldb.
47+
build_target: ""

.github/workflows/llvm-tests.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: LLVM Tests
2+
3+
env:
4+
release_major: 10
5+
6+
on:
7+
push:
8+
branches:
9+
- 'release/**'
10+
paths:
11+
- 'llvm/**'
12+
- '.github/workflows/llvm-tests.yml'
13+
pull_request:
14+
paths:
15+
- 'llvm/**'
16+
- '.github/workflows/llvm-tests.yml'
17+
18+
jobs:
19+
build_llvm:
20+
name: llvm check-all
21+
runs-on: ${{ matrix.os }}
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
os:
26+
- ubuntu-latest
27+
- windows-latest
28+
- macOS-latest
29+
steps:
30+
- name: Setup Windows
31+
if: startsWith(matrix.os, 'windows')
32+
uses: llvm/actions/setup-windows@master
33+
with:
34+
arch: amd64
35+
- name: Install Ninja
36+
uses: llvm/actions/install-ninja@master
37+
- uses: actions/checkout@v1
38+
with:
39+
fetch-depth: 1
40+
- name: Test llvm
41+
uses: llvm/actions/build-test-llvm-project@master
42+
with:
43+
cmake_args: -G Ninja -DCMAKE_BUILD_TYPE=Release
44+
45+
abi-dump:
46+
runs-on: ubuntu-latest
47+
strategy:
48+
matrix:
49+
name:
50+
- build-baseline
51+
- build-latest
52+
include:
53+
- name: build-baseline
54+
# FIXME: Referencing the env context does not work here
55+
# ref: llvmorg-${{ env.release_major }}.0.0
56+
ref: llvmorg-10.0.0
57+
repo: llvm/llvm-project
58+
- name: build-latest
59+
ref: ${{ github.sha }}
60+
repo: ${{ github.repository }}
61+
steps:
62+
- name: Install Ninja
63+
uses: llvm/actions/install-ninja@master
64+
- name: Install abi-compliance-checker
65+
run: |
66+
sudo apt-get install abi-dumper autoconf pkg-config
67+
- name: Install universal-ctags
68+
run: |
69+
git clone https://github.com/universal-ctags/ctags.git
70+
cd ctags
71+
./autogen.sh
72+
./configure
73+
sudo make install
74+
- name: Download source code
75+
uses: llvm/actions/get-llvm-project-src@master
76+
with:
77+
ref: ${{ matrix.ref }}
78+
repo: ${{ matrix.repo }}
79+
- name: Configure
80+
run: |
81+
mkdir build
82+
cd build
83+
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD="" -DLLVM_BUILD_LLVM_DYLIB=ON -DCMAKE_C_FLAGS_DEBUG="-g -Og" -DCMAKE_CXX_FLAGS_DEBUG="-g -Og" ../llvm
84+
- name: Build
85+
run: ninja -C build libLLVM-${{ env.release_major }}.so
86+
- name: Dump ABI
87+
run: abi-dumper -lver ${{ matrix.ref }} -skip-cxx -public-headers llvm/include -o ${{ matrix.ref }}.abi.tar.gz build/lib/libLLVM-${{ env.release_major }}.so
88+
- name: Upload ABI file
89+
uses: actions/upload-artifact@v1
90+
with:
91+
name: ${{ matrix.name }}
92+
path: ${{ matrix.ref }}.abi.tar.gz
93+
94+
abi-compare:
95+
runs-on: ubuntu-latest
96+
needs:
97+
- abi-dump
98+
steps:
99+
- name: Download baseline
100+
uses: actions/download-artifact@v1
101+
with:
102+
name: build-baseline
103+
- name: Download latest
104+
uses: actions/download-artifact@v1
105+
with:
106+
name: build-latest
107+
- name: Install abi-compliance-checker
108+
run: sudo apt-get install abi-compliance-checker
109+
- name: Compare ABI
110+
run: abi-compliance-checker -l libLLVM-${{ env.release_major}}.so -old build-baseline/*.tar.gz -new build-latest/*.tar.gz
111+
- name: Upload ABI Comparison
112+
if: always()
113+
uses: actions/upload-artifact@v1
114+
with:
115+
name: compat-report-${{ github.sha }}
116+
path: compat_reports/

clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -522,13 +522,11 @@ void LoopConvertCheck::doConversion(
522522
const ValueDecl *MaybeContainer, const UsageResult &Usages,
523523
const DeclStmt *AliasDecl, bool AliasUseRequired, bool AliasFromForInit,
524524
const ForStmt *Loop, RangeDescriptor Descriptor) {
525-
auto Diag = diag(Loop->getForLoc(), "use range-based for loop instead");
526-
527525
std::string VarName;
528526
bool VarNameFromAlias = (Usages.size() == 1) && AliasDecl;
529527
bool AliasVarIsRef = false;
530528
bool CanCopy = true;
531-
529+
std::vector<FixItHint> FixIts;
532530
if (VarNameFromAlias) {
533531
const auto *AliasVar = cast<VarDecl>(AliasDecl->getSingleDecl());
534532
VarName = AliasVar->getName().str();
@@ -560,8 +558,8 @@ void LoopConvertCheck::doConversion(
560558
getAliasRange(Context->getSourceManager(), ReplaceRange);
561559
}
562560

563-
Diag << FixItHint::CreateReplacement(
564-
CharSourceRange::getTokenRange(ReplaceRange), ReplacementText);
561+
FixIts.push_back(FixItHint::CreateReplacement(
562+
CharSourceRange::getTokenRange(ReplaceRange), ReplacementText));
565563
// No further replacements are made to the loop, since the iterator or index
566564
// was used exactly once - in the initialization of AliasVar.
567565
} else {
@@ -606,8 +604,8 @@ void LoopConvertCheck::doConversion(
606604
Usage.Kind == Usage::UK_CaptureByCopy ? "&" + VarName : VarName;
607605
}
608606
TUInfo->getReplacedVars().insert(std::make_pair(Loop, IndexVar));
609-
Diag << FixItHint::CreateReplacement(
610-
CharSourceRange::getTokenRange(Range), ReplaceText);
607+
FixIts.push_back(FixItHint::CreateReplacement(
608+
CharSourceRange::getTokenRange(Range), ReplaceText));
611609
}
612610
}
613611

@@ -645,8 +643,9 @@ void LoopConvertCheck::doConversion(
645643
std::string Range = ("(" + TypeString + " " + VarName + " : " +
646644
MaybeDereference + Descriptor.ContainerString + ")")
647645
.str();
648-
Diag << FixItHint::CreateReplacement(
649-
CharSourceRange::getTokenRange(ParenRange), Range);
646+
FixIts.push_back(FixItHint::CreateReplacement(
647+
CharSourceRange::getTokenRange(ParenRange), Range));
648+
diag(Loop->getForLoc(), "use range-based for loop instead") << FixIts;
650649
TUInfo->getGeneratedDecls().insert(make_pair(Loop, VarName));
651650
}
652651

clang-tools-extra/clangd/AST.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,5 +473,12 @@ std::string getQualification(ASTContext &Context,
473473
});
474474
}
475475

476+
bool hasUnstableLinkage(const Decl *D) {
477+
// Linkage of a ValueDecl depends on the type.
478+
// If that's not deduced yet, deducing it may change the linkage.
479+
auto *VD = llvm::dyn_cast_or_null<ValueDecl>(D);
480+
return VD && !VD->getType().isNull() && VD->getType()->isUndeducedType();
481+
}
482+
476483
} // namespace clangd
477484
} // namespace clang

clang-tools-extra/clangd/AST.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,21 @@ std::string getQualification(ASTContext &Context,
148148
const NamedDecl *ND,
149149
llvm::ArrayRef<std::string> VisibleNamespaces);
150150

151+
/// Whether we must avoid computing linkage for D during code completion.
152+
/// Clang aggressively caches linkage computation, which is stable after the AST
153+
/// is built. Unfortunately the AST is incomplete during code completion, so
154+
/// linkage may still change.
155+
///
156+
/// Example: `auto x = []{^}` at file scope.
157+
/// During code completion, the initializer for x hasn't been parsed yet.
158+
/// x has type `undeduced auto`, and external linkage.
159+
/// If we compute linkage at this point, the external linkage will be cached.
160+
///
161+
/// After code completion the initializer is attached, and x has a lambda type.
162+
/// This means x has "unique external" linkage. If we computed linkage above,
163+
/// the cached value is incorrect. (clang catches this with an assertion).
164+
bool hasUnstableLinkage(const Decl *D);
165+
151166
} // namespace clangd
152167
} // namespace clang
153168

0 commit comments

Comments
 (0)