Skip to content

Commit 582a07e

Browse files
committed
Rebase, address comments
Created using spr 1.3.5
2 parents 22583d0 + f5ee105 commit 582a07e

File tree

601 files changed

+15731
-6119
lines changed

Some content is hidden

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

601 files changed

+15731
-6119
lines changed

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
stage1:
3838
if: github.repository_owner == 'llvm'
3939
runs-on: libcxx-self-hosted-linux
40-
container: ghcr.io/llvm/libcxx-linux-builder:b319dfef21f6c7b0bc6a356d6b9f41a3b3b98ae9
40+
container: ghcr.io/llvm/libcxx-linux-builder:b6bb9dc5abd7c6452c13a53fa8949cb259db459b
4141
continue-on-error: false
4242
strategy:
4343
fail-fast: false
@@ -75,7 +75,7 @@ jobs:
7575
stage2:
7676
if: github.repository_owner == 'llvm'
7777
runs-on: libcxx-self-hosted-linux
78-
container: ghcr.io/llvm/libcxx-linux-builder:b319dfef21f6c7b0bc6a356d6b9f41a3b3b98ae9
78+
container: ghcr.io/llvm/libcxx-linux-builder:b6bb9dc5abd7c6452c13a53fa8949cb259db459b
7979
needs: [ stage1 ]
8080
continue-on-error: false
8181
strategy:
@@ -167,7 +167,7 @@ jobs:
167167
- config: 'generic-msan'
168168
machine: libcxx-self-hosted-linux
169169
runs-on: ${{ matrix.machine }}
170-
container: ghcr.io/llvm/libcxx-linux-builder:b319dfef21f6c7b0bc6a356d6b9f41a3b3b98ae9
170+
container: ghcr.io/llvm/libcxx-linux-builder:b6bb9dc5abd7c6452c13a53fa8949cb259db459b
171171
steps:
172172
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
173173
- name: ${{ matrix.config }}

