jansvoboda11 created this revision. jansvoboda11 added a reviewer: kazu. Herald added subscribers: Moerafaat, zero9178, steakhal, bzcheeseman, sdasgup3, carlosgalvezp, jeroen.dobbelaere, wenzhicui, wrengr, cota, teijeong, rdzhabarov, tatianashp, ThomasRaoux, msifontes, jurahul, Kayjukh, grosul1, martong, Joonsoo, liufengdb, aartbik, mgester, arpith-jacob, antiagainst, shauheen, rriddle, mehdi_amini, ributzka, arphaman, hiraditya, arichardson, emaste. Herald added a reviewer: antiagainst. Herald added a reviewer: rriddle. Herald added a reviewer: MaskRay. Herald added a reviewer: NoQ. Herald added a reviewer: njames93. Herald added a project: All. jansvoboda11 requested review of this revision. Herald added a reviewer: nicolasvasilache. Herald added subscribers: cfe-commits, llvm-commits, StephenFan, stephenneuendorffer, nicolasvasilache. Herald added projects: clang, MLIR, LLVM, clang-tools-extra.
Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D139229 Files: clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp clang/lib/ARCMigrate/TransGCAttrs.cpp clang/lib/AST/ExprConstant.cpp clang/lib/AST/TypePrinter.cpp clang/lib/Analysis/AnalysisDeclContext.cpp clang/lib/Analysis/CFG.cpp clang/lib/CodeGen/CGCleanup.cpp clang/lib/CodeGen/CGException.cpp clang/lib/CodeGen/CGObjCRuntime.cpp clang/lib/CodeGen/CGStmt.cpp clang/lib/Lex/MacroArgs.cpp clang/lib/Lex/PPDirectives.cpp clang/lib/Lex/PPExpressions.cpp clang/lib/Sema/SemaChecking.cpp clang/lib/Sema/SemaExpr.cpp clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTReaderDecl.cpp clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp clang/lib/Tooling/Refactoring/ASTSelection.cpp clang/tools/libclang/CIndex.cpp lld/ELF/ScriptParser.cpp llvm/include/llvm/Support/SaveAndRestore.h llvm/lib/Analysis/BasicAliasAnalysis.cpp llvm/lib/Analysis/ScalarEvolution.cpp llvm/lib/AsmParser/LLParser.cpp llvm/lib/CodeGen/CallingConvLower.cpp llvm/lib/CodeGen/TargetPassConfig.cpp llvm/lib/IR/AsmWriter.cpp llvm/lib/MC/MCParser/AsmLexer.cpp llvm/lib/Support/Unix/Signals.inc mlir/lib/IR/AsmPrinter.cpp mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp mlir/lib/Tools/PDLL/AST/NodePrinter.cpp mlir/lib/Tools/PDLL/Parser/Parser.cpp mlir/lib/Transforms/Utils/DialectConversion.cpp mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
Index: mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp =================================================================== --- mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp +++ mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp @@ -864,8 +864,8 @@ } // Generate the printer for the contained elements. { - llvm::SaveAndRestore<bool> shouldEmitSpaceFlag(shouldEmitSpace); - llvm::SaveAndRestore<bool> lastWasPunctuationFlag(lastWasPunctuation); + llvm::SaveAndRestore shouldEmitSpaceFlag(shouldEmitSpace); + llvm::SaveAndRestore lastWasPunctuationFlag(lastWasPunctuation); for (FormatElement *element : el->getThenElements()) genElementPrinter(element, ctx, os); } Index: mlir/lib/Transforms/Utils/DialectConversion.cpp =================================================================== --- mlir/lib/Transforms/Utils/DialectConversion.cpp +++ mlir/lib/Transforms/Utils/DialectConversion.cpp @@ -1690,8 +1690,8 @@ auto &rewriterImpl = dialectRewriter.getImpl(); // Track the current conversion pattern type converter in the rewriter. - llvm::SaveAndRestore<TypeConverter *> currentConverterGuard( - rewriterImpl.currentTypeConverter, getTypeConverter()); + llvm::SaveAndRestore currentConverterGuard(rewriterImpl.currentTypeConverter, + getTypeConverter()); // Remap the operands of the operation. SmallVector<Value, 4> operands; Index: mlir/lib/Tools/PDLL/Parser/Parser.cpp =================================================================== --- mlir/lib/Tools/PDLL/Parser/Parser.cpp +++ mlir/lib/Tools/PDLL/Parser/Parser.cpp @@ -1293,7 +1293,7 @@ StringRef anonymousNamePrefix, bool isInline) { SMRange loc = curToken.getLoc(); consumeToken(); - llvm::SaveAndRestore<ParserContext> saveCtx(parserContext, declContext); + llvm::SaveAndRestore saveCtx(parserContext, declContext); // Parse the name of the decl. const ast::Name *name = nullptr; @@ -1466,8 +1466,7 @@ FailureOr<ast::Decl *> Parser::parsePatternDecl() { SMRange loc = curToken.getLoc(); consumeToken(Token::kw_Pattern); - llvm::SaveAndRestore<ParserContext> saveCtx(parserContext, - ParserContext::PatternMatch); + llvm::SaveAndRestore saveCtx(parserContext, ParserContext::PatternMatch); // Check for an optional identifier for the pattern name. const ast::Name *name = nullptr; @@ -2377,8 +2376,7 @@ return failure(); // The replacement portion of this statement is within a rewrite context. - llvm::SaveAndRestore<ParserContext> saveCtx(parserContext, - ParserContext::Rewrite); + llvm::SaveAndRestore saveCtx(parserContext, ParserContext::Rewrite); // Parse the replacement values. SmallVector<ast::Expr *> replValues; @@ -2445,8 +2443,7 @@ return emitError("expected `{` to start rewrite body"); // The rewrite body of this statement is within a rewrite context. - llvm::SaveAndRestore<ParserContext> saveCtx(parserContext, - ParserContext::Rewrite); + llvm::SaveAndRestore saveCtx(parserContext, ParserContext::Rewrite); FailureOr<ast::CompoundStmt *> rewriteBody = parseCompoundStmt(); if (failed(rewriteBody)) Index: mlir/lib/Tools/PDLL/AST/NodePrinter.cpp =================================================================== --- mlir/lib/Tools/PDLL/AST/NodePrinter.cpp +++ mlir/lib/Tools/PDLL/AST/NodePrinter.cpp @@ -62,7 +62,7 @@ if (range.empty()) return; elementIndentStack.reserve(elementIndentStack.size() + 1); - llvm::SaveAndRestore<bool> lastElement(elementIndentStack.back(), true); + llvm::SaveAndRestore lastElement(elementIndentStack.back(), true); printIndent(); os << label << "`\n"; Index: mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp =================================================================== --- mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp +++ mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp @@ -1389,8 +1389,7 @@ // SpecConstantOperation in the module, we simply re-use the fake ID since the // previous Value assigned to it isn't visible in the current scope anyway. DenseMap<uint32_t, Value> newValueMap; - llvm::SaveAndRestore<DenseMap<uint32_t, Value>> valueMapGuard(valueMap, - newValueMap); + llvm::SaveAndRestore valueMapGuard(valueMap, newValueMap); constexpr uint32_t fakeID = static_cast<uint32_t>(-3); SmallVector<uint32_t, 4> enclosedOpResultTypeAndOperands; Index: mlir/lib/IR/AsmPrinter.cpp =================================================================== --- mlir/lib/IR/AsmPrinter.cpp +++ mlir/lib/IR/AsmPrinter.cpp @@ -1266,9 +1266,9 @@ SSANameState::SSANameState(Operation *op, const OpPrintingFlags &printerFlags) : printerFlags(printerFlags) { - llvm::SaveAndRestore<unsigned> valueIDSaver(nextValueID); - llvm::SaveAndRestore<unsigned> argumentIDSaver(nextArgumentID); - llvm::SaveAndRestore<unsigned> conflictIDSaver(nextConflictID); + llvm::SaveAndRestore valueIDSaver(nextValueID); + llvm::SaveAndRestore argumentIDSaver(nextArgumentID); + llvm::SaveAndRestore conflictIDSaver(nextConflictID); // The naming context includes `nextValueID`, `nextArgumentID`, // `nextConflictID` and `usedNames` scoped HashTable. This information is Index: llvm/lib/Support/Unix/Signals.inc =================================================================== --- llvm/lib/Support/Unix/Signals.inc +++ llvm/lib/Support/Unix/Signals.inc @@ -412,7 +412,7 @@ } static void InfoSignalHandler(int Sig) { - SaveAndRestore<int> SaveErrnoDuringASignalHandler(errno); + SaveAndRestore SaveErrnoDuringASignalHandler(errno); if (SignalHandlerFunctionType CurrentInfoFunction = InfoSignalFunction) CurrentInfoFunction(); } Index: llvm/lib/MC/MCParser/AsmLexer.cpp =================================================================== --- llvm/lib/MC/MCParser/AsmLexer.cpp +++ llvm/lib/MC/MCParser/AsmLexer.cpp @@ -684,12 +684,12 @@ size_t AsmLexer::peekTokens(MutableArrayRef<AsmToken> Buf, bool ShouldSkipSpace) { - SaveAndRestore<const char *> SavedTokenStart(TokStart); - SaveAndRestore<const char *> SavedCurPtr(CurPtr); - SaveAndRestore<bool> SavedAtStartOfLine(IsAtStartOfLine); - SaveAndRestore<bool> SavedAtStartOfStatement(IsAtStartOfStatement); - SaveAndRestore<bool> SavedSkipSpace(SkipSpace, ShouldSkipSpace); - SaveAndRestore<bool> SavedIsPeeking(IsPeeking, true); + SaveAndRestore SavedTokenStart(TokStart); + SaveAndRestore SavedCurPtr(CurPtr); + SaveAndRestore SavedAtStartOfLine(IsAtStartOfLine); + SaveAndRestore SavedAtStartOfStatement(IsAtStartOfStatement); + SaveAndRestore SavedSkipSpace(SkipSpace, ShouldSkipSpace); + SaveAndRestore SavedIsPeeking(IsPeeking, true); std::string SavedErr = getErr(); SMLoc SavedErrLoc = getErrLoc(); Index: llvm/lib/IR/AsmWriter.cpp =================================================================== --- llvm/lib/IR/AsmWriter.cpp +++ llvm/lib/IR/AsmWriter.cpp @@ -2494,7 +2494,7 @@ if (const MDNode *N = dyn_cast<MDNode>(MD)) { std::unique_ptr<SlotTracker> MachineStorage; - SaveAndRestore<SlotTracker *> SARMachine(WriterCtx.Machine); + SaveAndRestore SARMachine(WriterCtx.Machine); if (!WriterCtx.Machine) { MachineStorage = std::make_unique<SlotTracker>(WriterCtx.Context); WriterCtx.Machine = MachineStorage.get(); Index: llvm/lib/CodeGen/TargetPassConfig.cpp =================================================================== --- llvm/lib/CodeGen/TargetPassConfig.cpp +++ llvm/lib/CodeGen/TargetPassConfig.cpp @@ -1059,13 +1059,13 @@ // pass manager into two. GlobalISel with the fallback path disabled // and -run-pass seem to be unaffected. The majority of GlobalISel // testing uses -run-pass so this probably isn't too bad. - SaveAndRestore<bool> SavedDebugifyIsSafe(DebugifyIsSafe); + SaveAndRestore SavedDebugifyIsSafe(DebugifyIsSafe); if (Selector != SelectorType::GlobalISel || !isGlobalISelAbortEnabled()) DebugifyIsSafe = false; // Add instruction selector passes. if (Selector == SelectorType::GlobalISel) { - SaveAndRestore<bool> SavedAddingMachinePasses(AddingMachinePasses, true); + SaveAndRestore SavedAddingMachinePasses(AddingMachinePasses, true); if (addIRTranslator()) return true; Index: llvm/lib/CodeGen/CallingConvLower.cpp =================================================================== --- llvm/lib/CodeGen/CallingConvLower.cpp +++ llvm/lib/CodeGen/CallingConvLower.cpp @@ -240,8 +240,8 @@ // Oftentimes calling conventions will not user register parameters for // variadic functions, so we need to assume we're not variadic so that we get // all the registers that might be used in a non-variadic call. - SaveAndRestore<bool> SavedVarArg(IsVarArg, false); - SaveAndRestore<bool> SavedMustTail(AnalyzingMustTailForwardedRegs, true); + SaveAndRestore SavedVarArg(IsVarArg, false); + SaveAndRestore SavedMustTail(AnalyzingMustTailForwardedRegs, true); for (MVT RegVT : RegParmTypes) { SmallVector<MCPhysReg, 8> RemainingRegs; Index: llvm/lib/AsmParser/LLParser.cpp =================================================================== --- llvm/lib/AsmParser/LLParser.cpp +++ llvm/lib/AsmParser/LLParser.cpp @@ -6072,7 +6072,7 @@ // within this function. if (PFS.resolveForwardRefBlockAddresses()) return true; - SaveAndRestore<PerFunctionState *> ScopeExit(BlockAddressPFS, &PFS); + SaveAndRestore ScopeExit(BlockAddressPFS, &PFS); // We need at least one basic block. if (Lex.getKind() == lltok::rbrace || Lex.getKind() == lltok::kw_uselistorder) Index: llvm/lib/Analysis/ScalarEvolution.cpp =================================================================== --- llvm/lib/Analysis/ScalarEvolution.cpp +++ llvm/lib/Analysis/ScalarEvolution.cpp @@ -11170,7 +11170,7 @@ // Allowing arbitrary number of activations of isKnownPredicateViaSplitting on // the stack can result in exponential time complexity. - SaveAndRestore<bool> Restore(ProvingSplitPredicate, true); + SaveAndRestore Restore(ProvingSplitPredicate, true); // If L >= 0 then I `ult` L <=> I >= 0 && I `slt` L // @@ -11239,7 +11239,7 @@ if (WalkingBEDominatingConds) return false; - SaveAndRestore<bool> ClearOnExit(WalkingBEDominatingConds, true); + SaveAndRestore ClearOnExit(WalkingBEDominatingConds, true); // See if we can exploit a trip count to prove the predicate. const auto &BETakenInfo = getBackedgeTakenInfo(L); Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp =================================================================== --- llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -1399,7 +1399,7 @@ // In the recursive alias queries below, we may compare values from two // different loop iterations. - SaveAndRestore<bool> SavedMayBeCrossIteration(AAQI.MayBeCrossIteration, true); + SaveAndRestore SavedMayBeCrossIteration(AAQI.MayBeCrossIteration, true); AliasResult Alias = AAQI.AAR.alias(MemoryLocation(V1Srcs[0], PNSize), MemoryLocation(V2, V2Size), AAQI); Index: llvm/include/llvm/Support/SaveAndRestore.h =================================================================== --- llvm/include/llvm/Support/SaveAndRestore.h +++ llvm/include/llvm/Support/SaveAndRestore.h @@ -34,6 +34,11 @@ T OldValue; }; +// User-defined CTAD guides. +template <typename T> SaveAndRestore(T &) -> SaveAndRestore<T>; +template <typename T> SaveAndRestore(T &, const T &) -> SaveAndRestore<T>; +template <typename T> SaveAndRestore(T &, T &&) -> SaveAndRestore<T>; + } // namespace llvm #endif Index: lld/ELF/ScriptParser.cpp =================================================================== --- lld/ELF/ScriptParser.cpp +++ lld/ELF/ScriptParser.cpp @@ -1041,19 +1041,19 @@ const StringRef op = peek(); if (op.startswith("=")) { // Support = followed by an expression without whitespace. - SaveAndRestore<bool> saved(inExpr, true); + SaveAndRestore saved(inExpr, true); cmd = readSymbolAssignment(tok); } else if ((op.size() == 2 && op[1] == '=' && strchr("*/+-&|", op[0])) || op == "<<=" || op == ">>=") { cmd = readSymbolAssignment(tok); } else if (tok == "PROVIDE") { - SaveAndRestore<bool> saved(inExpr, true); + SaveAndRestore saved(inExpr, true); cmd = readProvideHidden(true, false); } else if (tok == "HIDDEN") { - SaveAndRestore<bool> saved(inExpr, true); + SaveAndRestore saved(inExpr, true); cmd = readProvideHidden(false, true); } else if (tok == "PROVIDE_HIDDEN") { - SaveAndRestore<bool> saved(inExpr, true); + SaveAndRestore saved(inExpr, true); cmd = readProvideHidden(true, true); } Index: clang/tools/libclang/CIndex.cpp =================================================================== --- clang/tools/libclang/CIndex.cpp +++ clang/tools/libclang/CIndex.cpp @@ -628,8 +628,8 @@ // FIXME: Eventually remove. This part of a hack to support proper // iteration over all Decls contained lexically within an ObjC container. - SaveAndRestore<DeclContext::decl_iterator *> DI_saved(DI_current, &I); - SaveAndRestore<DeclContext::decl_iterator> DE_saved(DE_current, E); + SaveAndRestore DI_saved(DI_current, &I); + SaveAndRestore DE_saved(DE_current, E); for (; I != E; ++I) { Decl *D = *I; Index: clang/lib/Tooling/Refactoring/ASTSelection.cpp =================================================================== --- clang/lib/Tooling/Refactoring/ASTSelection.cpp +++ clang/lib/Tooling/Refactoring/ASTSelection.cpp @@ -63,14 +63,14 @@ // Avoid traversing the semantic expressions. They should be handled by // looking through the appropriate opaque expressions in order to build // a meaningful selection tree. - llvm::SaveAndRestore<bool> LookThrough(LookThroughOpaqueValueExprs, true); + llvm::SaveAndRestore LookThrough(LookThroughOpaqueValueExprs, true); return TraverseStmt(E->getSyntacticForm()); } bool TraverseOpaqueValueExpr(OpaqueValueExpr *E) { if (!LookThroughOpaqueValueExprs) return true; - llvm::SaveAndRestore<bool> LookThrough(LookThroughOpaqueValueExprs, false); + llvm::SaveAndRestore LookThrough(LookThroughOpaqueValueExprs, false); return TraverseStmt(E->getSourceExpr()); } Index: clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp =================================================================== --- clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp +++ clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp @@ -391,9 +391,8 @@ // result onto the work list. // CEENode -> Dst -> WorkList NodeBuilderContext Ctx(Engine, calleeCtx->getCallSiteBlock(), CEENode); - SaveAndRestore<const NodeBuilderContext*> NBCSave(currBldrCtx, - &Ctx); - SaveAndRestore<unsigned> CBISave(currStmtIdx, calleeCtx->getIndex()); + SaveAndRestore<const NodeBuilderContext *> NBCSave(currBldrCtx, &Ctx); + SaveAndRestore CBISave(currStmtIdx, calleeCtx->getIndex()); CallEventRef<> UpdatedCall = Call.cloneWithState(CEEState); Index: clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp =================================================================== --- clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp +++ clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp @@ -38,17 +38,17 @@ llvm::DenseSet<const VarDecl *> &S; bool TraverseObjCAtFinallyStmt(ObjCAtFinallyStmt *S) { - SaveAndRestore<bool> inFinally(inEH, true); + SaveAndRestore inFinally(inEH, true); return ::RecursiveASTVisitor<EHCodeVisitor>::TraverseObjCAtFinallyStmt(S); } bool TraverseObjCAtCatchStmt(ObjCAtCatchStmt *S) { - SaveAndRestore<bool> inCatch(inEH, true); + SaveAndRestore inCatch(inEH, true); return ::RecursiveASTVisitor<EHCodeVisitor>::TraverseObjCAtCatchStmt(S); } bool TraverseCXXCatchStmt(CXXCatchStmt *S) { - SaveAndRestore<bool> inCatch(inEH, true); + SaveAndRestore inCatch(inEH, true); return TraverseStmt(S->getHandlerBlock()); } Index: clang/lib/Serialization/ASTReaderDecl.cpp =================================================================== --- clang/lib/Serialization/ASTReaderDecl.cpp +++ clang/lib/Serialization/ASTReaderDecl.cpp @@ -3966,8 +3966,7 @@ // Guard variable to avoid recursively redoing the process of passing // decls to consumer. - SaveAndRestore<bool> GuardPassingDeclsToConsumer(PassingDeclsToConsumer, - true); + SaveAndRestore GuardPassingDeclsToConsumer(PassingDeclsToConsumer, true); // Ensure that we've loaded all potentially-interesting declarations // that need to be eagerly loaded. Index: clang/lib/Serialization/ASTReader.cpp =================================================================== --- clang/lib/Serialization/ASTReader.cpp +++ clang/lib/Serialization/ASTReader.cpp @@ -4257,8 +4257,7 @@ SmallVectorImpl<ImportedSubmodule> *Imported) { llvm::TimeTraceScope scope("ReadAST", FileName); - llvm::SaveAndRestore<SourceLocation> - SetCurImportLocRAII(CurrentImportLoc, ImportLoc); + llvm::SaveAndRestore SetCurImportLocRAII(CurrentImportLoc, ImportLoc); llvm::SaveAndRestore<Optional<ModuleKind>> SetCurModuleKindRAII( CurrentDeserializingModuleKind, Type); Index: clang/lib/Sema/SemaExpr.cpp =================================================================== --- clang/lib/Sema/SemaExpr.cpp +++ clang/lib/Sema/SemaExpr.cpp @@ -17697,7 +17697,7 @@ /// Prevent sema calls during the tree transform from adding pointers that /// are already in the sets. - llvm::SaveAndRestore<bool> DisableIITracking( + llvm::SaveAndRestore DisableIITracking( SemaRef.RebuildingImmediateInvocation, true); /// Prevent diagnostic during tree transfrom as they are duplicates Index: clang/lib/Sema/SemaChecking.cpp =================================================================== --- clang/lib/Sema/SemaChecking.cpp +++ clang/lib/Sema/SemaChecking.cpp @@ -15584,8 +15584,8 @@ void Sema::CheckCompletedExpr(Expr *E, SourceLocation CheckLoc, bool IsConstexpr) { - llvm::SaveAndRestore<bool> ConstantContext( - isConstantEvaluatedOverride, IsConstexpr || isa<ConstantExpr>(E)); + llvm::SaveAndRestore ConstantContext(isConstantEvaluatedOverride, + IsConstexpr || isa<ConstantExpr>(E)); CheckImplicitConversions(E, CheckLoc); if (!E->isInstantiationDependent()) CheckUnsequencedOperations(E); Index: clang/lib/Lex/PPExpressions.cpp =================================================================== --- clang/lib/Lex/PPExpressions.cpp +++ clang/lib/Lex/PPExpressions.cpp @@ -869,7 +869,7 @@ /// to "!defined(X)" return X in IfNDefMacro. Preprocessor::DirectiveEvalResult Preprocessor::EvaluateDirectiveExpression(IdentifierInfo *&IfNDefMacro) { - SaveAndRestore<bool> PPDir(ParsingIfOrElifDirective, true); + SaveAndRestore PPDir(ParsingIfOrElifDirective, true); // Save the current state of 'DisableMacroExpansion' and reset it to false. If // 'DisableMacroExpansion' is true, then we must be in a macro argument list // in which case a directive is undefined behavior. We want macros to be able Index: clang/lib/Lex/PPDirectives.cpp =================================================================== --- clang/lib/Lex/PPDirectives.cpp +++ clang/lib/Lex/PPDirectives.cpp @@ -491,8 +491,7 @@ // lookup pointer. assert(!SkippingExcludedConditionalBlock && "calling SkipExcludedConditionalBlock recursively"); - llvm::SaveAndRestore<bool> SARSkipping(SkippingExcludedConditionalBlock, - true); + llvm::SaveAndRestore SARSkipping(SkippingExcludedConditionalBlock, true); ++NumSkipped; assert(!CurTokenLexer && CurPPLexer && "Lexing a macro, not a file?"); Index: clang/lib/Lex/MacroArgs.cpp =================================================================== --- clang/lib/Lex/MacroArgs.cpp +++ clang/lib/Lex/MacroArgs.cpp @@ -169,7 +169,7 @@ std::vector<Token> &Result = PreExpArgTokens[Arg]; if (!Result.empty()) return Result; - SaveAndRestore<bool> PreExpandingMacroArgs(PP.InMacroArgPreExpansion, true); + SaveAndRestore PreExpandingMacroArgs(PP.InMacroArgPreExpansion, true); const Token *AT = getUnexpArgument(Arg); unsigned NumToks = getArgLength(AT)+1; // Include the EOF. Index: clang/lib/CodeGen/CGStmt.cpp =================================================================== --- clang/lib/CodeGen/CGStmt.cpp +++ clang/lib/CodeGen/CGStmt.cpp @@ -721,11 +721,10 @@ break; } } - SaveAndRestore<bool> save_nomerge(InNoMergeAttributedStmt, nomerge); - SaveAndRestore<bool> save_noinline(InNoInlineAttributedStmt, noinline); - SaveAndRestore<bool> save_alwaysinline(InAlwaysInlineAttributedStmt, - alwaysinline); - SaveAndRestore<const CallExpr *> save_musttail(MustTailCall, musttail); + SaveAndRestore save_nomerge(InNoMergeAttributedStmt, nomerge); + SaveAndRestore save_noinline(InNoInlineAttributedStmt, noinline); + SaveAndRestore save_alwaysinline(InAlwaysInlineAttributedStmt, alwaysinline); + SaveAndRestore save_musttail(MustTailCall, musttail); EmitStmt(S.getSubStmt(), S.getAttrs()); } Index: clang/lib/CodeGen/CGObjCRuntime.cpp =================================================================== --- clang/lib/CodeGen/CGObjCRuntime.cpp +++ clang/lib/CodeGen/CGObjCRuntime.cpp @@ -230,7 +230,7 @@ CGF.EmitBlock(Handler.Block); CodeGenFunction::LexicalScope Cleanups(CGF, Handler.Body->getSourceRange()); - SaveAndRestore<llvm::Instruction *> RevertAfterScope(CGF.CurrentFuncletPad); + SaveAndRestore RevertAfterScope(CGF.CurrentFuncletPad); if (useFunclets) { llvm::Instruction *CPICandidate = Handler.Block->getFirstNonPHI(); if (auto *CPI = dyn_cast_or_null<llvm::CatchPadInst>(CPICandidate)) { Index: clang/lib/CodeGen/CGException.cpp =================================================================== --- clang/lib/CodeGen/CGException.cpp +++ clang/lib/CodeGen/CGException.cpp @@ -1223,8 +1223,7 @@ // Wasm uses Windows-style EH instructions, but merges all catch clauses into // one big catchpad. So we save the old funclet pad here before we traverse // each catch handler. - SaveAndRestore<llvm::Instruction *> RestoreCurrentFuncletPad( - CurrentFuncletPad); + SaveAndRestore RestoreCurrentFuncletPad(CurrentFuncletPad); llvm::BasicBlock *WasmCatchStartBlock = nullptr; if (EHPersonality::get(*this).isWasmPersonality()) { auto *CatchSwitch = @@ -1257,8 +1256,7 @@ RunCleanupsScope CatchScope(*this); // Initialize the catch variable and set up the cleanups. - SaveAndRestore<llvm::Instruction *> RestoreCurrentFuncletPad( - CurrentFuncletPad); + SaveAndRestore RestoreCurrentFuncletPad(CurrentFuncletPad); CGM.getCXXABI().emitBeginCatch(*this, C); // Emit the PGO counter increment. @@ -1582,8 +1580,7 @@ // Create the cleanuppad using the current parent pad as its token. Use 'none' // if this is a top-level terminate scope, which is the common case. - SaveAndRestore<llvm::Instruction *> RestoreCurrentFuncletPad( - CurrentFuncletPad); + SaveAndRestore RestoreCurrentFuncletPad(CurrentFuncletPad); llvm::Value *ParentPad = CurrentFuncletPad; if (!ParentPad) ParentPad = llvm::ConstantTokenNone::get(CGM.getLLVMContext()); Index: clang/lib/CodeGen/CGCleanup.cpp =================================================================== --- clang/lib/CodeGen/CGCleanup.cpp +++ clang/lib/CodeGen/CGCleanup.cpp @@ -1016,8 +1016,7 @@ // throwing cleanups. For funclet EH personalities, the cleanupendpad models // program termination when cleanups throw. bool PushedTerminate = false; - SaveAndRestore<llvm::Instruction *> RestoreCurrentFuncletPad( - CurrentFuncletPad); + SaveAndRestore RestoreCurrentFuncletPad(CurrentFuncletPad); llvm::CleanupPadInst *CPI = nullptr; const EHPersonality &Personality = EHPersonality::get(*this); Index: clang/lib/Analysis/CFG.cpp =================================================================== --- clang/lib/Analysis/CFG.cpp +++ clang/lib/Analysis/CFG.cpp @@ -3073,7 +3073,7 @@ // Save local scope position because in case of condition variable ScopePos // won't be restored when traversing AST. - SaveAndRestore<LocalScope::const_iterator> save_scope_pos(ScopePos); + SaveAndRestore save_scope_pos(ScopePos); // Create local scope for C++17 if init-stmt if one exists. if (Stmt *Init = I->getInit()) @@ -3098,7 +3098,7 @@ CFGBlock *ElseBlock = Succ; if (Stmt *Else = I->getElse()) { - SaveAndRestore<CFGBlock*> sv(Succ); + SaveAndRestore sv(Succ); // NULL out Block so that the recursive call to Visit will // create a new basic block. @@ -3124,7 +3124,7 @@ { Stmt *Then = I->getThen(); assert(Then); - SaveAndRestore<CFGBlock*> sv(Succ); + SaveAndRestore sv(Succ); Block = nullptr; // If branch is not a compound statement create implicit scope @@ -3274,7 +3274,7 @@ // Save local scope position because in case of exception variable ScopePos // won't be restored when traversing AST. - SaveAndRestore<LocalScope::const_iterator> save_scope_pos(ScopePos); + SaveAndRestore save_scope_pos(ScopePos); addStmt(ES->getBlock()); CFGBlock *SEHExceptBlock = Block; @@ -3364,13 +3364,13 @@ Succ = SEHTrySuccessor; // Save the current "__try" context. - SaveAndRestore<CFGBlock *> SaveTry(TryTerminatedBlock, NewTryTerminatedBlock); + SaveAndRestore SaveTry(TryTerminatedBlock, NewTryTerminatedBlock); cfg->addTryDispatchBlock(TryTerminatedBlock); // Save the current value for the __leave target. // All __leaves should go to the code following the __try // (FIXME: or if the __try has a __finally, to the __finally.) - SaveAndRestore<JumpTarget> save_break(SEHLeaveJumpTarget); + SaveAndRestore save_break(SEHLeaveJumpTarget); SEHLeaveJumpTarget = JumpTarget(SEHTrySuccessor, ScopePos); assert(Terminator->getTryBlock() && "__try must contain a non-NULL body"); @@ -3493,7 +3493,7 @@ // Save local scope position because in case of condition variable ScopePos // won't be restored when traversing AST. - SaveAndRestore<LocalScope::const_iterator> save_scope_pos(ScopePos); + SaveAndRestore save_scope_pos(ScopePos); // Create local scope for init statement and possible condition variable. // Add destructor for init statement and condition variable. @@ -3521,7 +3521,7 @@ // Save the current value for the break targets. // All breaks should go to the code following the loop. - SaveAndRestore<JumpTarget> save_break(BreakJumpTarget); + SaveAndRestore save_break(BreakJumpTarget); BreakJumpTarget = JumpTarget(LoopSuccessor, ScopePos); CFGBlock *BodyBlock = nullptr, *TransitionBlock = nullptr; @@ -3531,8 +3531,8 @@ assert(F->getBody()); // Save the current values for Block, Succ, continue and break targets. - SaveAndRestore<CFGBlock*> save_Block(Block), save_Succ(Succ); - SaveAndRestore<JumpTarget> save_continue(ContinueJumpTarget); + SaveAndRestore save_Block(Block), save_Succ(Succ); + SaveAndRestore save_continue(ContinueJumpTarget); // Create an empty block to represent the transition block for looping back // to the head of the loop. If we have increment code, it will @@ -3587,7 +3587,7 @@ do { Expr *C = F->getCond(); - SaveAndRestore<LocalScope::const_iterator> save_scope_pos(ScopePos); + SaveAndRestore save_scope_pos(ScopePos); // Specially handle logical operators, which have a slightly // more optimal CFG representation. @@ -3653,7 +3653,7 @@ // If the loop contains initialization, create a new block for those // statements. This block can also contain statements that precede the loop. if (Stmt *I = F->getInit()) { - SaveAndRestore<LocalScope::const_iterator> save_scope_pos(ScopePos); + SaveAndRestore save_scope_pos(ScopePos); ScopePos = LoopBeginScopePos; Block = createBlock(); return addStmt(I); @@ -3756,9 +3756,9 @@ // Now create the true branch. { // Save the current values for Succ, continue and break targets. - SaveAndRestore<CFGBlock*> save_Block(Block), save_Succ(Succ); - SaveAndRestore<JumpTarget> save_continue(ContinueJumpTarget), - save_break(BreakJumpTarget); + SaveAndRestore save_Block(Block), save_Succ(Succ); + SaveAndRestore save_continue(ContinueJumpTarget), + save_break(BreakJumpTarget); // Add an intermediate block between the BodyBlock and the // EntryConditionBlock to represent the "loop back" transition, for looping @@ -3852,7 +3852,7 @@ // Save local scope position because in case of condition variable ScopePos // won't be restored when traversing AST. - SaveAndRestore<LocalScope::const_iterator> save_scope_pos(ScopePos); + SaveAndRestore save_scope_pos(ScopePos); // Create local scope for possible condition variable. // Store scope position for continue statement. @@ -3881,9 +3881,9 @@ assert(W->getBody()); // Save the current values for Block, Succ, continue and break targets. - SaveAndRestore<CFGBlock*> save_Block(Block), save_Succ(Succ); - SaveAndRestore<JumpTarget> save_continue(ContinueJumpTarget), - save_break(BreakJumpTarget); + SaveAndRestore save_Block(Block), save_Succ(Succ); + SaveAndRestore save_continue(ContinueJumpTarget), + save_break(BreakJumpTarget); // Create an empty block to represent the transition block for looping back // to the head of the loop. @@ -4009,7 +4009,7 @@ // Save local scope position because in case of exception variable ScopePos // won't be restored when traversing AST. - SaveAndRestore<LocalScope::const_iterator> save_scope_pos(ScopePos); + SaveAndRestore save_scope_pos(ScopePos); if (CS->getCatchBody()) addStmt(CS->getCatchBody()); @@ -4104,7 +4104,7 @@ Succ = TrySuccessor; // Save the current "try" context. - SaveAndRestore<CFGBlock *> SaveTry(TryTerminatedBlock, NewTryTerminatedBlock); + SaveAndRestore SaveTry(TryTerminatedBlock, NewTryTerminatedBlock); cfg->addTryDispatchBlock(TryTerminatedBlock); assert(Terminator->getTryBody() && "try must contain a non-NULL body"); @@ -4207,8 +4207,8 @@ assert(D->getBody()); // Save the current values for Block, Succ, and continue and break targets - SaveAndRestore<CFGBlock*> save_Block(Block), save_Succ(Succ); - SaveAndRestore<JumpTarget> save_continue(ContinueJumpTarget), + SaveAndRestore save_Block(Block), save_Succ(Succ); + SaveAndRestore save_continue(ContinueJumpTarget), save_break(BreakJumpTarget); // All continues within this loop should go to the condition block @@ -4326,7 +4326,7 @@ // Save local scope position because in case of condition variable ScopePos // won't be restored when traversing AST. - SaveAndRestore<LocalScope::const_iterator> save_scope_pos(ScopePos); + SaveAndRestore save_scope_pos(ScopePos); // Create local scope for C++17 switch init-stmt if one exists. if (Stmt *Init = Terminator->getInit()) @@ -4346,9 +4346,9 @@ } else SwitchSuccessor = Succ; // Save the current "switch" context. - SaveAndRestore<CFGBlock*> save_switch(SwitchTerminatedBlock), - save_default(DefaultCaseBlock); - SaveAndRestore<JumpTarget> save_break(BreakJumpTarget); + SaveAndRestore save_switch(SwitchTerminatedBlock), + save_default(DefaultCaseBlock); + SaveAndRestore save_break(BreakJumpTarget); // Set the "default" case to be the block after the switch statement. If the // switch statement contains a "default:", this value will be overwritten with @@ -4371,15 +4371,13 @@ // For pruning unreachable case statements, save the current state // for tracking the condition value. - SaveAndRestore<bool> save_switchExclusivelyCovered(switchExclusivelyCovered, - false); + SaveAndRestore save_switchExclusivelyCovered(switchExclusivelyCovered, false); // Determine if the switch condition can be explicitly evaluated. assert(Terminator->getCond() && "switch condition must be non-NULL"); Expr::EvalResult result; bool b = tryEvaluate(Terminator->getCond(), result); - SaveAndRestore<Expr::EvalResult*> save_switchCond(switchCond, - b ? &result : nullptr); + SaveAndRestore save_switchCond(switchCond, b ? &result : nullptr); // If body is not a compound statement create implicit scope // and add destructors. @@ -4606,7 +4604,7 @@ Succ = TrySuccessor; // Save the current "try" context. - SaveAndRestore<CFGBlock *> SaveTry(TryTerminatedBlock, NewTryTerminatedBlock); + SaveAndRestore SaveTry(TryTerminatedBlock, NewTryTerminatedBlock); cfg->addTryDispatchBlock(TryTerminatedBlock); assert(Terminator->getTryBlock() && "try must contain a non-NULL body"); @@ -4620,7 +4618,7 @@ // Save local scope position because in case of exception variable ScopePos // won't be restored when traversing AST. - SaveAndRestore<LocalScope::const_iterator> save_scope_pos(ScopePos); + SaveAndRestore save_scope_pos(ScopePos); // Create local scope for possible exception variable. // Store scope position. Add implicit destructor. @@ -4672,7 +4670,7 @@ // } // Save local scope position before the addition of the implicit variables. - SaveAndRestore<LocalScope::const_iterator> save_scope_pos(ScopePos); + SaveAndRestore save_scope_pos(ScopePos); // Create local scopes and destructors for range, begin and end variables. if (Stmt *Range = S->getRangeStmt()) @@ -4697,7 +4695,7 @@ // Save the current value for the break targets. // All breaks should go to the code following the loop. - SaveAndRestore<JumpTarget> save_break(BreakJumpTarget); + SaveAndRestore save_break(BreakJumpTarget); BreakJumpTarget = JumpTarget(LoopSuccessor, ScopePos); // The block for the __begin != __end expression. @@ -4730,8 +4728,8 @@ assert(S->getBody()); // Save the current values for Block, Succ, and continue targets. - SaveAndRestore<CFGBlock*> save_Block(Block), save_Succ(Succ); - SaveAndRestore<JumpTarget> save_continue(ContinueJumpTarget); + SaveAndRestore save_Block(Block), save_Succ(Succ); + SaveAndRestore save_continue(ContinueJumpTarget); // Generate increment code in its own basic block. This is the target of // continue statements. Index: clang/lib/Analysis/AnalysisDeclContext.cpp =================================================================== --- clang/lib/Analysis/AnalysisDeclContext.cpp +++ clang/lib/Analysis/AnalysisDeclContext.cpp @@ -231,8 +231,7 @@ CFG *AnalysisDeclContext::getUnoptimizedCFG() { if (!builtCompleteCFG) { - SaveAndRestore<bool> NotPrune(cfgBuildOptions.PruneTriviallyFalseEdges, - false); + SaveAndRestore NotPrune(cfgBuildOptions.PruneTriviallyFalseEdges, false); completeCFG = CFG::buildCFG(D, getBody(), &D->getASTContext(), cfgBuildOptions); // Even when the cfg is not successfully built, we don't Index: clang/lib/AST/TypePrinter.cpp =================================================================== --- clang/lib/AST/TypePrinter.cpp +++ clang/lib/AST/TypePrinter.cpp @@ -195,7 +195,7 @@ return; } - SaveAndRestore<bool> PHVal(HasEmptyPlaceHolder, PlaceHolder.empty()); + SaveAndRestore PHVal(HasEmptyPlaceHolder, PlaceHolder.empty()); printBefore(T, Quals, OS); OS << PlaceHolder; @@ -319,7 +319,7 @@ if (Policy.SuppressSpecifiers && T->isSpecifierType()) return; - SaveAndRestore<bool> PrevPHIsEmpty(HasEmptyPlaceHolder); + SaveAndRestore PrevPHIsEmpty(HasEmptyPlaceHolder); // Print qualifiers as appropriate. @@ -396,7 +396,7 @@ void TypePrinter::printPointerBefore(const PointerType *T, raw_ostream &OS) { IncludeStrongLifetimeRAII Strong(Policy); - SaveAndRestore<bool> NonEmptyPH(HasEmptyPlaceHolder, false); + SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder, false); printBefore(T->getPointeeType(), OS); // Handle things like 'int (*A)[4];' correctly. // FIXME: this should include vectors, but vectors use attributes I guess. @@ -407,7 +407,7 @@ void TypePrinter::printPointerAfter(const PointerType *T, raw_ostream &OS) { IncludeStrongLifetimeRAII Strong(Policy); - SaveAndRestore<bool> NonEmptyPH(HasEmptyPlaceHolder, false); + SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder, false); // Handle things like 'int (*A)[4];' correctly. // FIXME: this should include vectors, but vectors use attributes I guess. if (isa<ArrayType>(T->getPointeeType())) @@ -417,14 +417,14 @@ void TypePrinter::printBlockPointerBefore(const BlockPointerType *T, raw_ostream &OS) { - SaveAndRestore<bool> NonEmptyPH(HasEmptyPlaceHolder, false); + SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder, false); printBefore(T->getPointeeType(), OS); OS << '^'; } void TypePrinter::printBlockPointerAfter(const BlockPointerType *T, raw_ostream &OS) { - SaveAndRestore<bool> NonEmptyPH(HasEmptyPlaceHolder, false); + SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder, false); printAfter(T->getPointeeType(), OS); } @@ -439,7 +439,7 @@ void TypePrinter::printLValueReferenceBefore(const LValueReferenceType *T, raw_ostream &OS) { IncludeStrongLifetimeRAII Strong(Policy); - SaveAndRestore<bool> NonEmptyPH(HasEmptyPlaceHolder, false); + SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder, false); QualType Inner = skipTopLevelReferences(T->getPointeeTypeAsWritten()); printBefore(Inner, OS); // Handle things like 'int (&A)[4];' correctly. @@ -452,7 +452,7 @@ void TypePrinter::printLValueReferenceAfter(const LValueReferenceType *T, raw_ostream &OS) { IncludeStrongLifetimeRAII Strong(Policy); - SaveAndRestore<bool> NonEmptyPH(HasEmptyPlaceHolder, false); + SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder, false); QualType Inner = skipTopLevelReferences(T->getPointeeTypeAsWritten()); // Handle things like 'int (&A)[4];' correctly. // FIXME: this should include vectors, but vectors use attributes I guess. @@ -464,7 +464,7 @@ void TypePrinter::printRValueReferenceBefore(const RValueReferenceType *T, raw_ostream &OS) { IncludeStrongLifetimeRAII Strong(Policy); - SaveAndRestore<bool> NonEmptyPH(HasEmptyPlaceHolder, false); + SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder, false); QualType Inner = skipTopLevelReferences(T->getPointeeTypeAsWritten()); printBefore(Inner, OS); // Handle things like 'int (&&A)[4];' correctly. @@ -477,7 +477,7 @@ void TypePrinter::printRValueReferenceAfter(const RValueReferenceType *T, raw_ostream &OS) { IncludeStrongLifetimeRAII Strong(Policy); - SaveAndRestore<bool> NonEmptyPH(HasEmptyPlaceHolder, false); + SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder, false); QualType Inner = skipTopLevelReferences(T->getPointeeTypeAsWritten()); // Handle things like 'int (&&A)[4];' correctly. // FIXME: this should include vectors, but vectors use attributes I guess. @@ -489,7 +489,7 @@ void TypePrinter::printMemberPointerBefore(const MemberPointerType *T, raw_ostream &OS) { IncludeStrongLifetimeRAII Strong(Policy); - SaveAndRestore<bool> NonEmptyPH(HasEmptyPlaceHolder, false); + SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder, false); printBefore(T->getPointeeType(), OS); // Handle things like 'int (Cls::*A)[4];' correctly. // FIXME: this should include vectors, but vectors use attributes I guess. @@ -506,7 +506,7 @@ void TypePrinter::printMemberPointerAfter(const MemberPointerType *T, raw_ostream &OS) { IncludeStrongLifetimeRAII Strong(Policy); - SaveAndRestore<bool> NonEmptyPH(HasEmptyPlaceHolder, false); + SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder, false); // Handle things like 'int (Cls::*A)[4];' correctly. // FIXME: this should include vectors, but vectors use attributes I guess. if (isa<ArrayType>(T->getPointeeType())) @@ -848,7 +848,7 @@ OS << '('; } else { // If needed for precedence reasons, wrap the inner part in grouping parens. - SaveAndRestore<bool> PrevPHIsEmpty(HasEmptyPlaceHolder, false); + SaveAndRestore PrevPHIsEmpty(HasEmptyPlaceHolder, false); printBefore(T->getReturnType(), OS); if (!PrevPHIsEmpty.get()) OS << '('; @@ -876,7 +876,7 @@ // If needed for precedence reasons, wrap the inner part in grouping parens. if (!HasEmptyPlaceHolder) OS << ')'; - SaveAndRestore<bool> NonEmptyPH(HasEmptyPlaceHolder, false); + SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder, false); OS << '('; { @@ -1027,7 +1027,7 @@ void TypePrinter::printFunctionNoProtoBefore(const FunctionNoProtoType *T, raw_ostream &OS) { // If needed for precedence reasons, wrap the inner part in grouping parens. - SaveAndRestore<bool> PrevPHIsEmpty(HasEmptyPlaceHolder, false); + SaveAndRestore PrevPHIsEmpty(HasEmptyPlaceHolder, false); printBefore(T->getReturnType(), OS); if (!PrevPHIsEmpty.get()) OS << '('; @@ -1038,7 +1038,7 @@ // If needed for precedence reasons, wrap the inner part in grouping parens. if (!HasEmptyPlaceHolder) OS << ')'; - SaveAndRestore<bool> NonEmptyPH(HasEmptyPlaceHolder, false); + SaveAndRestore NonEmptyPH(HasEmptyPlaceHolder, false); OS << "()"; printFunctionAfter(T->getExtInfo(), OS); @@ -1676,7 +1676,7 @@ // If this is a calling convention attribute, don't print the implicit CC from // the modified type. - SaveAndRestore<bool> MaybeSuppressCC(InsideCCAttribute, T->isCallingConv()); + SaveAndRestore MaybeSuppressCC(InsideCCAttribute, T->isCallingConv()); printAfter(T->getModifiedType(), OS); Index: clang/lib/AST/ExprConstant.cpp =================================================================== --- clang/lib/AST/ExprConstant.cpp +++ clang/lib/AST/ExprConstant.cpp @@ -7961,8 +7961,8 @@ bool VisitStmtExpr(const StmtExpr *E) { // We will have checked the full-expressions inside the statement expression // when they were completed, and don't need to check them again now. - llvm::SaveAndRestore<bool> NotCheckingForUB( - Info.CheckingForUndefinedBehavior, false); + llvm::SaveAndRestore NotCheckingForUB(Info.CheckingForUndefinedBehavior, + false); const CompoundStmt *CS = E->getSubStmt(); if (CS->body_empty()) Index: clang/lib/ARCMigrate/TransGCAttrs.cpp =================================================================== --- clang/lib/ARCMigrate/TransGCAttrs.cpp +++ clang/lib/ARCMigrate/TransGCAttrs.cpp @@ -46,7 +46,7 @@ if (!D || D->isImplicit()) return true; - SaveAndRestore<bool> Save(FullyMigratable, isMigratable(D)); + SaveAndRestore Save(FullyMigratable, isMigratable(D)); if (ObjCPropertyDecl *PropD = dyn_cast<ObjCPropertyDecl>(D)) { lookForAttribute(PropD, PropD->getTypeSourceInfo()); Index: clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp +++ clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp @@ -567,7 +567,7 @@ if (Check->reportDeMorgan(Context, Op, BinaryOp, !IsProcessing, parent(), Parens) && !Check->areDiagsSelfContained()) { - llvm::SaveAndRestore<bool> RAII(IsProcessing, true); + llvm::SaveAndRestore RAII(IsProcessing, true); return Base::TraverseUnaryOperator(Op); } }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits