================ @@ -0,0 +1,56 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "DeprecatedPosixFunctionsCheck.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" +#include "llvm/ADT/StringSwitch.h" + +using namespace clang::ast_matchers; +using namespace llvm; + +namespace clang::tidy::portability { + +static constexpr StringRef DeprecatedFunctionId = "DeprecatedFunctions"; +static constexpr StringRef DeclRefId = "DRE"; + +static StringRef getReplacementFor(StringRef FunctionName) { + // TODO: Suggest Annex K replacements when available. + return StringSwitch<StringRef>(FunctionName) + .Case("bcmp", "memcmp") + .Case("bcopy", "memmove") + .Case("bzero", "memset") + .Case("getpw", "getpwuid") + .Case("vfork", "posix_spawn") + .Default({}); ---------------- zwuis wrote:
Use `DefaultUnreachable` or drop calling `Default`. https://github.com/llvm/llvm-project/pull/195641 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
