Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: startswith() is deprecated: Use starts_with instead #5002

Merged
merged 1 commit into from
May 19, 2024

Conversation

Rtoax
Copy link
Contributor

@Rtoax Rtoax commented May 14, 2024

llvm [0] startswith() is deprecated in commit 5ac12951b4e9 ("[ADT] Deprecate StringRef::{starts,ends}with (#75491)"), and it's totally removed in commit 4ec9a662d388 ("[ADT] Remove StringRef::{startswith,endswith} (#89548)").

Warning detail:

$ make
[...]
/home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc:341:37: warning: ‘bool llvm::StringRef::startswith(llvm::StringRef) const’ is deprecated: Use starts_with instead [-Wdeprecated-declarations]
  341 |         if (!A->getName().startswith("maps"))
      |              ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
In file included from /usr/include/clang/Basic/DiagnosticIDs.h:19,
                 from /usr/include/clang/Basic/Diagnostic.h:17,
                 from /usr/include/clang/AST/NestedNameSpecifier.h:18,
                 from /usr/include/clang/AST/Type.h:21,
                 from /usr/include/clang/AST/CanonicalType.h:17,
                 from /usr/include/clang/AST/ASTContext.h:18,
                 from /home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc:23:
/usr/include/llvm/ADT/StringRef.h:263:29: note: declared here
  263 |         "starts_with") bool startswith(StringRef Prefix) const {
      |                             ^~~~~~~~~~
/home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc: In member function ‘bool ebpf::ProbeVisitor::assignsExtPtr(clang::Expr*, int*)’:
/home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc:393:39: warning: ‘bool llvm::StringRef::startswith(llvm::StringRef) const’ is deprecated: Use starts_with instead [-Wdeprecated-declarations]
  393 |           if (!A->getName().startswith("maps"))
      |                ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/usr/include/llvm/ADT/StringRef.h:263:29: note: declared here
  263 |         "starts_with") bool startswith(StringRef Prefix) const {
      |                             ^~~~~~~~~~
/home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc: In member function ‘bool ebpf::BTypeVisitor::VisitCallExpr(clang::CallExpr*)’:
/home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc:940:37: warning: ‘bool llvm::StringRef::startswith(llvm::StringRef) const’ is deprecated: Use starts_with instead [-Wdeprecated-declarations]
  940 |         if (!A->getName().startswith("maps"))
      |              ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/usr/include/llvm/ADT/StringRef.h:263:29: note: declared here
  263 |         "starts_with") bool startswith(StringRef Prefix) const {
      |                             ^~~~~~~~~~
/home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc: In member function ‘bool ebpf::BTypeVisitor::VisitVarDecl(clang::VarDecl*)’:
/home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc:1458:33: warning: ‘bool llvm::StringRef::startswith(llvm::StringRef) const’ is deprecated: Use starts_with instead [-Wdeprecated-declarations]
 1458 |     if (!A->getName().startswith("maps"))
      |          ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/usr/include/llvm/ADT/StringRef.h:263:29: note: declared here
  263 |         "starts_with") bool startswith(StringRef Prefix) const {
      |                             ^~~~~~~~~~
[ 73%] Built target clang_frontend-objects

[0] https://github.com/llvm/llvm-project

llvm [0] startswith() is deprecated in commit 5ac12951b4e9 ("[ADT] Deprecate
StringRef::{starts,ends}with (#75491)"), and it's totally removed in
commit 4ec9a662d388 ("[ADT] Remove StringRef::{startswith,endswith} (#89548)").

Warning detail:

    $ make
    [...]
    /home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc:341:37: warning: ‘bool llvm::StringRef::startswith(llvm::StringRef) const’ is deprecated: Use starts_with instead [-Wdeprecated-declarations]
      341 |         if (!A->getName().startswith("maps"))
          |              ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
    In file included from /usr/include/clang/Basic/DiagnosticIDs.h:19,
                     from /usr/include/clang/Basic/Diagnostic.h:17,
                     from /usr/include/clang/AST/NestedNameSpecifier.h:18,
                     from /usr/include/clang/AST/Type.h:21,
                     from /usr/include/clang/AST/CanonicalType.h:17,
                     from /usr/include/clang/AST/ASTContext.h:18,
                     from /home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc:23:
    /usr/include/llvm/ADT/StringRef.h:263:29: note: declared here
      263 |         "starts_with") bool startswith(StringRef Prefix) const {
          |                             ^~~~~~~~~~
    /home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc: In member function ‘bool ebpf::ProbeVisitor::assignsExtPtr(clang::Expr*, int*)’:
    /home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc:393:39: warning: ‘bool llvm::StringRef::startswith(llvm::StringRef) const’ is deprecated: Use starts_with instead [-Wdeprecated-declarations]
      393 |           if (!A->getName().startswith("maps"))
          |                ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
    /usr/include/llvm/ADT/StringRef.h:263:29: note: declared here
      263 |         "starts_with") bool startswith(StringRef Prefix) const {
          |                             ^~~~~~~~~~
    /home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc: In member function ‘bool ebpf::BTypeVisitor::VisitCallExpr(clang::CallExpr*)’:
    /home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc:940:37: warning: ‘bool llvm::StringRef::startswith(llvm::StringRef) const’ is deprecated: Use starts_with instead [-Wdeprecated-declarations]
      940 |         if (!A->getName().startswith("maps"))
          |              ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
    /usr/include/llvm/ADT/StringRef.h:263:29: note: declared here
      263 |         "starts_with") bool startswith(StringRef Prefix) const {
          |                             ^~~~~~~~~~
    /home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc: In member function ‘bool ebpf::BTypeVisitor::VisitVarDecl(clang::VarDecl*)’:
    /home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc:1458:33: warning: ‘bool llvm::StringRef::startswith(llvm::StringRef) const’ is deprecated: Use starts_with instead [-Wdeprecated-declarations]
     1458 |     if (!A->getName().startswith("maps"))
          |          ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
    /usr/include/llvm/ADT/StringRef.h:263:29: note: declared here
      263 |         "starts_with") bool startswith(StringRef Prefix) const {
          |                             ^~~~~~~~~~
    [ 73%] Built target clang_frontend-objects

[0] https://github.com/llvm/llvm-project

Signed-off-by: Xue Yuehua <2482887395@qq.com>
Signed-off-by: Rong Tao <rongtao@cestc.cn>
@yonghong-song yonghong-song merged commit 8caf040 into iovisor:master May 19, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants