Index: lib/Basic/Targets.cpp =================================================================== --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -30,6 +30,7 @@ #include "llvm/Support/TargetParser.h" #include #include + using namespace clang; //===----------------------------------------------------------------------===// @@ -739,7 +740,7 @@ template class WebAssemblyOSTargetInfo : public OSTargetInfo { void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple, - MacroBuilder &Builder) const override final { + MacroBuilder &Builder) const final { // A common platform macro. if (Opts.POSIXThreads) Builder.defineMacro("_REENTRANT"); @@ -749,7 +750,7 @@ } // As an optimization, group static init code together in a section. - const char *getStaticInitSectionSpecifier() const override final { + const char *getStaticInitSectionSpecifier() const final { return ".text.__startup"; } @@ -7011,13 +7012,13 @@ Features["simd128"] = true; return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); } - bool hasFeature(StringRef Feature) const override final { + bool hasFeature(StringRef Feature) const final { return llvm::StringSwitch(Feature) .Case("simd128", SIMDLevel >= SIMD128) .Default(false); } bool handleTargetFeatures(std::vector &Features, - DiagnosticsEngine &Diags) override final { + DiagnosticsEngine &Diags) final { for (const auto &Feature : Features) { if (Feature == "+simd128") { SIMDLevel = std::max(SIMDLevel, SIMD128); @@ -7034,7 +7035,7 @@ } return true; } - bool setCPU(const std::string &Name) override final { + bool setCPU(const std::string &Name) final { return llvm::StringSwitch(Name) .Case("mvp", true) .Case("bleeding-edge", true) @@ -7042,32 +7043,32 @@ .Default(false); } void getTargetBuiltins(const Builtin::Info *&Records, - unsigned &NumRecords) const override final { + unsigned &NumRecords) const final { Records = BuiltinInfo; NumRecords = clang::WebAssembly::LastTSBuiltin - Builtin::FirstTSBuiltin; } - BuiltinVaListKind getBuiltinVaListKind() const override final { + BuiltinVaListKind getBuiltinVaListKind() const final { // TODO: Implement va_list properly. return VoidPtrBuiltinVaList; } void getGCCRegNames(const char *const *&Names, - unsigned &NumNames) const override final { + unsigned &NumNames) const final { Names = nullptr; NumNames = 0; } void getGCCRegAliases(const GCCRegAlias *&Aliases, - unsigned &NumAliases) const override final { + unsigned &NumAliases) const final { Aliases = nullptr; NumAliases = 0; } bool validateAsmConstraint(const char *&Name, - TargetInfo::ConstraintInfo &Info) const override final { + TargetInfo::ConstraintInfo &Info) const final { return false; } - const char *getClobbers() const override final { return ""; } - bool isCLZForZeroUndef() const override final { return false; } - bool hasInt128Type() const override final { return true; } + const char *getClobbers() const final { return ""; } + bool isCLZForZeroUndef() const final { return false; } + bool hasInt128Type() const final { return true; } }; const Builtin::Info WebAssemblyTargetInfo::BuiltinInfo[] = { Index: lib/CodeGen/CGOpenMPRuntime.cpp =================================================================== --- lib/CodeGen/CGOpenMPRuntime.cpp +++ lib/CodeGen/CGOpenMPRuntime.cpp @@ -59,7 +59,7 @@ virtual const VarDecl *getThreadIDVariable() const = 0; /// \brief Emit the captured statement body. - virtual void EmitBody(CodeGenFunction &CGF, const Stmt *S) override; + void EmitBody(CodeGenFunction &CGF, const Stmt *S) override; /// \brief Get an LValue for the current ThreadID variable. /// \return LValue for thread id variable. This LValue always has type int32*. @@ -156,7 +156,7 @@ return OuterRegionInfo->getContextValue(); llvm_unreachable("No context value for inlined OpenMP region"); } - virtual void setContextValue(llvm::Value *V) override { + void setContextValue(llvm::Value *V) override { if (OuterRegionInfo) { OuterRegionInfo->setContextValue(V); return; @@ -229,7 +229,7 @@ } }; -} // namespace +} // anonymous namespace LValue CGOpenMPRegionInfo::getThreadIDVariableLValue(CodeGenFunction &CGF) { return CGF.MakeNaturalAlignAddrLValue( @@ -1283,7 +1283,7 @@ CGF.EmitRuntimeCall(Callee, Args); } }; -} // namespace +} // anonymous namespace void CGOpenMPRuntime::emitCriticalRegion(CodeGenFunction &CGF, StringRef CriticalName, @@ -1831,7 +1831,7 @@ /// \brief Function with call of destructors for private variables. KmpTaskTDestructors, }; -} // namespace +} // anonymous namespace void CGOpenMPRuntime::emitKmpRoutineEntryT(QualType KmpInt32Ty) { if (!KmpRoutineEntryPtrTy) { @@ -1866,7 +1866,7 @@ const VarDecl *PrivateElemInit; }; typedef std::pair PrivateDataTy; -} // namespace +} // anonymous namespace static RecordDecl * createPrivatesRecordDecl(CodeGenModule &CGM, @@ -2910,4 +2910,3 @@ } } } - Index: lib/CodeGen/ObjectFilePCHContainerOperations.cpp =================================================================== --- lib/CodeGen/ObjectFilePCHContainerOperations.cpp +++ lib/CodeGen/ObjectFilePCHContainerOperations.cpp @@ -30,6 +30,7 @@ #include "llvm/Object/ObjectFile.h" #include "llvm/Support/TargetRegistry.h" #include + using namespace clang; #define DEBUG_TYPE "pchcontainer" @@ -139,7 +140,7 @@ CodeGenOpts.SplitDwarfFile = OutputFileName; } - virtual ~PCHContainerGenerator() {} + ~PCHContainerGenerator() override = default; void Initialize(ASTContext &Context) override { assert(!Ctx && "initialized multiple times"); @@ -254,7 +255,7 @@ } }; -} // namespace +} // anonymous namespace std::unique_ptr ObjectFilePCHContainerWriter::CreatePCHContainerGenerator( @@ -290,5 +291,4 @@ // As a fallback, treat the buffer as a raw AST. StreamFile.init((const unsigned char *)Buffer.getBufferStart(), (const unsigned char *)Buffer.getBufferEnd()); - return; } Index: lib/Driver/ToolChains.h =================================================================== --- lib/Driver/ToolChains.h +++ lib/Driver/ToolChains.h @@ -919,7 +919,7 @@ const llvm::opt::ArgList &Args); ~SHAVEToolChain() override; - virtual Tool *SelectTool(const JobAction &JA) const override; + Tool *SelectTool(const JobAction &JA) const override; protected: Tool *getTool(Action::ActionClass AC) const override; @@ -956,4 +956,4 @@ } // end namespace driver } // end namespace clang -#endif +#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_H Index: lib/Format/UnwrappedLineFormatter.cpp =================================================================== --- lib/Format/UnwrappedLineFormatter.cpp +++ lib/Format/UnwrappedLineFormatter.cpp @@ -606,7 +606,7 @@ /// \brief Puts all tokens into a single line. unsigned formatLine(const AnnotatedLine &Line, unsigned FirstIndent, - bool DryRun) { + bool DryRun) override { unsigned Penalty = 0; LineState State = Indenter->getInitialState(FirstIndent, &Line, DryRun); while (State.NextToken) { @@ -629,7 +629,7 @@ /// \brief Formats the line by finding the best line breaks with line lengths /// below the column limit. unsigned formatLine(const AnnotatedLine &Line, unsigned FirstIndent, - bool DryRun) { + bool DryRun) override { LineState State = Indenter->getInitialState(FirstIndent, &Line, DryRun); // If the ObjC method declaration does not fit on a line, we should format @@ -791,7 +791,7 @@ llvm::SpecificBumpPtrAllocator Allocator; }; -} // namespace +} // anonymous namespace unsigned UnwrappedLineFormatter::format(const SmallVectorImpl &Lines, Index: lib/Frontend/PCHContainerOperations.cpp =================================================================== --- lib/Frontend/PCHContainerOperations.cpp +++ lib/Frontend/PCHContainerOperations.cpp @@ -16,6 +16,7 @@ #include "llvm/Bitcode/BitstreamReader.h" #include "llvm/Support/raw_ostream.h" #include "clang/Lex/ModuleLoader.h" + using namespace clang; namespace { @@ -36,7 +37,7 @@ std::shared_ptr Buffer) : Buffer(Buffer), OS(OS) {} - virtual ~RawPCHContainerGenerator() {} + ~RawPCHContainerGenerator() override = default; void HandleTranslationUnit(ASTContext &Ctx) override { if (Buffer->IsComplete) { @@ -49,8 +50,9 @@ Buffer->Data = std::move(Empty); } }; -} +} // anonymous namespace + std::unique_ptr RawPCHContainerWriter::CreatePCHContainerGenerator( DiagnosticsEngine &Diags, const HeaderSearchOptions &HSO, const PreprocessorOptions &PPO, const TargetOptions &TO,