Skip to content

Commit 3e4624f

Browse files
committed
Merge from 'main' to 'sycl-web' (150 commits)
CONFLICT (content): Merge conflict in clang/lib/CodeGen/CGCall.cpp
2 parents d9b53d7 + a35c64c commit 3e4624f

File tree

507 files changed

+14758
-7068
lines changed

Some content is hidden

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

507 files changed

+14758
-7068
lines changed

.github/workflows/issue-release-workflow.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ jobs:
7272
steps:
7373
- name: Fetch LLVM sources
7474
uses: actions/checkout@v2
75+
with:
76+
persist-credentials: false
7577

7678
- name: Setup Environment
7779
run: |

.github/workflows/llvm-project-tests.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ jobs:
3939
- windows-2019
4040
# We're using a specific version of macOS due to:
4141
# https://github.com/actions/virtual-environments/issues/5900
42-
# We need addtional testing to see if our workaround works for
43-
# new macOS builds.
44-
- macOS-10.15
42+
- macOS-11
4543
steps:
4644
- name: Setup Windows
4745
if: startsWith(matrix.os, 'windows')
@@ -74,7 +72,7 @@ jobs:
7472
env:
7573
# Workaround for https://github.com/actions/virtual-environments/issues/5900.
7674
# This should be a no-op for non-mac OSes
77-
PKG_CONFIG_PATH: /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig//11
75+
PKG_CONFIG_PATH: /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig//12
7876
with:
7977
cmake_args: '-GNinja -DLLVM_ENABLE_PROJECTS="${{ inputs.projects }}" -DCMAKE_BUILD_TYPE=Release -DLLDB_INCLUDE_TESTS=OFF -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache'
8078
build_target: '${{ inputs.build_target }}'

.github/workflows/version-check.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,21 @@
1010

1111
tag = repo.git.describe(tags = True, abbrev=0)
1212
m = re.match('llvmorg-([0-9]+)\.([0-9]+)\.([0-9]+)', tag)
13-
if not m:
14-
print("error: Tag is not valid: ", tag)
15-
sys.exit(1)
1613

17-
expected_major = m.group(1)
18-
expected_minor = m.group(2)
19-
expected_patch = int(m.group(3)) + 1
14+
if m:
15+
expected_major = m.group(1)
16+
expected_minor = m.group(2)
17+
expected_patch = int(m.group(3)) + 1
18+
else:
19+
# If the previous tag is llvmorg-X-init, then we should be at version X.0.0.
20+
m = re.match('llvmorg-([0-9]+)-init', tag)
21+
if not m:
22+
print("error: Tag is not valid: ", tag)
23+
sys.exit(1)
24+
expected_major = m.group(1)
25+
expected_minor = 0
26+
expected_patch = 0
27+
2028
expected_version = f"{expected_major}.{expected_minor}.{expected_patch}"
2129

2230
m = re.match("[0-9]+\.[0-9]+\.[0-9]+", version)

clang-tools-extra/clang-tidy/misc/CMakeLists.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@ set(LLVM_LINK_COMPONENTS
33
Support
44
)
55

6-
if(LLVM_USE_HOST_TOOLS)
7-
build_native_tool(make-confusable-table make_confusable_table)
6+
set(CLANG_TIDY_CONFUSABLE_CHARS_GEN "clang-tidy-confusable-chars-gen" CACHE
7+
STRING "Host clang-tidy-confusable-chars-gen executable. Saves building if cross-compiling.")
8+
9+
if(NOT CLANG_TIDY_CONFUSABLE_CHARS_GEN STREQUAL "clang-tidy-confusable-chars-gen")
10+
set(make_confusable_table ${CLANG_TIDY_CONFUSABLE_CHARS_GEN})
11+
set(make_confusable_table_target ${CLANG_TIDY_CONFUSABLE_CHARS_GEN})
12+
elseif(LLVM_USE_HOST_TOOLS)
13+
build_native_tool(clang-tidy-confusable-chars-gen make_confusable_table)
814
set(make_confusable_table_target "${make_confusable_table}")
915
else()
10-
set(make_confusable_table $<TARGET_FILE:make-confusable-table>)
11-
set(make_confusable_table_target make-confusable-table)
16+
set(make_confusable_table $<TARGET_FILE:clang-tidy-confusable-chars-gen>)
17+
set(make_confusable_table_target clang-tidy-confusable-chars-gen)
1218
endif()
1319

1420
add_subdirectory(ConfusableTable)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
set(LLVM_LINK_COMPONENTS Support)
22
list(REMOVE_ITEM LLVM_COMMON_DEPENDS clang-tablegen-targets)
33

