Skip to content

Commit 1d8ceba

Browse files
committed
LLVM and SPIRV-LLVM-Translator pulldown (WW45)
LLVM: llvm/llvm-project@cf78715
2 parents 53ea8b9 + 4281da1 commit 1d8ceba

File tree

2,382 files changed

+102149
-58109
lines changed

Some content is hidden

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

2,382 files changed

+102149
-58109
lines changed

.github/workflows/repo-lockdown.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ permissions:
99
jobs:
1010
action:
1111
runs-on: ubuntu-latest
12+
if: github.repository == 'llvm/llvm-project'
1213
steps:
1314
- uses: dessant/repo-lockdown@v2
1415
with:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static const std::string DefaultIgnoredParameterTypeSuffixes =
4040
"inputit",
4141
"InputIt",
4242
"forwardit",
43-
"FowardIt",
43+
"ForwardIt",
4444
"bidirit",
4545
"BidirIt",
4646
"constiterator",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ void ForwardDeclarationNamespaceCheck::onEndOfTranslationUnit() {
123123
if (CurDecl->hasDefinition() || CurDecl->isReferenced()) {
124124
continue; // Skip forward declarations that are used/referenced.
125125
}
126-
if (FriendTypes.count(CurDecl->getTypeForDecl()) != 0) {
126+
if (FriendTypes.contains(CurDecl->getTypeForDecl())) {
127127
continue; // Skip forward declarations referenced as friend.
128128
}
129129
if (CurDecl->getLocation().isMacroID() ||

clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ computeInsertions(const CXXConstructorDecl::init_const_range &Inits,
209209
// Add all fields between current field up until the next initializer.
210210
for (; Decl != std::end(OrderedDecls) && *Decl != InitDecl; ++Decl) {
211211
if (const auto *D = dyn_cast<T>(*Decl)) {
212-
if (DeclsToInit.count(D) > 0)
212+
if (DeclsToInit.contains(D))
213213
Insertions.back().Initializers.emplace_back(getName(D));
214214
}
215215
}
@@ -221,7 +221,7 @@ computeInsertions(const CXXConstructorDecl::init_const_range &Inits,
221221
// Add remaining decls that require initialization.
222222
for (; Decl != std::end(OrderedDecls); ++Decl) {
223223
if (const auto *D = dyn_cast<T>(*Decl)) {
224-
if (DeclsToInit.count(D) > 0)
224+
if (DeclsToInit.contains(D))
225225
Insertions.back().Initializers.emplace_back(getName(D));
226226
}
227227
}

clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ void UnusedUsingDeclsCheck::removeFromFoundDecls(const Decl *D) {
172172
//
173173
// FIXME: Use a more efficient way to find a matching context.
174174
for (auto &Context : Contexts) {
175-
if (Context.UsingTargetDecls.count(D->getCanonicalDecl()) > 0)
175+
if (Context.UsingTargetDecls.contains(D->getCanonicalDecl()))
176176
Context.IsUsed = true;
177177
}
178178
}

clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ AST_MATCHER_FUNCTION_P(StatementMatcher, isConstRefReturningMethodCall,
8484
// returned either points to a global static variable or to a member of the
8585
// called object.
8686
return cxxMemberCallExpr(
87-
callee(cxxMethodDecl(returns(matchers::isReferenceToConst()))
87+
callee(cxxMethodDecl(
88+
returns(hasCanonicalType(matchers::isReferenceToConst())))
8889
.bind(MethodDeclId)),
8990
on(declRefExpr(to(
9091
varDecl(
@@ -97,7 +98,8 @@ AST_MATCHER_FUNCTION(StatementMatcher, isConstRefReturningFunctionCall) {
9798
// Only allow initialization of a const reference from a free function if it
9899
// has no arguments. Otherwise it could return an alias to one of its
99100
// arguments and the arguments need to be checked for const use as well.
100-
return callExpr(callee(functionDecl(returns(matchers::isReferenceToConst()))
101+
return callExpr(callee(functionDecl(returns(hasCanonicalType(
102+
matchers::isReferenceToConst())))
101103
.bind(FunctionDeclId)),
102104
argumentCountIs(0), unless(callee(cxxMethodDecl())))
103105
.bind(InitFunctionCallId);

clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ void InconsistentDeclarationParameterNameCheck::check(
303303
const auto *OriginalDeclaration =
304304
Result.Nodes.getNodeAs<FunctionDecl>("functionDecl");
305305

306-
if (VisitedDeclarations.count(OriginalDeclaration) > 0)
306+
if (VisitedDeclarations.contains(OriginalDeclaration))
307307
return; // Avoid multiple warnings.
308308

309309
const FunctionDecl *ParameterSourceDeclaration =

clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "StaticAccessedThroughInstanceCheck.h"
1010
#include "clang/AST/ASTContext.h"
1111
#include "clang/ASTMatchers/ASTMatchFinder.h"
12+
#include "llvm/ADT/StringRef.h"
1213

1314
using namespace clang::ast_matchers;
1415

@@ -54,7 +55,7 @@ void StaticAccessedThroughInstanceCheck::check(
5455

5556
const Expr *BaseExpr = MemberExpression->getBase();
5657

57-
// Do not warn for overlaoded -> operators.
58+
// Do not warn for overloaded -> operators.
5859
if (isa<CXXOperatorCallExpr>(BaseExpr))
5960
return;
6061

@@ -70,6 +71,10 @@ void StaticAccessedThroughInstanceCheck::check(
7071
std::string BaseTypeName =
7172
BaseType.getAsString(PrintingPolicyWithSupressedTag);
7273

74+
// Do not warn for CUDA built-in variables.
75+
if (StringRef(BaseTypeName).startswith("__cuda_builtin_"))
76+
return;
77+
7378
SourceLocation MemberExprStartLoc = MemberExpression->getBeginLoc();
7479
auto Diag =
7580
diag(MemberExprStartLoc, "static member accessed through instance");

clang-tools-extra/clangd/Compiler.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ void IgnoreDiagnostics::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
4242
IgnoreDiagnostics::log(DiagLevel, Info);
4343
}
4444

45+
static bool AllowCrashPragmasForTest = false;
46+
void allowCrashPragmasForTest() { AllowCrashPragmasForTest = true; }
47+
4548
void disableUnsupportedOptions(CompilerInvocation &CI) {
4649
// Disable "clang -verify" diagnostics, they are rarely useful in clangd, and
4750
// our compiler invocation set-up doesn't seem to work with it (leading
@@ -66,7 +69,8 @@ void disableUnsupportedOptions(CompilerInvocation &CI) {
6669
CI.getPreprocessorOpts().PCHWithHdrStop = false;
6770
CI.getPreprocessorOpts().PCHWithHdrStopCreate = false;
6871
// Don't crash on `#pragma clang __debug parser_crash`
69-
CI.getPreprocessorOpts().DisablePragmaDebugCrash = true;
72+
if (!AllowCrashPragmasForTest)
73+
CI.getPreprocessorOpts().DisablePragmaDebugCrash = true;
7074

7175
// Always default to raw container format as clangd doesn't registry any other
7276
// and clang dies when faced with unknown formats.

clang-tools-extra/clangd/Compiler.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ std::unique_ptr<CompilerInstance> prepareCompilerInstance(
8787
std::unique_ptr<llvm::MemoryBuffer> MainFile,
8888
IntrusiveRefCntPtr<llvm::vfs::FileSystem>, DiagnosticConsumer &);
8989

90+
/// Respect `#pragma clang __debug crash` etc, which are usually disabled.
91+
/// This may only be called before threads are spawned.
92+
void allowCrashPragmasForTest();
93+
9094
} // namespace clangd
9195
} // namespace clang
9296

0 commit comments

Comments
 (0)