[PATCH] D78202: [FileCheck] - Refactor the code related to string arrays. NFCI.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 01:35:18 PDT 2020


grimar marked an inline comment as done.
grimar added inline comments.


================
Comment at: llvm/utils/FileCheck/FileCheck.cpp:539
+  // is probably a bit subtle. So we copy strings instead.
+  BumpPtrAllocator StrAlloc;
+  for (StringRef Prefix : CheckPrefixes)
----------------
MaskRay wrote:
> `--check-prefix`, `--implicit-check-not` and `-D` are by no means performance/memory usage critical... Using a `BumpPtrAllocator` does not seem to improve the code ?
> 
> Can other cleanups in this patch be retained if you don't change the 3 variables to `std::vector<StringRef>`?
I think having

```
  std::vector<StringRef> CheckPrefixes;
  std::vector<StringRef> ImplicitCheckNot;
  std::vector<StringRef> GlobalDefines;
```

instead of  

```
  std::vector<std::string> CheckPrefixes;
  std::vector<std::string> ImplicitCheckNot;
  std::vector<std::string> GlobalDefines;
```

Improves the code by itself as readers should not think about why "std::string" was used.
We can revert to the previous revision of the patch as it works fine even without
adding a "BumpPtrAllocator".


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78202/new/

https://reviews.llvm.org/D78202





More information about the llvm-commits mailing list