[PATCH] D19842: In openFileForRead, attempt to fetch the actual name of the file on disk -- including case -- so that clang can later warn about non-portable #include and #import directives.

Eric Niebler via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 2 15:53:18 PDT 2016


eric_niebler added inline comments.

================
Comment at: lib/Support/Unix/Path.inc:553
@@ +552,3 @@
+namespace {
+  bool hasProcSelfFD() {
+    // If we have a /proc filesystem mounted, we ca quickly establish the
----------------
bruno wrote:
> I would rather just have this logic inlined in the call site below.
It's called from 2 places. Aside from DRY, putting the initialization of the static local in one plac means the `"/proc"` is only looked up once per process.

================
Comment at: lib/Support/Unix/Path.inc:556
@@ +555,3 @@
+    // real name of the file with readlink
+    static const bool Result = (0 == ::access("/proc/self/fd", R_OK));
+    return Result;
----------------
bruno wrote:
> It's more common in LLVM to use a integer literal in the RHS of the comparison, can you change this here and elsewhere in the patch? 
I can do that, but in general I prefer putting the constant on the LHS in case I accidentally type `=` instead of `==` (although it doesn't matter here).


http://reviews.llvm.org/D19842





More information about the llvm-commits mailing list