-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[clang] Remove redundant calls to std::unique_ptr<T>::get (NFC) #139399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clang] Remove redundant calls to std::unique_ptr<T>::get (NFC) #139399
Conversation
|
@llvm/pr-subscribers-clang-codegen @llvm/pr-subscribers-clang-driver Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/139399.diff 12 Files Affected:
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index d3767be62473e..c58cd2c93fb60 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -909,13 +909,13 @@ interp::Context &ASTContext::getInterpContext() {
if (!InterpContext) {
InterpContext.reset(new interp::Context(*this));
}
- return *InterpContext.get();
+ return *InterpContext;
}
ParentMapContext &ASTContext::getParentMapContext() {
if (!ParentMapCtx)
ParentMapCtx.reset(new ParentMapContext(*this));
- return *ParentMapCtx.get();
+ return *ParentMapCtx;
}
static bool isAddrSpaceMapManglingEnabled(const TargetInfo &TI,
@@ -13066,7 +13066,7 @@ bool ASTContext::isNearlyEmpty(const CXXRecordDecl *RD) const {
}
VTableContextBase *ASTContext::getVTableContext() {
- if (!VTContext.get()) {
+ if (!VTContext) {
auto ABI = Target->getCXXABI();
if (ABI.isMicrosoft())
VTContext.reset(new MicrosoftVTableContext(*this));
diff --git a/clang/lib/AST/ByteCode/Context.h b/clang/lib/AST/ByteCode/Context.h
index 624a8ee6096e0..fc778f9796a79 100644
--- a/clang/lib/AST/ByteCode/Context.h
+++ b/clang/lib/AST/ByteCode/Context.h
@@ -105,7 +105,7 @@ class Context final {
}
/// Returns the program. This is only needed for unittests.
- Program &getProgram() const { return *P.get(); }
+ Program &getProgram() const { return *P; }
unsigned collectBaseOffset(const RecordDecl *BaseDecl,
const RecordDecl *DerivedDecl) const;
diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp
index 8d0e8d194f2c9..c7447273a42fa 100644
--- a/clang/lib/CodeGen/CGVTables.cpp
+++ b/clang/lib/CodeGen/CGVTables.cpp
@@ -985,7 +985,7 @@ llvm::GlobalVariable *CodeGenVTables::GenerateConstructionVTable(
assert(!VTable->isDeclaration() && "Shouldn't set properties on declaration");
CGM.setGVProperties(VTable, RD);
- CGM.EmitVTableTypeMetadata(RD, VTable, *VTLayout.get());
+ CGM.EmitVTableTypeMetadata(RD, VTable, *VTLayout);
if (UsingRelativeLayout) {
RemoveHwasanMetadata(VTable);
diff --git a/clang/lib/Driver/SanitizerArgs.cpp b/clang/lib/Driver/SanitizerArgs.cpp
index 6ff45d145e81c..85c4a754f93c5 100644
--- a/clang/lib/Driver/SanitizerArgs.cpp
+++ b/clang/lib/Driver/SanitizerArgs.cpp
@@ -180,7 +180,7 @@ static void validateSpecialCaseListFormat(const Driver &D,
std::string BLError;
std::unique_ptr<llvm::SpecialCaseList> SCL(
llvm::SpecialCaseList::create(SCLFiles, D.getVFS(), BLError));
- if (!SCL.get() && DiagnoseErrors)
+ if (!SCL && DiagnoseErrors)
D.Diag(MalformedSCLErrorDiagID) << BLError;
}
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 35f823e9407db..5a79fe070c384 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -1248,7 +1248,7 @@ bool ASTUnit::Parse(std::shared_ptr<PCHContainerOperations> PCHContainerOps,
llvm::CrashRecoveryContextCleanupRegistrar<TopLevelDeclTrackerAction>
ActCleanup(Act.get());
- if (!Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0]))
+ if (!Act->BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0]))
return true;
if (SavedMainFileBuffer)
@@ -1650,7 +1650,7 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocationAction(
llvm::CrashRecoveryContextCleanupRegistrar<TopLevelDeclTrackerAction>
ActCleanup(TrackerAct.get());
- if (!Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0])) {
+ if (!Act->BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0])) {
AST->transferASTDataFromCompilerInstance(*Clang);
if (OwnAST && ErrAST)
ErrAST->swap(OwnAST);
@@ -2333,7 +2333,7 @@ void ASTUnit::CodeComplete(
if (!Act)
Act.reset(new SyntaxOnlyAction);
- if (Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0])) {
+ if (Act->BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0])) {
if (llvm::Error Err = Act->Execute()) {
consumeError(std::move(Err)); // FIXME this drops errors on the floor.
}
diff --git a/clang/lib/Frontend/PrecompiledPreamble.cpp b/clang/lib/Frontend/PrecompiledPreamble.cpp
index 70f9b66b92b0d..3f3fe3c9937e4 100644
--- a/clang/lib/Frontend/PrecompiledPreamble.cpp
+++ b/clang/lib/Frontend/PrecompiledPreamble.cpp
@@ -512,7 +512,7 @@ llvm::ErrorOr<PrecompiledPreamble> PrecompiledPreamble::Build(
std::move(Buffer),
/*WritePCHFile=*/Storage->getKind() == PCHStorage::Kind::TempFile,
Callbacks);
- if (!Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0]))
+ if (!Act->BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0]))
return BuildPreambleError::BeginSourceFileFailed;
// Performed after BeginSourceFile to ensure Clang->Preprocessor can be
diff --git a/clang/lib/Parse/ParseAST.cpp b/clang/lib/Parse/ParseAST.cpp
index 761f84070681e..8eeb3ff2cd5e4 100644
--- a/clang/lib/Parse/ParseAST.cpp
+++ b/clang/lib/Parse/ParseAST.cpp
@@ -109,7 +109,7 @@ void clang::ParseAST(Preprocessor &PP, ASTConsumer *Consumer,
// Recover resources if we crash before exiting this method.
llvm::CrashRecoveryContextCleanupRegistrar<Sema> CleanupSema(S.get());
- ParseAST(*S.get(), PrintStats, SkipFunctionBodies);
+ ParseAST(*S, PrintStats, SkipFunctionBodies);
}
void clang::ParseAST(Sema &S, bool PrintStats, bool SkipFunctionBodies) {
@@ -131,7 +131,7 @@ void clang::ParseAST(Sema &S, bool PrintStats, bool SkipFunctionBodies) {
std::unique_ptr<Parser> ParseOP(
new Parser(S.getPreprocessor(), S, SkipFunctionBodies));
- Parser &P = *ParseOP.get();
+ Parser &P = *ParseOP;
llvm::CrashRecoveryContextCleanupRegistrar<const void, ResetStackCleanup>
CleanupPrettyStack(llvm::SavePrettyStackState());
diff --git a/clang/lib/Parse/ParseStmtAsm.cpp b/clang/lib/Parse/ParseStmtAsm.cpp
index f3415c30dde7a..264e8c73799c8 100644
--- a/clang/lib/Parse/ParseStmtAsm.cpp
+++ b/clang/lib/Parse/ParseStmtAsm.cpp
@@ -601,7 +601,7 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) {
std::unique_ptr<llvm::MCStreamer> Str(createNullStreamer(Ctx));
std::unique_ptr<llvm::MCAsmParser> Parser(
- createMCAsmParser(TempSrcMgr, Ctx, *Str.get(), *MAI));
+ createMCAsmParser(TempSrcMgr, Ctx, *Str, *MAI));
std::unique_ptr<llvm::MCTargetAsmParser> TargetParser(
TheTarget->createMCAsmParser(*STI, *Parser, *MII, MCOptions));
@@ -617,7 +617,7 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) {
// Change to the Intel dialect.
Parser->setAssemblerDialect(1);
- Parser->setTargetParser(*TargetParser.get());
+ Parser->setTargetParser(*TargetParser);
Parser->setParsingMSInlineAsm(true);
TargetParser->setParsingMSInlineAsm(true);
diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp
index b98fc5ead100f..ab7ba238bcc57 100644
--- a/clang/tools/driver/cc1as_main.cpp
+++ b/clang/tools/driver/cc1as_main.cpp
@@ -577,7 +577,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
Triple T(Opts.Triple);
Str.reset(TheTarget->createMCObjectStreamer(
T, Ctx, std::move(MAB), std::move(OW), std::move(CE), *STI));
- Str.get()->initSections(Opts.NoExecStack, *STI);
+ Str->initSections(Opts.NoExecStack, *STI);
if (T.isOSBinFormatMachO() && T.isOSDarwin()) {
Triple *TVT = Opts.DarwinTargetVariantTriple
? &*Opts.DarwinTargetVariantTriple
@@ -592,14 +592,14 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
if (Opts.EmbedBitcode && Ctx.getObjectFileType() == MCContext::IsMachO) {
MCSection *AsmLabel = Ctx.getMachOSection(
"__LLVM", "__asm", MachO::S_REGULAR, 4, SectionKind::getReadOnly());
- Str.get()->switchSection(AsmLabel);
- Str.get()->emitZeros(1);
+ Str->switchSection(AsmLabel);
+ Str->emitZeros(1);
}
bool Failed = false;
std::unique_ptr<MCAsmParser> Parser(
- createMCAsmParser(SrcMgr, Ctx, *Str.get(), *MAI));
+ createMCAsmParser(SrcMgr, Ctx, *Str, *MAI));
// FIXME: init MCTargetOptions from sanitizer flags here.
std::unique_ptr<MCTargetAsmParser> TAP(
@@ -619,7 +619,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
}
if (!Failed) {
- Parser->setTargetParser(*TAP.get());
+ Parser->setTargetParser(*TAP);
Failed = Parser->Run(Opts.NoInitialTextSection);
}
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index fa5df3b5a06e6..42c24cb9b6e50 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -4390,7 +4390,7 @@ clang_parseTranslationUnit_Impl(CXIndex CIdx, const char *source_filename,
CXXIdx->getPCHContainerOperations(), Diags,
CXXIdx->getClangResourcesPath(), CXXIdx->getStorePreamblesInMemory(),
CXXIdx->getPreambleStoragePath(), CXXIdx->getOnlyLocalDecls(),
- CaptureDiagnostics, *RemappedFiles.get(),
+ CaptureDiagnostics, *RemappedFiles,
/*RemappedFilesKeepOriginalName=*/true, PrecompilePreambleAfterNParses,
TUKind, CacheCodeCompletionResults, IncludeBriefCommentsInCodeCompletion,
/*AllowPCHWithCompilerErrors=*/true, SkipFunctionBodies, SingleFileParse,
@@ -4981,8 +4981,7 @@ clang_reparseTranslationUnit_Impl(CXTranslationUnit TU,
RemappedFiles->push_back(std::make_pair(UF.Filename, MB.release()));
}
- if (!CXXUnit->Reparse(CXXIdx->getPCHContainerOperations(),
- *RemappedFiles.get()))
+ if (!CXXUnit->Reparse(CXXIdx->getPCHContainerOperations(), *RemappedFiles))
return CXError_Success;
if (isASTReadError(CXXUnit))
return CXError_ASTReadError;
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.h b/clang/unittests/ASTMatchers/ASTMatchersTest.h
index 4c6320a2aff60..6eea39ae787fa 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTest.h
+++ b/clang/unittests/ASTMatchers/ASTMatchersTest.h
@@ -339,7 +339,7 @@ testing::AssertionResult matchAndVerifyResultConditionally(
SmallString<256> Buffer;
std::unique_ptr<ASTUnit> AST(buildASTFromCodeWithArgs(
Code.toStringRef(Buffer), CompileArgs, Filename));
- if (!AST.get())
+ if (!AST)
return testing::AssertionFailure()
<< "Parsing error in \"" << Code << "\" while building AST";
Finder.matchAST(AST->getASTContext());
diff --git a/clang/unittests/Basic/FileEntryTest.cpp b/clang/unittests/Basic/FileEntryTest.cpp
index f8a0b4a4edcda..de3b9dd6aa6e7 100644
--- a/clang/unittests/Basic/FileEntryTest.cpp
+++ b/clang/unittests/Basic/FileEntryTest.cpp
@@ -40,8 +40,7 @@ class FileEntryTestHelper {
FileEntryRef addFile(StringRef Name) {
FEs.emplace_back(new FileEntry());
return FileEntryRef(
- *Files.insert({Name, FileEntryRef::MapValue(*FEs.back().get(), DR)})
- .first);
+ *Files.insert({Name, FileEntryRef::MapValue(*FEs.back(), DR)}).first);
}
FileEntryRef addFileAlias(StringRef Name, FileEntryRef Base) {
return FileEntryRef(
|
|
@llvm/pr-subscribers-clang Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/139399.diff 12 Files Affected:
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index d3767be62473e..c58cd2c93fb60 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -909,13 +909,13 @@ interp::Context &ASTContext::getInterpContext() {
if (!InterpContext) {
InterpContext.reset(new interp::Context(*this));
}
- return *InterpContext.get();
+ return *InterpContext;
}
ParentMapContext &ASTContext::getParentMapContext() {
if (!ParentMapCtx)
ParentMapCtx.reset(new ParentMapContext(*this));
- return *ParentMapCtx.get();
+ return *ParentMapCtx;
}
static bool isAddrSpaceMapManglingEnabled(const TargetInfo &TI,
@@ -13066,7 +13066,7 @@ bool ASTContext::isNearlyEmpty(const CXXRecordDecl *RD) const {
}
VTableContextBase *ASTContext::getVTableContext() {
- if (!VTContext.get()) {
+ if (!VTContext) {
auto ABI = Target->getCXXABI();
if (ABI.isMicrosoft())
VTContext.reset(new MicrosoftVTableContext(*this));
diff --git a/clang/lib/AST/ByteCode/Context.h b/clang/lib/AST/ByteCode/Context.h
index 624a8ee6096e0..fc778f9796a79 100644
--- a/clang/lib/AST/ByteCode/Context.h
+++ b/clang/lib/AST/ByteCode/Context.h
@@ -105,7 +105,7 @@ class Context final {
}
/// Returns the program. This is only needed for unittests.
- Program &getProgram() const { return *P.get(); }
+ Program &getProgram() const { return *P; }
unsigned collectBaseOffset(const RecordDecl *BaseDecl,
const RecordDecl *DerivedDecl) const;
diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp
index 8d0e8d194f2c9..c7447273a42fa 100644
--- a/clang/lib/CodeGen/CGVTables.cpp
+++ b/clang/lib/CodeGen/CGVTables.cpp
@@ -985,7 +985,7 @@ llvm::GlobalVariable *CodeGenVTables::GenerateConstructionVTable(
assert(!VTable->isDeclaration() && "Shouldn't set properties on declaration");
CGM.setGVProperties(VTable, RD);
- CGM.EmitVTableTypeMetadata(RD, VTable, *VTLayout.get());
+ CGM.EmitVTableTypeMetadata(RD, VTable, *VTLayout);
if (UsingRelativeLayout) {
RemoveHwasanMetadata(VTable);
diff --git a/clang/lib/Driver/SanitizerArgs.cpp b/clang/lib/Driver/SanitizerArgs.cpp
index 6ff45d145e81c..85c4a754f93c5 100644
--- a/clang/lib/Driver/SanitizerArgs.cpp
+++ b/clang/lib/Driver/SanitizerArgs.cpp
@@ -180,7 +180,7 @@ static void validateSpecialCaseListFormat(const Driver &D,
std::string BLError;
std::unique_ptr<llvm::SpecialCaseList> SCL(
llvm::SpecialCaseList::create(SCLFiles, D.getVFS(), BLError));
- if (!SCL.get() && DiagnoseErrors)
+ if (!SCL && DiagnoseErrors)
D.Diag(MalformedSCLErrorDiagID) << BLError;
}
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 35f823e9407db..5a79fe070c384 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -1248,7 +1248,7 @@ bool ASTUnit::Parse(std::shared_ptr<PCHContainerOperations> PCHContainerOps,
llvm::CrashRecoveryContextCleanupRegistrar<TopLevelDeclTrackerAction>
ActCleanup(Act.get());
- if (!Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0]))
+ if (!Act->BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0]))
return true;
if (SavedMainFileBuffer)
@@ -1650,7 +1650,7 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocationAction(
llvm::CrashRecoveryContextCleanupRegistrar<TopLevelDeclTrackerAction>
ActCleanup(TrackerAct.get());
- if (!Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0])) {
+ if (!Act->BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0])) {
AST->transferASTDataFromCompilerInstance(*Clang);
if (OwnAST && ErrAST)
ErrAST->swap(OwnAST);
@@ -2333,7 +2333,7 @@ void ASTUnit::CodeComplete(
if (!Act)
Act.reset(new SyntaxOnlyAction);
- if (Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0])) {
+ if (Act->BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0])) {
if (llvm::Error Err = Act->Execute()) {
consumeError(std::move(Err)); // FIXME this drops errors on the floor.
}
diff --git a/clang/lib/Frontend/PrecompiledPreamble.cpp b/clang/lib/Frontend/PrecompiledPreamble.cpp
index 70f9b66b92b0d..3f3fe3c9937e4 100644
--- a/clang/lib/Frontend/PrecompiledPreamble.cpp
+++ b/clang/lib/Frontend/PrecompiledPreamble.cpp
@@ -512,7 +512,7 @@ llvm::ErrorOr<PrecompiledPreamble> PrecompiledPreamble::Build(
std::move(Buffer),
/*WritePCHFile=*/Storage->getKind() == PCHStorage::Kind::TempFile,
Callbacks);
- if (!Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0]))
+ if (!Act->BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0]))
return BuildPreambleError::BeginSourceFileFailed;
// Performed after BeginSourceFile to ensure Clang->Preprocessor can be
diff --git a/clang/lib/Parse/ParseAST.cpp b/clang/lib/Parse/ParseAST.cpp
index 761f84070681e..8eeb3ff2cd5e4 100644
--- a/clang/lib/Parse/ParseAST.cpp
+++ b/clang/lib/Parse/ParseAST.cpp
@@ -109,7 +109,7 @@ void clang::ParseAST(Preprocessor &PP, ASTConsumer *Consumer,
// Recover resources if we crash before exiting this method.
llvm::CrashRecoveryContextCleanupRegistrar<Sema> CleanupSema(S.get());
- ParseAST(*S.get(), PrintStats, SkipFunctionBodies);
+ ParseAST(*S, PrintStats, SkipFunctionBodies);
}
void clang::ParseAST(Sema &S, bool PrintStats, bool SkipFunctionBodies) {
@@ -131,7 +131,7 @@ void clang::ParseAST(Sema &S, bool PrintStats, bool SkipFunctionBodies) {
std::unique_ptr<Parser> ParseOP(
new Parser(S.getPreprocessor(), S, SkipFunctionBodies));
- Parser &P = *ParseOP.get();
+ Parser &P = *ParseOP;
llvm::CrashRecoveryContextCleanupRegistrar<const void, ResetStackCleanup>
CleanupPrettyStack(llvm::SavePrettyStackState());
diff --git a/clang/lib/Parse/ParseStmtAsm.cpp b/clang/lib/Parse/ParseStmtAsm.cpp
index f3415c30dde7a..264e8c73799c8 100644
--- a/clang/lib/Parse/ParseStmtAsm.cpp
+++ b/clang/lib/Parse/ParseStmtAsm.cpp
@@ -601,7 +601,7 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) {
std::unique_ptr<llvm::MCStreamer> Str(createNullStreamer(Ctx));
std::unique_ptr<llvm::MCAsmParser> Parser(
- createMCAsmParser(TempSrcMgr, Ctx, *Str.get(), *MAI));
+ createMCAsmParser(TempSrcMgr, Ctx, *Str, *MAI));
std::unique_ptr<llvm::MCTargetAsmParser> TargetParser(
TheTarget->createMCAsmParser(*STI, *Parser, *MII, MCOptions));
@@ -617,7 +617,7 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) {
// Change to the Intel dialect.
Parser->setAssemblerDialect(1);
- Parser->setTargetParser(*TargetParser.get());
+ Parser->setTargetParser(*TargetParser);
Parser->setParsingMSInlineAsm(true);
TargetParser->setParsingMSInlineAsm(true);
diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp
index b98fc5ead100f..ab7ba238bcc57 100644
--- a/clang/tools/driver/cc1as_main.cpp
+++ b/clang/tools/driver/cc1as_main.cpp
@@ -577,7 +577,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
Triple T(Opts.Triple);
Str.reset(TheTarget->createMCObjectStreamer(
T, Ctx, std::move(MAB), std::move(OW), std::move(CE), *STI));
- Str.get()->initSections(Opts.NoExecStack, *STI);
+ Str->initSections(Opts.NoExecStack, *STI);
if (T.isOSBinFormatMachO() && T.isOSDarwin()) {
Triple *TVT = Opts.DarwinTargetVariantTriple
? &*Opts.DarwinTargetVariantTriple
@@ -592,14 +592,14 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
if (Opts.EmbedBitcode && Ctx.getObjectFileType() == MCContext::IsMachO) {
MCSection *AsmLabel = Ctx.getMachOSection(
"__LLVM", "__asm", MachO::S_REGULAR, 4, SectionKind::getReadOnly());
- Str.get()->switchSection(AsmLabel);
- Str.get()->emitZeros(1);
+ Str->switchSection(AsmLabel);
+ Str->emitZeros(1);
}
bool Failed = false;
std::unique_ptr<MCAsmParser> Parser(
- createMCAsmParser(SrcMgr, Ctx, *Str.get(), *MAI));
+ createMCAsmParser(SrcMgr, Ctx, *Str, *MAI));
// FIXME: init MCTargetOptions from sanitizer flags here.
std::unique_ptr<MCTargetAsmParser> TAP(
@@ -619,7 +619,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
}
if (!Failed) {
- Parser->setTargetParser(*TAP.get());
+ Parser->setTargetParser(*TAP);
Failed = Parser->Run(Opts.NoInitialTextSection);
}
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index fa5df3b5a06e6..42c24cb9b6e50 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -4390,7 +4390,7 @@ clang_parseTranslationUnit_Impl(CXIndex CIdx, const char *source_filename,
CXXIdx->getPCHContainerOperations(), Diags,
CXXIdx->getClangResourcesPath(), CXXIdx->getStorePreamblesInMemory(),
CXXIdx->getPreambleStoragePath(), CXXIdx->getOnlyLocalDecls(),
- CaptureDiagnostics, *RemappedFiles.get(),
+ CaptureDiagnostics, *RemappedFiles,
/*RemappedFilesKeepOriginalName=*/true, PrecompilePreambleAfterNParses,
TUKind, CacheCodeCompletionResults, IncludeBriefCommentsInCodeCompletion,
/*AllowPCHWithCompilerErrors=*/true, SkipFunctionBodies, SingleFileParse,
@@ -4981,8 +4981,7 @@ clang_reparseTranslationUnit_Impl(CXTranslationUnit TU,
RemappedFiles->push_back(std::make_pair(UF.Filename, MB.release()));
}
- if (!CXXUnit->Reparse(CXXIdx->getPCHContainerOperations(),
- *RemappedFiles.get()))
+ if (!CXXUnit->Reparse(CXXIdx->getPCHContainerOperations(), *RemappedFiles))
return CXError_Success;
if (isASTReadError(CXXUnit))
return CXError_ASTReadError;
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.h b/clang/unittests/ASTMatchers/ASTMatchersTest.h
index 4c6320a2aff60..6eea39ae787fa 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTest.h
+++ b/clang/unittests/ASTMatchers/ASTMatchersTest.h
@@ -339,7 +339,7 @@ testing::AssertionResult matchAndVerifyResultConditionally(
SmallString<256> Buffer;
std::unique_ptr<ASTUnit> AST(buildASTFromCodeWithArgs(
Code.toStringRef(Buffer), CompileArgs, Filename));
- if (!AST.get())
+ if (!AST)
return testing::AssertionFailure()
<< "Parsing error in \"" << Code << "\" while building AST";
Finder.matchAST(AST->getASTContext());
diff --git a/clang/unittests/Basic/FileEntryTest.cpp b/clang/unittests/Basic/FileEntryTest.cpp
index f8a0b4a4edcda..de3b9dd6aa6e7 100644
--- a/clang/unittests/Basic/FileEntryTest.cpp
+++ b/clang/unittests/Basic/FileEntryTest.cpp
@@ -40,8 +40,7 @@ class FileEntryTestHelper {
FileEntryRef addFile(StringRef Name) {
FEs.emplace_back(new FileEntry());
return FileEntryRef(
- *Files.insert({Name, FileEntryRef::MapValue(*FEs.back().get(), DR)})
- .first);
+ *Files.insert({Name, FileEntryRef::MapValue(*FEs.back(), DR)}).first);
}
FileEntryRef addFileAlias(StringRef Name, FileEntryRef Base) {
return FileEntryRef(
|
|
@llvm/pr-subscribers-clang-modules Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/139399.diff 12 Files Affected:
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index d3767be62473e..c58cd2c93fb60 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -909,13 +909,13 @@ interp::Context &ASTContext::getInterpContext() {
if (!InterpContext) {
InterpContext.reset(new interp::Context(*this));
}
- return *InterpContext.get();
+ return *InterpContext;
}
ParentMapContext &ASTContext::getParentMapContext() {
if (!ParentMapCtx)
ParentMapCtx.reset(new ParentMapContext(*this));
- return *ParentMapCtx.get();
+ return *ParentMapCtx;
}
static bool isAddrSpaceMapManglingEnabled(const TargetInfo &TI,
@@ -13066,7 +13066,7 @@ bool ASTContext::isNearlyEmpty(const CXXRecordDecl *RD) const {
}
VTableContextBase *ASTContext::getVTableContext() {
- if (!VTContext.get()) {
+ if (!VTContext) {
auto ABI = Target->getCXXABI();
if (ABI.isMicrosoft())
VTContext.reset(new MicrosoftVTableContext(*this));
diff --git a/clang/lib/AST/ByteCode/Context.h b/clang/lib/AST/ByteCode/Context.h
index 624a8ee6096e0..fc778f9796a79 100644
--- a/clang/lib/AST/ByteCode/Context.h
+++ b/clang/lib/AST/ByteCode/Context.h
@@ -105,7 +105,7 @@ class Context final {
}
/// Returns the program. This is only needed for unittests.
- Program &getProgram() const { return *P.get(); }
+ Program &getProgram() const { return *P; }
unsigned collectBaseOffset(const RecordDecl *BaseDecl,
const RecordDecl *DerivedDecl) const;
diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp
index 8d0e8d194f2c9..c7447273a42fa 100644
--- a/clang/lib/CodeGen/CGVTables.cpp
+++ b/clang/lib/CodeGen/CGVTables.cpp
@@ -985,7 +985,7 @@ llvm::GlobalVariable *CodeGenVTables::GenerateConstructionVTable(
assert(!VTable->isDeclaration() && "Shouldn't set properties on declaration");
CGM.setGVProperties(VTable, RD);
- CGM.EmitVTableTypeMetadata(RD, VTable, *VTLayout.get());
+ CGM.EmitVTableTypeMetadata(RD, VTable, *VTLayout);
if (UsingRelativeLayout) {
RemoveHwasanMetadata(VTable);
diff --git a/clang/lib/Driver/SanitizerArgs.cpp b/clang/lib/Driver/SanitizerArgs.cpp
index 6ff45d145e81c..85c4a754f93c5 100644
--- a/clang/lib/Driver/SanitizerArgs.cpp
+++ b/clang/lib/Driver/SanitizerArgs.cpp
@@ -180,7 +180,7 @@ static void validateSpecialCaseListFormat(const Driver &D,
std::string BLError;
std::unique_ptr<llvm::SpecialCaseList> SCL(
llvm::SpecialCaseList::create(SCLFiles, D.getVFS(), BLError));
- if (!SCL.get() && DiagnoseErrors)
+ if (!SCL && DiagnoseErrors)
D.Diag(MalformedSCLErrorDiagID) << BLError;
}
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 35f823e9407db..5a79fe070c384 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -1248,7 +1248,7 @@ bool ASTUnit::Parse(std::shared_ptr<PCHContainerOperations> PCHContainerOps,
llvm::CrashRecoveryContextCleanupRegistrar<TopLevelDeclTrackerAction>
ActCleanup(Act.get());
- if (!Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0]))
+ if (!Act->BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0]))
return true;
if (SavedMainFileBuffer)
@@ -1650,7 +1650,7 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocationAction(
llvm::CrashRecoveryContextCleanupRegistrar<TopLevelDeclTrackerAction>
ActCleanup(TrackerAct.get());
- if (!Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0])) {
+ if (!Act->BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0])) {
AST->transferASTDataFromCompilerInstance(*Clang);
if (OwnAST && ErrAST)
ErrAST->swap(OwnAST);
@@ -2333,7 +2333,7 @@ void ASTUnit::CodeComplete(
if (!Act)
Act.reset(new SyntaxOnlyAction);
- if (Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0])) {
+ if (Act->BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0])) {
if (llvm::Error Err = Act->Execute()) {
consumeError(std::move(Err)); // FIXME this drops errors on the floor.
}
diff --git a/clang/lib/Frontend/PrecompiledPreamble.cpp b/clang/lib/Frontend/PrecompiledPreamble.cpp
index 70f9b66b92b0d..3f3fe3c9937e4 100644
--- a/clang/lib/Frontend/PrecompiledPreamble.cpp
+++ b/clang/lib/Frontend/PrecompiledPreamble.cpp
@@ -512,7 +512,7 @@ llvm::ErrorOr<PrecompiledPreamble> PrecompiledPreamble::Build(
std::move(Buffer),
/*WritePCHFile=*/Storage->getKind() == PCHStorage::Kind::TempFile,
Callbacks);
- if (!Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0]))
+ if (!Act->BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0]))
return BuildPreambleError::BeginSourceFileFailed;
// Performed after BeginSourceFile to ensure Clang->Preprocessor can be
diff --git a/clang/lib/Parse/ParseAST.cpp b/clang/lib/Parse/ParseAST.cpp
index 761f84070681e..8eeb3ff2cd5e4 100644
--- a/clang/lib/Parse/ParseAST.cpp
+++ b/clang/lib/Parse/ParseAST.cpp
@@ -109,7 +109,7 @@ void clang::ParseAST(Preprocessor &PP, ASTConsumer *Consumer,
// Recover resources if we crash before exiting this method.
llvm::CrashRecoveryContextCleanupRegistrar<Sema> CleanupSema(S.get());
- ParseAST(*S.get(), PrintStats, SkipFunctionBodies);
+ ParseAST(*S, PrintStats, SkipFunctionBodies);
}
void clang::ParseAST(Sema &S, bool PrintStats, bool SkipFunctionBodies) {
@@ -131,7 +131,7 @@ void clang::ParseAST(Sema &S, bool PrintStats, bool SkipFunctionBodies) {
std::unique_ptr<Parser> ParseOP(
new Parser(S.getPreprocessor(), S, SkipFunctionBodies));
- Parser &P = *ParseOP.get();
+ Parser &P = *ParseOP;
llvm::CrashRecoveryContextCleanupRegistrar<const void, ResetStackCleanup>
CleanupPrettyStack(llvm::SavePrettyStackState());
diff --git a/clang/lib/Parse/ParseStmtAsm.cpp b/clang/lib/Parse/ParseStmtAsm.cpp
index f3415c30dde7a..264e8c73799c8 100644
--- a/clang/lib/Parse/ParseStmtAsm.cpp
+++ b/clang/lib/Parse/ParseStmtAsm.cpp
@@ -601,7 +601,7 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) {
std::unique_ptr<llvm::MCStreamer> Str(createNullStreamer(Ctx));
std::unique_ptr<llvm::MCAsmParser> Parser(
- createMCAsmParser(TempSrcMgr, Ctx, *Str.get(), *MAI));
+ createMCAsmParser(TempSrcMgr, Ctx, *Str, *MAI));
std::unique_ptr<llvm::MCTargetAsmParser> TargetParser(
TheTarget->createMCAsmParser(*STI, *Parser, *MII, MCOptions));
@@ -617,7 +617,7 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) {
// Change to the Intel dialect.
Parser->setAssemblerDialect(1);
- Parser->setTargetParser(*TargetParser.get());
+ Parser->setTargetParser(*TargetParser);
Parser->setParsingMSInlineAsm(true);
TargetParser->setParsingMSInlineAsm(true);
diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp
index b98fc5ead100f..ab7ba238bcc57 100644
--- a/clang/tools/driver/cc1as_main.cpp
+++ b/clang/tools/driver/cc1as_main.cpp
@@ -577,7 +577,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
Triple T(Opts.Triple);
Str.reset(TheTarget->createMCObjectStreamer(
T, Ctx, std::move(MAB), std::move(OW), std::move(CE), *STI));
- Str.get()->initSections(Opts.NoExecStack, *STI);
+ Str->initSections(Opts.NoExecStack, *STI);
if (T.isOSBinFormatMachO() && T.isOSDarwin()) {
Triple *TVT = Opts.DarwinTargetVariantTriple
? &*Opts.DarwinTargetVariantTriple
@@ -592,14 +592,14 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
if (Opts.EmbedBitcode && Ctx.getObjectFileType() == MCContext::IsMachO) {
MCSection *AsmLabel = Ctx.getMachOSection(
"__LLVM", "__asm", MachO::S_REGULAR, 4, SectionKind::getReadOnly());
- Str.get()->switchSection(AsmLabel);
- Str.get()->emitZeros(1);
+ Str->switchSection(AsmLabel);
+ Str->emitZeros(1);
}
bool Failed = false;
std::unique_ptr<MCAsmParser> Parser(
- createMCAsmParser(SrcMgr, Ctx, *Str.get(), *MAI));
+ createMCAsmParser(SrcMgr, Ctx, *Str, *MAI));
// FIXME: init MCTargetOptions from sanitizer flags here.
std::unique_ptr<MCTargetAsmParser> TAP(
@@ -619,7 +619,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
}
if (!Failed) {
- Parser->setTargetParser(*TAP.get());
+ Parser->setTargetParser(*TAP);
Failed = Parser->Run(Opts.NoInitialTextSection);
}
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index fa5df3b5a06e6..42c24cb9b6e50 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -4390,7 +4390,7 @@ clang_parseTranslationUnit_Impl(CXIndex CIdx, const char *source_filename,
CXXIdx->getPCHContainerOperations(), Diags,
CXXIdx->getClangResourcesPath(), CXXIdx->getStorePreamblesInMemory(),
CXXIdx->getPreambleStoragePath(), CXXIdx->getOnlyLocalDecls(),
- CaptureDiagnostics, *RemappedFiles.get(),
+ CaptureDiagnostics, *RemappedFiles,
/*RemappedFilesKeepOriginalName=*/true, PrecompilePreambleAfterNParses,
TUKind, CacheCodeCompletionResults, IncludeBriefCommentsInCodeCompletion,
/*AllowPCHWithCompilerErrors=*/true, SkipFunctionBodies, SingleFileParse,
@@ -4981,8 +4981,7 @@ clang_reparseTranslationUnit_Impl(CXTranslationUnit TU,
RemappedFiles->push_back(std::make_pair(UF.Filename, MB.release()));
}
- if (!CXXUnit->Reparse(CXXIdx->getPCHContainerOperations(),
- *RemappedFiles.get()))
+ if (!CXXUnit->Reparse(CXXIdx->getPCHContainerOperations(), *RemappedFiles))
return CXError_Success;
if (isASTReadError(CXXUnit))
return CXError_ASTReadError;
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.h b/clang/unittests/ASTMatchers/ASTMatchersTest.h
index 4c6320a2aff60..6eea39ae787fa 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTest.h
+++ b/clang/unittests/ASTMatchers/ASTMatchersTest.h
@@ -339,7 +339,7 @@ testing::AssertionResult matchAndVerifyResultConditionally(
SmallString<256> Buffer;
std::unique_ptr<ASTUnit> AST(buildASTFromCodeWithArgs(
Code.toStringRef(Buffer), CompileArgs, Filename));
- if (!AST.get())
+ if (!AST)
return testing::AssertionFailure()
<< "Parsing error in \"" << Code << "\" while building AST";
Finder.matchAST(AST->getASTContext());
diff --git a/clang/unittests/Basic/FileEntryTest.cpp b/clang/unittests/Basic/FileEntryTest.cpp
index f8a0b4a4edcda..de3b9dd6aa6e7 100644
--- a/clang/unittests/Basic/FileEntryTest.cpp
+++ b/clang/unittests/Basic/FileEntryTest.cpp
@@ -40,8 +40,7 @@ class FileEntryTestHelper {
FileEntryRef addFile(StringRef Name) {
FEs.emplace_back(new FileEntry());
return FileEntryRef(
- *Files.insert({Name, FileEntryRef::MapValue(*FEs.back().get(), DR)})
- .first);
+ *Files.insert({Name, FileEntryRef::MapValue(*FEs.back(), DR)}).first);
}
FileEntryRef addFileAlias(StringRef Name, FileEntryRef Base) {
return FileEntryRef(
|
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/186/builds/8911 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/52/builds/8248 Here is the relevant piece of the build log for the reference |
No description provided.