clang-tools-extra/clang-tidy/altera/SingleWorkItemBarrierCheck.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,12 @@ void SingleWorkItemBarrierCheck::check(const MatchFinder::MatchResult &Result) {
5454
bool IsNDRange = false;
5555
if (MatchedDecl->hasAttr<ReqdWorkGroupSizeAttr>()) {
5656
const auto *Attribute = MatchedDecl->getAttr<ReqdWorkGroupSizeAttr>();
57-
if (Attribute->getXDim() > 1 || Attribute->getYDim() > 1 ||
58-
Attribute->getZDim() > 1)
57+
auto Eval = [&](Expr *E) {
58+
return E->EvaluateKnownConstInt(MatchedDecl->getASTContext())
59+
.getExtValue();
60+
};
61+
if (Eval(Attribute->getXDim()) > 1 || Eval(Attribute->getYDim()) > 1 ||
62+
Eval(Attribute->getZDim()) > 1)
5963
IsNDRange = true;
6064
}
6165
if (IsNDRange) // No warning if kernel is treated as an NDRange.

clang-tools-extra/clang-tidy/bugprone/ComparePointerToMemberVirtualFunctionCheck.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,7 @@ void ComparePointerToMemberVirtualFunctionCheck::check(
7070
// compare with variable which type is pointer to member function.
7171
llvm::SmallVector<SourceLocation, 12U> SameSignatureVirtualMethods{};
7272
const auto *MPT = cast<MemberPointerType>(DRE->getType().getCanonicalType());
73-
const Type *T = MPT->getClass();
74-
if (T == nullptr)
75-
return;
76-
const CXXRecordDecl *RD = T->getAsCXXRecordDecl();
73+
const CXXRecordDecl *RD = MPT->getMostRecentCXXRecordDecl();
7774
if (RD == nullptr)
7875
return;
7976

clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ bool isQualificationConvertiblePointer(QualType From, QualType To,
219219

220220
if (P1->isMemberPointerType())
221221
return P2->isMemberPointerType() &&
222-
P1->getAs<MemberPointerType>()->getClass() ==
223-
P2->getAs<MemberPointerType>()->getClass();
222+
P1->getAs<MemberPointerType>()->getMostRecentCXXRecordDecl() ==
223+
P2->getAs<MemberPointerType>()->getMostRecentCXXRecordDecl();
224224

225225
if (P1->isConstantArrayType())
226226
return P2->isConstantArrayType() &&

clang-tools-extra/clangd/ClangdServer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,8 @@ void ClangdServer::codeComplete(PathRef File, Position Pos,
455455
CodeCompleteOpts.MainFileSignals = IP->Signals;
456456
CodeCompleteOpts.AllScopes = Config::current().Completion.AllScopes;
457457
CodeCompleteOpts.ArgumentLists = Config::current().Completion.ArgumentLists;
458+
CodeCompleteOpts.InsertIncludes =
459+
Config::current().Completion.HeaderInsertion;
458460
// FIXME(ibiryukov): even if Preamble is non-null, we may want to check
459461
// both the old and the new version in case only one of them matches.
460462
CodeCompleteResult Result = clangd::codeComplete(

clang-tools-extra/clangd/CodeComplete.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ struct CompletionCandidate {
294294
std::optional<llvm::StringRef>
295295
headerToInsertIfAllowed(const CodeCompleteOptions &Opts,
296296
CodeCompletionContext::Kind ContextKind) const {
297-
if (Opts.InsertIncludes == CodeCompleteOptions::NeverInsert ||
297+
if (Opts.InsertIncludes == Config::HeaderInsertionPolicy::NeverInsert ||
298298
RankedIncludeHeaders.empty() ||
299299
!contextAllowsHeaderInsertion(ContextKind))
300300
return std::nullopt;

clang-tools-extra/clangd/CodeComplete.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,8 @@ struct CodeCompleteOptions {
7171
/// Whether to present doc comments as plain-text or markdown.
7272
MarkupKind DocumentationFormat = MarkupKind::PlainText;
7373

74-
enum IncludeInsertion {
75-
IWYU,
76-
NeverInsert,
77-
} InsertIncludes = IncludeInsertion::IWYU;
74+
Config::HeaderInsertionPolicy InsertIncludes =
75+
Config::HeaderInsertionPolicy::IWYU;
7876

7977
/// Whether include insertions for Objective-C code should use #import instead
8078
/// of #include.

clang-tools-extra/clangd/Config.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,20 @@ struct Config {
147147
FullPlaceholders,
148148
};
149149

150+
enum class HeaderInsertionPolicy {
151+
IWYU, // Include what you use
152+
NeverInsert // Never insert headers as part of code completion
153+
};
154+
150155
/// Configures code completion feature.
151156
struct {
152157
/// Whether code completion includes results that are not visible in current
153158
/// scopes.
154159
bool AllScopes = true;
155160
/// controls the completion options for argument lists.
156161
ArgumentListsPolicy ArgumentLists = ArgumentListsPolicy::FullPlaceholders;
162+
/// Controls if headers should be inserted when completions are accepted
163+
HeaderInsertionPolicy HeaderInsertion = HeaderInsertionPolicy::IWYU;
157164
} Completion;
158165

159166
/// Configures hover feature.

clang-tools-extra/clangd/ConfigCompile.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,17 @@ struct FragmentCompiler {
697697
C.Completion.ArgumentLists = *Val;
698698
});
699699
}
700+
if (F.HeaderInsertion) {
701+
if (auto Val =
702+
compileEnum<Config::HeaderInsertionPolicy>("HeaderInsertion",
703+
*F.HeaderInsertion)
704+
.map("IWYU", Config::HeaderInsertionPolicy::IWYU)
705+
.map("Never", Config::HeaderInsertionPolicy::NeverInsert)
706+
.value())
707+
Out.Apply.push_back([Val](const Params &, Config &C) {
708+
C.Completion.HeaderInsertion = *Val;
709+
});
710+
}
700711
}
701712

702713
void compile(Fragment::HoverBlock &&F) {

clang-tools-extra/clangd/ConfigFragment.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,14 @@ struct Fragment {
341341
/// Delimiters: empty pair of delimiters "()" or "<>"
342342
/// FullPlaceholders: full name of both type and parameter
343343
std::optional<Located<std::string>> ArgumentLists;
344+
/// Add #include directives when accepting code completions. Config
345+
/// equivalent of the CLI option '--header-insertion'
346+
/// Valid values are enum Config::HeaderInsertionPolicy values:
347+
/// "IWYU": Include what you use. Insert the owning header for top-level
348+
/// symbols, unless the header is already directly included or the
349+
/// symbol is forward-declared
350+
/// "NeverInsert": Never insert headers
351+
std::optional<Located<std::string>> HeaderInsertion;
344352
};
345353
CompletionBlock Completion;
346354

0 commit comments

Comments
 (0)