Skip to content

Commit b4cb0e9

Browse files
authored
LLVM and SPIRV-LLVM-Translator pulldown (WW43) #2673
LLVM: llvm/llvm-project@4de215f SPIRV-LLVM-Translator: KhronosGroup/SPIRV-LLVM-Translator@bd4c88a
2 parents 6a19720 + 0b89cc3 commit b4cb0e9

File tree

3,756 files changed

+380809
-325532
lines changed

Some content is hidden

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

3,756 files changed

+380809
-325532
lines changed

clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,10 +324,6 @@ bool conflictInNamespace(const ASTContext &AST, llvm::StringRef QualifiedSymbol,
324324
return false;
325325
}
326326

327-
AST_MATCHER(EnumDecl, isScoped) {
328-
return Node.isScoped();
329-
}
330-
331327
bool isTemplateParameter(TypeLoc Type) {
332328
while (!Type.isNull()) {
333329
if (Type.getTypeLocClass() == TypeLoc::SubstTemplateTypeParm)

clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -305,22 +305,8 @@ static bool IsNOLINTFound(StringRef NolintDirectiveText, StringRef Line,
305305

306306
static llvm::Optional<StringRef> getBuffer(const SourceManager &SM, FileID File,
307307
bool AllowIO) {
308-
// This is similar to the implementation of SourceManager::getBufferData(),
309-
// but uses ContentCache::getRawBuffer() rather than getBuffer() if
310-
// AllowIO=false, to avoid triggering file I/O if the file contents aren't
311-
// already mapped.
312-
bool CharDataInvalid = false;
313-
const SrcMgr::SLocEntry &Entry = SM.getSLocEntry(File, &CharDataInvalid);
314-
if (CharDataInvalid || !Entry.isFile())
315-
return llvm::None;
316-
const SrcMgr::ContentCache *Cache = Entry.getFile().getContentCache();
317-
const llvm::MemoryBuffer *Buffer =
318-
AllowIO ? Cache->getBuffer(SM.getDiagnostics(), SM.getFileManager(),
319-
SourceLocation(), &CharDataInvalid)
320-
: Cache->getRawBuffer();
321-
if (!Buffer || CharDataInvalid)
322-
return llvm::None;
323-
return Buffer->getBuffer();
308+
return AllowIO ? SM.getBufferDataOrNone(File)
309+
: SM.getBufferDataIfLoaded(File);
324310
}
325311

326312
static bool LineIsMarkedWithNOLINT(const SourceManager &SM, SourceLocation Loc,

clang-tools-extra/clang-tidy/ClangTidyOptions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ template <> struct MappingTraits<FileFilter> {
4747
IO.mapRequired("name", File.Name);
4848
IO.mapOptional("lines", File.LineRanges);
4949
}
50-
static StringRef validate(IO &io, FileFilter &File) {
50+
static std::string validate(IO &io, FileFilter &File) {
5151
if (File.Name.empty())
5252
return "No file name specified";
5353
for (const FileFilter::LineRange &Range : File.LineRanges) {
5454
if (Range.first <= 0 || Range.second <= 0)
5555
return "Invalid line range";
5656
}
57-
return StringRef();
57+
return "";
5858
}
5959
};
6060

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ AST_MATCHER(clang::VarDecl, hasConstantDeclaration) {
2121
if (Init && !Init->isValueDependent()) {
2222
if (Node.isConstexpr())
2323
return true;
24-
return Node.checkInitIsICE();
24+
return Node.evaluateValue();
2525
}
2626
return false;
2727
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ void SuspiciousSemicolonCheck::check(const MatchFinder::MatchResult &Result) {
5454

5555
SourceLocation LocEnd = Semicolon->getEndLoc();
5656
FileID FID = SM.getFileID(LocEnd);
57-
const llvm::MemoryBuffer *Buffer = SM.getBuffer(FID, LocEnd);
57+
llvm::MemoryBufferRef Buffer = SM.getBufferOrFake(FID, LocEnd);
5858
Lexer Lexer(SM.getLocForStartOfFile(FID), Ctxt.getLangOpts(),
59-
Buffer->getBufferStart(), SM.getCharacterData(LocEnd) + 1,
60-
Buffer->getBufferEnd());
59+
Buffer.getBufferStart(), SM.getCharacterData(LocEnd) + 1,
60+
Buffer.getBufferEnd());
6161
if (Lexer.LexFromRawLexer(Token))
6262
return;
6363

clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,23 +85,21 @@ struct DenseMapInfo<
8585
clang::tidy::cppcoreguidelines::SpecialMemberFunctionsCheck::ClassDefId;
8686

8787
static inline ClassDefId getEmptyKey() {
88-
return ClassDefId(
89-
clang::SourceLocation::getFromRawEncoding(static_cast<unsigned>(-1)),
90-
"EMPTY");
88+
return ClassDefId(DenseMapInfo<clang::SourceLocation>::getEmptyKey(),
89+
"EMPTY");
9190
}
9291

9392
static inline ClassDefId getTombstoneKey() {
94-
return ClassDefId(
95-
clang::SourceLocation::getFromRawEncoding(static_cast<unsigned>(-2)),
96-
"TOMBSTONE");
93+
return ClassDefId(DenseMapInfo<clang::SourceLocation>::getTombstoneKey(),
94+
"TOMBSTONE");
9795
}
9896

9997
static unsigned getHashValue(ClassDefId Val) {
10098
assert(Val != getEmptyKey() && "Cannot hash the empty key!");
10199
assert(Val != getTombstoneKey() && "Cannot hash the tombstone key!");
102100

103101
std::hash<ClassDefId::second_type> SecondHash;
104-
return Val.first.getRawEncoding() + SecondHash(Val.second);
102+
return Val.first.getHashValue() + SecondHash(Val.second);
105103
}
106104

107105
static bool isEqual(const ClassDefId &LHS, const ClassDefId &RHS) {

clang-tools-extra/clang-tidy/google/UpgradeGoogletestCaseCheck.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,7 @@ void UpgradeGoogletestCaseCheck::check(const MatchFinder::MatchResult &Result) {
298298
}
299299

300300
if (IsInInstantiation) {
301-
if (MatchedTemplateLocations.count(
302-
ReplacementRange.getBegin().getRawEncoding()) == 0) {
301+
if (MatchedTemplateLocations.count(ReplacementRange.getBegin()) == 0) {
303302
// For each location matched in a template instantiation, we check if
304303
// the location can also be found in `MatchedTemplateLocations`. If it
305304
// is not found, that means the expression did not create a match
@@ -313,8 +312,7 @@ void UpgradeGoogletestCaseCheck::check(const MatchFinder::MatchResult &Result) {
313312
if (IsInTemplate) {
314313
// We gather source locations from template matches not in template
315314
// instantiations for future matches.
316-
MatchedTemplateLocations.insert(
317-
ReplacementRange.getBegin().getRawEncoding());
315+
MatchedTemplateLocations.insert(ReplacementRange.getBegin());
318316
}
319317

320318
if (!AddFix) {

clang-tools-extra/clang-tidy/google/UpgradeGoogletestCaseCheck.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class UpgradeGoogletestCaseCheck : public ClangTidyCheck {
3333
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
3434

3535
private:
36-
llvm::DenseSet<unsigned> MatchedTemplateLocations;
36+
llvm::DenseSet<SourceLocation> MatchedTemplateLocations;
3737
};
3838

3939
} // namespace google

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -794,14 +794,14 @@ static bool areExprsFromDifferentMacros(const Expr *LhsExpr,
794794
SM.getDecomposedLoc(SM.getExpansionLoc(Lsr.getBegin()));
795795
std::pair<FileID, unsigned> RsrLocInfo =
796796
SM.getDecomposedLoc(SM.getExpansionLoc(Rsr.getBegin()));
797-
const llvm::MemoryBuffer *MB = SM.getBuffer(LsrLocInfo.first);
797+
llvm::MemoryBufferRef MB = SM.getBufferOrFake(LsrLocInfo.first);
798798

799-
const char *LTokenPos = MB->getBufferStart() + LsrLocInfo.second;
800-
const char *RTokenPos = MB->getBufferStart() + RsrLocInfo.second;
799+
const char *LTokenPos = MB.getBufferStart() + LsrLocInfo.second;
800+
const char *RTokenPos = MB.getBufferStart() + RsrLocInfo.second;
801801
Lexer LRawLex(SM.getLocForStartOfFile(LsrLocInfo.first), LO,
802-
MB->getBufferStart(), LTokenPos, MB->getBufferEnd());
802+
MB.getBufferStart(), LTokenPos, MB.getBufferEnd());
803803
Lexer RRawLex(SM.getLocForStartOfFile(RsrLocInfo.first), LO,
804-
MB->getBufferStart(), RTokenPos, MB->getBufferEnd());
804+
MB.getBufferStart(), RTokenPos, MB.getBufferEnd());
805805

806806
Token LTok, RTok;
807807
do { // Compare the expressions token-by-token.

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ SourceLocation StaticAssertCheck::getLastParenLoc(const ASTContext *ASTCtx,
140140
const LangOptions &Opts = ASTCtx->getLangOpts();
141141
const SourceManager &SM = ASTCtx->getSourceManager();
142142

143-
const llvm::MemoryBuffer *Buffer = SM.getBuffer(SM.getFileID(AssertLoc));
143+
llvm::Optional<llvm::MemoryBufferRef> Buffer =
144+
SM.getBufferOrNone(SM.getFileID(AssertLoc));
144145
if (!Buffer)
145146
return SourceLocation();
146147

0 commit comments

Comments
 (0)