Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions clang/lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/ByteCode/Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CGVTables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Driver/SanitizerArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions clang/lib/Frontend/ASTUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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.
}
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Frontend/PrecompiledPreamble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Parse/ParseAST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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());
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Parse/ParseStmtAsm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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);

Expand Down
10 changes: 5 additions & 5 deletions clang/tools/driver/cc1as_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand All @@ -619,7 +619,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
}

if (!Failed) {
Parser->setTargetParser(*TAP.get());
Parser->setTargetParser(*TAP);
Failed = Parser->Run(Opts.NoInitialTextSection);
}

Expand Down
5 changes: 2 additions & 3 deletions clang/tools/libclang/CIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion clang/unittests/ASTMatchers/ASTMatchersTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
3 changes: 1 addition & 2 deletions clang/unittests/Basic/FileEntryTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading