[GlobPattern] add AsLiteral to help lld determine if a symbol is literal (#215854)
lld determines if a `symbolName` is literal by `find_first_of("*?[]")`,
which is not accurate and ignored escape characters, we do the
following:
1. Add a new API `std::optional<std::string> asLiteral(...)` that dumps
the pattern as a literal string if it is one.
2. All `symbolNames` are considered as `GlobPattern` first to leverage
`asLeteral` to help us determine if a string is a literal. The quick
path in during `GlobPattern` construction is `if
(!S.find_first_of(PrefixMetas)) return Pat;`, so for strings without
`*?[]` (most of the `symbolName`s), the performance should be about the
same.
3. `symbolName`s that are literal go back to hashing like lld did before
Added tests in lld and unit test for GlobPattern
---------
Co-authored-by: Ellis Hoag <ellis.sparky.hoag@gmail.com>