4-
add_llvm_executable(make-confusable-table
4+
add_llvm_executable(clang-tidy-confusable-chars-gen
55
BuildConfusableTable.cpp
66
)

clang-tools-extra/clangd/ClangdServer.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -834,14 +834,17 @@ void ClangdServer::documentSymbols(llvm::StringRef File,
834834

835835
void ClangdServer::foldingRanges(llvm::StringRef File,
836836
Callback<std::vector<FoldingRange>> CB) {
837-
auto Action =
838-
[CB = std::move(CB)](llvm::Expected<InputsAndAST> InpAST) mutable {
839-
if (!InpAST)
840-
return CB(InpAST.takeError());
841-
CB(clangd::getFoldingRanges(InpAST->AST));
842-
};
843-
WorkScheduler->runWithAST("FoldingRanges", File, std::move(Action),
844-
Transient);
837+
auto Code = getDraft(File);
838+
if (!Code)
839+
return CB(llvm::make_error<LSPError>(
840+
"trying to compute folding ranges for non-added document",
841+
ErrorCode::InvalidParams));
842+
auto Action = [CB = std::move(CB), Code = std::move(*Code)]() mutable {
843+
CB(clangd::getFoldingRanges(Code));
844+
};
845+
// We want to make sure folding ranges are always available for all the open
846+
// files, hence prefer runQuick to not wait for operations on other files.
847+
WorkScheduler->runQuick("FoldingRanges", File, std::move(Action));
845848
}
846849

847850
void ClangdServer::findType(llvm::StringRef File, Position Pos,

clang-tools-extra/pseudo/include/clang-pseudo/Token.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ struct Token {
9090
while (T->Kind == tok::comment);
9191
return *T;
9292
}
93+
/// Returns the previous token in the stream. this may not be a sentinel.
94+
const Token &prev() const {
95+
assert(Kind != tok::eof);
96+
return *(this - 1);
97+
}
9398
/// Returns the bracket paired with this one, if any.
9499
const Token *pair() const { return Pair == 0 ? nullptr : this + Pair; }
95100

clang-tools-extra/pseudo/lib/cxx/CXX.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,14 @@ llvm::DenseMap<ExtensionID, RuleGuard> buildGuards() {
312312
IF__CONSTEXPR__L_PAREN__init_statement__condition__R_PAREN__statement,
313313
guardNextTokenNotElse},
314314

315+
// Implement C++ [basic.lookup.qual.general]:
316+
// If a name, template-id, or decltype-specifier is followed by a
317+
// ​::​, it shall designate a namespace, class, enumeration, or
318+
// dependent type, and the ​::​ is never interpreted as a complete
319+
// nested-name-specifier.
320+
{rule::nested_name_specifier::COLONCOLON,
321+
TOKEN_GUARD(coloncolon, Tok.prev().Kind != tok::identifier)},
322+
315323
// The grammar distinguishes (only) user-defined vs plain string literals,
316324
// where the clang lexer distinguishes (only) encoding types.
317325
{rule::user_defined_string_literal_chunk::STRING_LITERAL,

clang-tools-extra/pseudo/lib/cxx/cxx.bnf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ unqualified-id := ~ type-name
6868
unqualified-id := ~ decltype-specifier
6969
unqualified-id := template-id
7070
qualified-id := nested-name-specifier TEMPLATE_opt unqualified-id
71-
nested-name-specifier := ::
71+
nested-name-specifier := :: [guard]
7272
nested-name-specifier := type-name ::
7373
nested-name-specifier := namespace-name ::
7474
nested-name-specifier := decltype-specifier ::
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// RUN: clang-pseudo -grammar=cxx -source=%s --print-forest | FileCheck %s
2+
3+
// Verify that we don't form a complete `::` nested-name-specifier if there is
4+
// an identifier preceding it.
5+
Foo::Foo() {} // No "Foo ::Foo()" false parse
6+
// CHECK: ├─declaration-seq~function-definition := function-declarator function-body
7+
// CHECK-NEXT: │ ├─function-declarator~noptr-declarator := noptr-declarator parameters-and-qualifiers
8+
9+
int ::x;
10+
// CHECK: declaration~simple-declaration := decl-specifier-seq init-declarator-list ;
11+
// CHECK-NEXT: ├─decl-specifier-seq~INT
12+
13+
void test() {
14+
X::Y::Z; // No false qualified-declarator parses "X ::Y::Z" and "X::Y ::Z".
15+
// CHECK: statement-seq~statement := <ambiguous>
16+
// CHECK: statement~expression-statement := expression ;
17+
// CHECK: statement~simple-declaration := decl-specifier-seq ;
18+
// CHECK-NOT: simple-declaration := decl-specifier-seq init-declarator-list ;
19+
20+
// FIXME: eliminate the false `a<b> ::c` declaration parse.
21+
a<b>::c;
22+
// CHECK: statement := <ambiguous>
23+
// CHECK-NEXT: ├─statement~expression-statement := expression ;
24+
// CHECK-NEXT: │ ├─expression~relational-expression :=
25+
// CHECK: └─statement~simple-declaration := <ambiguous>
26+
// CHECK-NEXT: ├─simple-declaration := decl-specifier-seq ;
27+
// CHECK: └─simple-declaration := decl-specifier-seq init-declarator-list ;
28+
}

0 commit comments

Comments
 (0)