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