Skip to content

Commit e27acfd

Browse files
committed
merge main into amd-stg-open
Revert "[OpenMPOpt] Allow indirect calls in AAKernelInfoCallSite (llvm#65836)" Change-Id: I790c81ab7d92e0f828e81535cb131c6c45248138
2 parents 88fffad + 77b7b1a commit e27acfd

File tree

50 files changed

+1445
-448
lines changed

Some content is hidden

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

50 files changed

+1445
-448
lines changed

clang-tools-extra/clang-apply-replacements/include/clang-apply-replacements/Tooling/ApplyReplacements.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ typedef std::vector<std::string> TUReplacementFiles;
4040
typedef std::vector<clang::tooling::TranslationUnitDiagnostics> TUDiagnostics;
4141

4242
/// Map mapping file name to a set of AtomicChange targeting that file.
43-
typedef llvm::DenseMap<const clang::FileEntry *,
44-
std::vector<tooling::AtomicChange>>
45-
FileToChangesMap;
43+
using FileToChangesMap =
44+
llvm::DenseMap<clang::FileEntryRef, std::vector<tooling::AtomicChange>>;
4645

4746
/// Recursively descends through a directory structure rooted at \p
4847
/// Directory and attempts to deserialize *.yaml files as

clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,11 @@ std::error_code collectReplacementsFromDirectory(
138138
///
139139
/// \returns A map mapping FileEntry to a set of Replacement targeting that
140140
/// file.
141-
static llvm::DenseMap<const FileEntry *, std::vector<tooling::Replacement>>
141+
static llvm::DenseMap<FileEntryRef, std::vector<tooling::Replacement>>
142142
groupReplacements(const TUReplacements &TUs, const TUDiagnostics &TUDs,
143143
const clang::SourceManager &SM) {
144144
llvm::StringSet<> Warned;
145-
llvm::DenseMap<const FileEntry *, std::vector<tooling::Replacement>>
145+
llvm::DenseMap<FileEntryRef, std::vector<tooling::Replacement>>
146146
GroupedReplacements;
147147

148148
// Deduplicate identical replacements in diagnostics unless they are from the
@@ -165,7 +165,7 @@ groupReplacements(const TUReplacements &TUs, const TUDiagnostics &TUDs,
165165
else
166166
SM.getFileManager().makeAbsolutePath(Path);
167167

168-
if (auto Entry = SM.getFileManager().getFile(Path)) {
168+
if (auto Entry = SM.getFileManager().getOptionalFileRef(Path)) {
169169
if (SourceTU) {
170170
auto &Replaces = DiagReplacements[*Entry];
171171
auto It = Replaces.find(R);
@@ -212,10 +212,10 @@ bool mergeAndDeduplicate(const TUReplacements &TUs, const TUDiagnostics &TUDs,
212212
// To report conflicting replacements on corresponding file, all replacements
213213
// are stored into 1 big AtomicChange.
214214
for (const auto &FileAndReplacements : GroupedReplacements) {
215-
const FileEntry *Entry = FileAndReplacements.first;
215+
FileEntryRef Entry = FileAndReplacements.first;
216216
const SourceLocation BeginLoc =
217217
SM.getLocForStartOfFile(SM.getOrCreateFileID(Entry, SrcMgr::C_User));
218-
tooling::AtomicChange FileChange(Entry->getName(), Entry->getName());
218+
tooling::AtomicChange FileChange(Entry.getName(), Entry.getName());
219219
for (const auto &R : FileAndReplacements.second) {
220220
llvm::Error Err =
221221
FileChange.replace(SM, BeginLoc.getLocWithOffset(R.getOffset()),

clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ int main(int argc, char **argv) {
146146
: tooling::ApplyChangesSpec::kNone;
147147

148148
for (const auto &FileChange : Changes) {
149-
const FileEntry *Entry = FileChange.first;
150-
StringRef FileName = Entry->getName();
149+
FileEntryRef Entry = FileChange.first;
150+
StringRef FileName = Entry.getName();
151151
llvm::Expected<std::string> NewFileData =
152152
applyChanges(FileName, FileChange.second, Spec, Diagnostics);
153153
if (!NewFileData) {

clang-tools-extra/clang-include-fixer/find-all-symbols/FindAllMacros.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ void FindAllMacros::Ifndef(SourceLocation Loc, const Token &MacroNameTok,
6262
}
6363

6464
void FindAllMacros::EndOfMainFile() {
65-
Reporter->reportSymbols(SM->getFileEntryForID(SM->getMainFileID())->getName(),
66-
FileSymbols);
65+
Reporter->reportSymbols(
66+
SM->getFileEntryRefForID(SM->getMainFileID())->getName(), FileSymbols);
6767
FileSymbols.clear();
6868
}
6969

clang-tools-extra/clang-include-fixer/find-all-symbols/FindAllSymbols.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ void FindAllSymbols::run(const MatchFinder::MatchResult &Result) {
254254
const SourceManager *SM = Result.SourceManager;
255255
if (auto Symbol = CreateSymbolInfo(ND, *SM, Collector)) {
256256
Filename =
257-
std::string(SM->getFileEntryForID(SM->getMainFileID())->getName());
257+
std::string(SM->getFileEntryRefForID(SM->getMainFileID())->getName());
258258
FileSymbols[*Symbol] += Signals;
259259
}
260260
}

clang-tools-extra/clang-move/Move.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ AST_POLYMORPHIC_MATCHER_P(isExpansionInFile,
115115
auto ExpansionLoc = SourceManager.getExpansionLoc(Node.getBeginLoc());
116116
if (ExpansionLoc.isInvalid())
117117
return false;
118-
auto *FileEntry =
119-
SourceManager.getFileEntryForID(SourceManager.getFileID(ExpansionLoc));
118+
auto FileEntry =
119+
SourceManager.getFileEntryRefForID(SourceManager.getFileID(ExpansionLoc));
120120
if (!FileEntry)
121121
return false;
122122
return MakeAbsolutePath(SourceManager, FileEntry->getName()) ==
@@ -135,7 +135,7 @@ class FindAllIncludes : public PPCallbacks {
135135
StringRef /*RelativePath*/,
136136
const Module * /*Imported*/,
137137
SrcMgr::CharacteristicKind /*FileType*/) override {
138-
if (const auto *FileEntry = SM.getFileEntryForID(SM.getFileID(HashLoc)))
138+
if (auto FileEntry = SM.getFileEntryRefForID(SM.getFileID(HashLoc)))
139139
MoveTool->addIncludes(FileName, IsAngled, SearchPath,
140140
FileEntry->getName(), FilenameRange, SM);
141141
}
@@ -341,7 +341,7 @@ bool isInHeaderFile(const Decl *D, llvm::StringRef OriginalRunningDirectory,
341341
if (ExpansionLoc.isInvalid())
342342
return false;
343343

344-
if (const auto *FE = SM.getFileEntryForID(SM.getFileID(ExpansionLoc))) {
344+
if (auto FE = SM.getFileEntryRefForID(SM.getFileID(ExpansionLoc))) {
345345
return MakeAbsolutePath(SM, FE->getName()) ==
346346
MakeAbsolutePath(OriginalRunningDirectory, OldHeader);
347347
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ void ClangTidyDiagnosticConsumer::checkFilters(SourceLocation Location,
552552
// location needed depends on the check (in particular, where this check wants
553553
// to apply fixes).
554554
FileID FID = Sources.getDecomposedExpansionLoc(Location).first;
555-
const FileEntry *File = Sources.getFileEntryForID(FID);
555+
OptionalFileEntryRef File = Sources.getFileEntryRefForID(FID);
556556

557557
// -DMACRO definitions on the command line have locations in a virtual buffer
558558
// that doesn't have a FileEntry. Don't skip these as well.

clang-tools-extra/clang-tidy/abseil/AbseilMatcher.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ AST_POLYMORPHIC_MATCHER(
3434
SourceLocation Loc = SourceManager.getSpellingLoc(Node.getBeginLoc());
3535
if (Loc.isInvalid())
3636
return false;
37-
const FileEntry *FileEntry =
38-
SourceManager.getFileEntryForID(SourceManager.getFileID(Loc));
37+
OptionalFileEntryRef FileEntry =
38+
SourceManager.getFileEntryRefForID(SourceManager.getFileID(Loc));
3939
if (!FileEntry)
4040
return false;
4141
// Determine whether filepath contains "absl/[absl-library]" substring, where

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ bool KernelNameRestrictionPPCallbacks::fileNameIsRestricted(
7676
void KernelNameRestrictionPPCallbacks::EndOfMainFile() {
7777

7878
// Check main file for restricted names.
79-
const FileEntry *Entry = SM.getFileEntryForID(SM.getMainFileID());
79+
OptionalFileEntryRef Entry = SM.getFileEntryRefForID(SM.getMainFileID());
8080
StringRef FileName = llvm::sys::path::filename(Entry->getName());
8181
if (fileNameIsRestricted(FileName))
8282
Check.diag(SM.getLocForStartOfFile(SM.getMainFileID()),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void UnusedUsingDeclsCheck::check(const MatchFinder::MatchResult &Result) {
8484
return;
8585
// We don't emit warnings on unused-using-decls from headers, so bail out if
8686
// the main file is a header.
87-
if (const auto *MainFile = Result.SourceManager->getFileEntryForID(
87+
if (auto MainFile = Result.SourceManager->getFileEntryRefForID(
8888
Result.SourceManager->getMainFileID());
8989
utils::isFileExtension(MainFile->getName(), HeaderFileExtensions))
9090
return;

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ class HeaderGuardPPCallbacks : public PPCallbacks {
3535
// guards.
3636
SourceManager &SM = PP->getSourceManager();
3737
if (Reason == EnterFile && FileType == SrcMgr::C_User) {
38-
if (const FileEntry *FE = SM.getFileEntryForID(SM.getFileID(Loc))) {
38+
if (OptionalFileEntryRef FE =
39+
SM.getFileEntryRefForID(SM.getFileID(Loc))) {
3940
std::string FileName = cleanPath(FE->getName());
40-
Files[FileName] = FE;
41+
Files[FileName] = *FE;
4142
}
4243
}
4344
}
@@ -77,8 +78,8 @@ class HeaderGuardPPCallbacks : public PPCallbacks {
7778
if (!MI->isUsedForHeaderGuard())
7879
continue;
7980

80-
const FileEntry *FE =
81-
SM.getFileEntryForID(SM.getFileID(MI->getDefinitionLoc()));
81+
OptionalFileEntryRef FE =
82+
SM.getFileEntryRefForID(SM.getFileID(MI->getDefinitionLoc()));
8283
std::string FileName = cleanPath(FE->getName());
8384
Files.erase(FileName);
8485

clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ TEST(IncludeCleaner, StdlibUnused) {
8888
template <typename> class vector {};
8989
}
9090
)cpp";
91-
TU.AdditionalFiles["list"] = "#include <bits>";
92-
TU.AdditionalFiles["queue"] = "#include <bits>";
93-
TU.AdditionalFiles["vector"] = "#include <bits>";
94-
TU.AdditionalFiles["string"] = "#include <bits>";
91+
TU.AdditionalFiles["list"] = guard("#include <bits>");
92+
TU.AdditionalFiles["queue"] = guard("#include <bits>");
93+
TU.AdditionalFiles["vector"] = guard("#include <bits>");
94+
TU.AdditionalFiles["string"] = guard("#include <bits>");
9595
TU.ExtraArgs = {"-isystem", testRoot()};
9696
auto AST = TU.build();
9797
IncludeCleanerFindings Findings = computeIncludeCleanerFindings(AST);

clang-tools-extra/include-cleaner/lib/Record.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,8 @@ bool PragmaIncludes::isPrivate(const FileEntry *FE) const {
430430
}
431431

432432
bool PragmaIncludes::shouldKeep(const FileEntry *FE) const {
433-
return ShouldKeep.contains(FE->getUniqueID());
433+
return ShouldKeep.contains(FE->getUniqueID()) ||
434+
NonSelfContainedFiles.contains(FE->getUniqueID());
434435
}
435436

436437
namespace {

clang-tools-extra/include-cleaner/unittests/RecordTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ class PragmaIncludeTest : public ::testing::Test {
320320

321321
void createEmptyFiles(llvm::ArrayRef<StringRef> FileNames) {
322322
for (llvm::StringRef File : FileNames)
323-
Inputs.ExtraFiles[File] = "";
323+
Inputs.ExtraFiles[File] = "#pragma once";
324324
}
325325
};
326326

clang-tools-extra/modularize/Modularize.cpp

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ getModularizeArgumentsAdjuster(DependencyMap &Dependencies) {
380380
// want to design to be applicable to a wider range of tools, and stick it
381381
// somewhere into Tooling/ in mainline
382382
struct Location {
383-
const FileEntry *File;
383+
OptionalFileEntryRef File;
384384
unsigned Line, Column;
385385

386386
Location() : File(), Line(), Column() {}
@@ -391,7 +391,7 @@ struct Location {
391391
return;
392392

393393
std::pair<FileID, unsigned> Decomposed = SM.getDecomposedLoc(Loc);
394-
File = SM.getFileEntryForID(Decomposed.first);
394+
File = SM.getFileEntryRefForID(Decomposed.first);
395395
if (!File)
396396
return;
397397

@@ -483,12 +483,12 @@ typedef std::vector<HeaderEntry> HeaderContents;
483483

484484
class EntityMap : public std::map<std::string, SmallVector<Entry, 2>> {
485485
public:
486-
DenseMap<const FileEntry *, HeaderContents> HeaderContentMismatches;
486+
DenseMap<FileEntryRef, HeaderContents> HeaderContentMismatches;
487487

488488
void add(const std::string &Name, enum Entry::EntryKind Kind, Location Loc) {
489489
// Record this entity in its header.
490490
HeaderEntry HE = { Name, Loc };
491-
CurHeaderContents[Loc.File].push_back(HE);
491+
CurHeaderContents[*Loc.File].push_back(HE);
492492

493493
// Check whether we've seen this entry before.
494494
SmallVector<Entry, 2> &Entries = (*this)[Name];
@@ -503,16 +503,13 @@ class EntityMap : public std::map<std::string, SmallVector<Entry, 2>> {
503503
}
504504

505505
void mergeCurHeaderContents() {
506-
for (DenseMap<const FileEntry *, HeaderContents>::iterator
507-
H = CurHeaderContents.begin(),
508-
HEnd = CurHeaderContents.end();
506+
for (auto H = CurHeaderContents.begin(), HEnd = CurHeaderContents.end();
509507
H != HEnd; ++H) {
510508
// Sort contents.
511509
llvm::sort(H->second);
512510

513511
// Check whether we've seen this header before.
514-
DenseMap<const FileEntry *, HeaderContents>::iterator KnownH =
515-
AllHeaderContents.find(H->first);
512+
auto KnownH = AllHeaderContents.find(H->first);
516513
if (KnownH == AllHeaderContents.end()) {
517514
// We haven't seen this header before; record its contents.
518515
AllHeaderContents.insert(*H);
@@ -534,8 +531,8 @@ class EntityMap : public std::map<std::string, SmallVector<Entry, 2>> {
534531
}
535532

536533
private:
537-
DenseMap<const FileEntry *, HeaderContents> CurHeaderContents;
538-
DenseMap<const FileEntry *, HeaderContents> AllHeaderContents;
534+
DenseMap<FileEntryRef, HeaderContents> CurHeaderContents;
535+
DenseMap<FileEntryRef, HeaderContents> AllHeaderContents;
539536
};
540537

541538
class CollectEntitiesVisitor
@@ -961,18 +958,17 @@ int main(int Argc, const char **Argv) {
961958
// they are included.
962959
// FIXME: Could we provide information about which preprocessor conditionals
963960
// are involved?
964-
for (DenseMap<const FileEntry *, HeaderContents>::iterator
965-
H = Entities.HeaderContentMismatches.begin(),
966-
HEnd = Entities.HeaderContentMismatches.end();
961+
for (auto H = Entities.HeaderContentMismatches.begin(),
962+
HEnd = Entities.HeaderContentMismatches.end();
967963
H != HEnd; ++H) {
968964
if (H->second.empty()) {
969965
errs() << "internal error: phantom header content mismatch\n";
970966
continue;
971967
}
972968

973969
HadErrors = 1;
974-
ModUtil->addUniqueProblemFile(std::string(H->first->getName()));
975-
errs() << "error: header '" << H->first->getName()
970+
ModUtil->addUniqueProblemFile(std::string(H->first.getName()));
971+
errs() << "error: header '" << H->first.getName()
976972
<< "' has different contents depending on how it was included.\n";
977973
for (unsigned I = 0, N = H->second.size(); I != N; ++I) {
978974
errs() << "note: '" << H->second[I].Name << "' in "

clang-tools-extra/modularize/PreprocessorTracker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,8 +1292,8 @@ void PreprocessorCallbacks::FileChanged(
12921292
PPTracker.handleHeaderEntry(PP, getSourceLocationFile(PP, Loc));
12931293
break;
12941294
case ExitFile: {
1295-
const clang::FileEntry *F =
1296-
PP.getSourceManager().getFileEntryForID(PrevFID);
1295+
clang::OptionalFileEntryRef F =
1296+
PP.getSourceManager().getFileEntryRefForID(PrevFID);
12971297
if (F)
12981298
PPTracker.handleHeaderExit(F->getName());
12991299
} break;

clang-tools-extra/pp-trace/PPCallbacksTracker.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,8 @@ void PPCallbacksTracker::appendArgument(const char *Name, FileID Value) {
476476
appendArgument(Name, "(invalid)");
477477
return;
478478
}
479-
const FileEntry *FileEntry = PP.getSourceManager().getFileEntryForID(Value);
479+
OptionalFileEntryRef FileEntry =
480+
PP.getSourceManager().getFileEntryRefForID(Value);
480481
if (!FileEntry) {
481482
appendArgument(Name, "(getFileEntryForID failed)");
482483
return;

clang-tools-extra/unittests/clang-tidy/IncludeCleanerTest.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ TEST(IncludeCleanerCheckTest, BasicUnusedIncludes) {
4747
const char *PostCode = "\n";
4848

4949
std::vector<ClangTidyError> Errors;
50-
EXPECT_EQ(PostCode, runCheckOnCode<IncludeCleanerCheck>(
51-
PreCode, &Errors, "file.cpp", std::nullopt,
52-
ClangTidyOptions(), {{"bar.h", ""}, {"vector", ""}}));
50+
EXPECT_EQ(PostCode,
51+
runCheckOnCode<IncludeCleanerCheck>(
52+
PreCode, &Errors, "file.cpp", std::nullopt, ClangTidyOptions(),
53+
{{"bar.h", "#pragma once"}, {"vector", "#pragma once"}}));
5354
}
5455

5556
TEST(IncludeCleanerCheckTest, SuppressUnusedIncludes) {
@@ -76,10 +77,11 @@ TEST(IncludeCleanerCheckTest, SuppressUnusedIncludes) {
7677
PostCode,
7778
runCheckOnCode<IncludeCleanerCheck>(
7879
PreCode, &Errors, "file.cpp", std::nullopt, Opts,
79-
{{"bar.h", ""},
80-
{"vector", ""},
81-
{appendPathFileSystemIndependent({"foo", "qux.h"}), ""},
82-
{appendPathFileSystemIndependent({"baz", "qux", "qux.h"}), ""}}));
80+
{{"bar.h", "#pragma once"},
81+
{"vector", "#pragma once"},
82+
{appendPathFileSystemIndependent({"foo", "qux.h"}), "#pragma once"},
83+
{appendPathFileSystemIndependent({"baz", "qux", "qux.h"}),
84+
"#pragma once"}}));
8385
}
8486

8587
TEST(IncludeCleanerCheckTest, BasicMissingIncludes) {

clang/include/clang/Sema/Sema.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13758,7 +13758,7 @@ class Sema final {
1375813758
bool CheckRISCVLMUL(CallExpr *TheCall, unsigned ArgNum);
1375913759
bool CheckRISCVBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
1376013760
CallExpr *TheCall);
13761-
void checkRVVTypeSupport(QualType Ty, SourceLocation Loc, ValueDecl *D);
13761+
void checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D);
1376213762
bool CheckLoongArchBuiltinFunctionCall(const TargetInfo &TI,
1376313763
unsigned BuiltinID, CallExpr *TheCall);
1376413764
bool CheckWebAssemblyBuiltinFunctionCall(const TargetInfo &TI,

clang/lib/AST/ExprConstant.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3711,7 +3711,8 @@ findSubobject(EvalInfo &Info, const Expr *E, const CompleteObject &Obj,
37113711
!isValidIndeterminateAccess(handler.AccessKind))) {
37123712
if (!Info.checkingPotentialConstantExpression())
37133713
Info.FFDiag(E, diag::note_constexpr_access_uninit)
3714-
<< handler.AccessKind << O->isIndeterminate();
3714+
<< handler.AccessKind << O->isIndeterminate()
3715+
<< E->getSourceRange();
37153716
return handler.failed();
37163717
}
37173718

@@ -4443,7 +4444,8 @@ struct CompoundAssignSubobjectHandler {
44434444
return foundVector(Subobj, SubobjType);
44444445
case APValue::Indeterminate:
44454446
Info.FFDiag(E, diag::note_constexpr_access_uninit)
4446-
<< /*read of=*/0 << /*uninitialized object=*/1;
4447+
<< /*read of=*/0 << /*uninitialized object=*/1
4448+
<< E->getLHS()->getSourceRange();
44474449
return false;
44484450
default:
44494451
// FIXME: can this happen?

clang/lib/AST/Interp/Interp.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,8 @@ bool CheckInitialized(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
261261
return true;
262262

263263
if (!S.checkingPotentialConstantExpression()) {
264-
const SourceInfo &Loc = S.Current->getSource(OpPC);
265-
S.FFDiag(Loc, diag::note_constexpr_access_uninit)
266-
<< AK << /*uninitialized=*/true;
264+
S.FFDiag(S.Current->getSource(OpPC), diag::note_constexpr_access_uninit)
265+
<< AK << /*uninitialized=*/true << S.Current->getRange(OpPC);
267266
}
268267
return false;
269268
}

clang/lib/AST/Interp/InterpFrame.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,5 +230,8 @@ SourceLocation InterpFrame::getLocation(CodePtr PC) const {
230230
}
231231

232232
SourceRange InterpFrame::getRange(CodePtr PC) const {
233+
if (Func && Func->getDecl()->isImplicit() && Caller)
234+
return Caller->getRange(RetPC);
235+
233236
return S.getRange(Func, PC);
234237
}

clang/lib/Sema/SemaChecking.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5514,7 +5514,7 @@ bool Sema::CheckWebAssemblyBuiltinFunctionCall(const TargetInfo &TI,
55145514
return false;
55155515
}
55165516

5517-
void Sema::checkRVVTypeSupport(QualType Ty, SourceLocation Loc, ValueDecl *D) {
5517+
void Sema::checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D) {
55185518
const TargetInfo &TI = Context.getTargetInfo();
55195519
// (ELEN, LMUL) pairs of (8, mf8), (16, mf4), (32, mf2), (64, m1) requires at
55205520
// least zve64x

0 commit comments

Comments
 (0)