[PATCH] D69313: Handle more crt*.o filename variants.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 22 23:12:29 PDT 2019


MaskRay added inline comments.


================
Comment at: lld/ELF/OutputSections.cpp:9
 
+#include <regex>
+
----------------
Place standard includes after llvm includes. clang-format can fix the problem.


================
Comment at: lld/ELF/OutputSections.cpp:397
+  s = llvm::sys::path::filename(s);
+  std::regex re(R"(^(clang_rt.)?crtbegin[ST]?[\-.*]?\.o$)");
+  return std::regex_match(s.data(), re);
----------------
ruiu wrote:
> ruiu wrote:
> > Add `static` so that the regex is compiled only once.
> Escaping dot?
> 
> ^(clang_rt\.)?
> 
> Also I blieve [\-.*]? has to be
> 
> (-.*)?
`^` and `$` can be deleted because `std::regex_match` checks the entire target character sequence.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D69313





More information about the llvm-commits mailing list