Skip to content

[Support] Don't use StringRef::equals in Path.inc #98839

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

Merged
merged 1 commit into from
Jul 14, 2024

Conversation

rorth
Copy link
Collaborator

@rorth rorth commented Jul 14, 2024

The removal of StringRef::equals in
3fa409f broke the Solaris/sparcv9 and Solaris/amd64 buildbots:

In file included from /vol/llvm/src/llvm-project/git/llvm/lib/Support/Path.cpp:1200:
/vol/llvm/src/llvm-project/git/llvm/lib/Support/Unix/Path.inc:519:18: error: no member named 'equals' in 'llvm::StringRef'
  519 |   return !fstype.equals("nfs");
      |           ~~~~~~ ^

Fixed by switching to operator!= instead.

Tested on sparcv9-sun-solaris2.11 and amd64-pc-solaris2.11.

The removal of StringRef::equals in
3fa409f broke the
[Solaris/sparcv9](https://lab.llvm.org/buildbot/#/builders/13/builds/724)
and [Solaris/amd64](https://lab.llvm.org/staging/#/builders/94/builds/5176)
buildbots:
```
In file included from /vol/llvm/src/llvm-project/git/llvm/lib/Support/Path.cpp:1200:
/vol/llvm/src/llvm-project/git/llvm/lib/Support/Unix/Path.inc:519:18: error: no member named 'equals' in 'llvm::StringRef'
  519 |   return !fstype.equals("nfs");
      |           ~~~~~~ ^
```

Fixed by switching to `operator!=` instead.

Tested on sparcv9-sun-solaris2.11 and amd64-pc-solaris2.11.
@llvmbot
Copy link
Member

llvmbot commented Jul 14, 2024

@llvm/pr-subscribers-llvm-support

Author: Rainer Orth (rorth)

Changes

The removal of StringRef::equals in
3fa409f broke the Solaris/sparcv9 and Solaris/amd64 buildbots:

In file included from /vol/llvm/src/llvm-project/git/llvm/lib/Support/Path.cpp:1200:
/vol/llvm/src/llvm-project/git/llvm/lib/Support/Unix/Path.inc:519:18: error: no member named 'equals' in 'llvm::StringRef'
  519 |   return !fstype.equals("nfs");
      |           ~~~~~~ ^

Fixed by switching to operator!= instead.

Tested on sparcv9-sun-solaris2.11 and amd64-pc-solaris2.11.


Full diff: https://github.com/llvm/llvm-project/pull/98839.diff

1 Files Affected:

  • (modified) llvm/lib/Support/Unix/Path.inc (+1-1)
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index 6e679f74869f0..cf05db546e021 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -516,7 +516,7 @@ static bool is_local_impl(struct STATVFS &Vfs) {
   // target
   StringRef fstype(Vfs.f_basetype);
   // NFS is the only non-local fstype??
-  return !fstype.equals("nfs");
+  return fstype != "nfs";
 #elif defined(_AIX)
   // Call mntctl; try more than twice in case of timing issues with a concurrent
   // mount.

@rorth rorth merged commit 0fc4e30 into llvm:main Jul 14, 2024
6 of 9 checks passed
@rorth
Copy link
Collaborator Author

rorth commented Jul 14, 2024

Committed to unbreak the builds.

@kazutakahirata
Copy link
Contributor

Thanks!

@dwblaikie
Copy link
Collaborator

(for future reference - a simple build fix like this is probably fine to commit without precommit review/without a pull request - but generally if you make a pull request you should wait until it's reviewed (creating a pull request amounts to saying "I'm not confident in this change and want a second set of eyes before I commit it" - so then committing it without that review seems problematic). If you only wanted to create the pull request to run automated presubmit checks, please create the PR with the skip-precommit-approval to indicate that)

@rorth
Copy link
Collaborator Author

rorth commented Jul 16, 2024

Thanks for the clarification. In the old days, before LLVM switched to pull requests, I'd just have committed the patch, especially in a case like this with an obvious patch to unbreak the build. However, I wasn't sure if this was appropriate in the new world, so meant to err on the side of caution while still restoring the build quickly.

Besides, I meant to alert Kazu, wondering if he'd missed the buildbot failure notification in [ADT] Remove StringRef::equals which wouldn't work with a simple commit.

Another advantage of the pull request route is that you get a verification of the description's markup.

If you only wanted to create the pull request to run automated presubmit checks, please create the PR with the skip-precommit-approval to indicate that)

That would be git commit --no-verify?

@dwblaikie
Copy link
Collaborator

Thanks for the clarification. In the old days, before LLVM switched to pull requests, I'd just have committed the patch, especially in a case like this with an obvious patch to unbreak the build. However, I wasn't sure if this was appropriate in the new world, so meant to err on the side of caution while still restoring the build quickly.

Yep yep, just mentioning that it is the same norms for now, pre or post switch to github PRs. Maybe one day we'll move to PRs only, but even then, hopefully something like a build fix will be relatively low-cost, maybe not require human review, etc.

Besides, I meant to alert Kazu, wondering if he'd missed the buildbot failure notification in [ADT] Remove StringRef::equals which wouldn't work with a simple commit.

Another advantage of the pull request route is that you get a verification of the description's markup.

If you only wanted to create the pull request to run automated presubmit checks, please create the PR with the skip-precommit-approval to indicate that)

That would be git commit --no-verify?

I don't think it's wired up to anything like that - something you can manually select in the web UI, maybe there's a way to add labels from the command line, but I'm not sure how.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants