1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/unittests
Anirudh Prasad 129d906140 [AsmParser][ms][X86] Fix possible misbehaviour in parsing of special tokens at start of string.
- Previously, https://reviews.llvm.org/D72680 introduced a new attribute called `AllowSymbolAtNameStart` (in relation to the MAsmParser changes) in `MCAsmInfo.h` which (according to the comment in the header) allows the following behaviour:

```
  /// This is true if the assembler allows $ @ ? characters at the start of
  /// symbol names. Defaults to false.
```

- However, the usage of this field in AsmLexer.cpp doesn't seem completely accurate* for a couple of reasons.

```
  default:
    if (MAI.doesAllowSymbolAtNameStart()) {
      // Handle Microsoft-style identifier: [a-zA-Z_$.@?][a-zA-Z0-9_$.@#?]*
      if (!isDigit(CurChar) &&
          isIdentifierChar(CurChar, MAI.doesAllowAtInName(),
                           AllowHashInIdentifier))
        return LexIdentifier();
    }
```

1. The Dollar and At tokens, when occurring at the start of the string, are treated as separate tokens (AsmToken::Dollar and AsmToken::At respectively) and not lexed as an Identifier.
2. I'm not too sure why `MAI.doesAllowAtInName()` is used when `AllowAtInIdentifier` could be used. For X86 platforms, afaict, this shouldn't be an issue, since the `CommentString` attribute isn't "@". (alternatively the call to the setter can be set anywhere else as needed). The `AllowAtInName` does have an additional important meaning, but in the context of AsmLexer, shouldn't mean anything different compared to `AllowAtInIdentifier`

My proposal is the following:

- Introduce 3 new fields called `AllowQuestionTokenAtStartOfString`, `AllowDollarTokenAtStartOfString` and `AllowAtTokenAtStartOfString` in MCAsmInfo.h which will encapsulate the previously documented behaviour of "allowing $, @, ? characters at the start of symbol names")
- Introduce these fields where "$", "@" are lexed, and treat them as identifiers depending on whether `Allow[Dollar|At]TokenAtStartOfString` is set.
- For the sole case of "?", append it to the existing logic for treating a "default" token as an Identifier.

z/OS (HLASM) will also make use of some of these fields in follow up patches.

completely accurate* - This was based on the comments and the intended behaviour the code. I might have completely misinterpreted it, and if that is the case my sincere apologies. We can close this patch if necessary, if there are no changes to be made :)

Depends on https://reviews.llvm.org/D99374

Reviewed By: Jonathan.Crowther

Differential Revision: https://reviews.llvm.org/D99889
2021-04-21 10:21:09 -04:00
..
ADT [ARM][Driver][Windows] Allow command-line upgrade to Armv8. 2021-04-21 11:20:05 +01:00
Analysis [ValueTracking] match negative-stepping non-zero recurrence 2021-04-14 08:57:53 -04:00
AsmParser
BinaryFormat
Bitcode [AMDGPU] Set the default globals address space to 1 2020-11-20 15:46:53 +00:00
Bitstream Switch from llvm::is_trivially_copyable to std::is_trivially_copyable 2020-12-02 22:02:48 -08:00
CodeGen [GlobalISel] Allow different types for G_SBFX and G_UBFX operands 2021-04-02 11:11:06 -04:00
DebugInfo [DWARF] Fix crash for DWARFDie::dump. 2021-04-14 18:46:34 -07:00
Demangle * Fix demangling of optional template-args for vendor extended type qualifier. 2021-03-24 10:21:32 +04:00
ExecutionEngine [JITLink] Delete copy and move constructors for jitlink::Section. 2021-03-30 22:58:14 -07:00
FileCheck Fix PR46880: Fail CHECK-NOT with undefined variable 2021-04-20 14:42:46 +01:00
Frontend [OpenMP IRBuilder, MLIR] Add support for OpenMP do schedule dynamic 2021-04-16 16:09:49 +01:00
FuzzMutate [FuzzMutate] Add mutator to modify instruction flags. 2021-01-23 19:05:20 +00:00
InterfaceStub [llvm] Fix ODRViolations for VersionTuple YAML specializations NFC 2020-10-20 18:29:15 -07:00
IR [DebugInfo] Replace debug uses in replaceUsesOutsideBlock 2021-04-19 11:06:53 +01:00
LineEditor
Linker [RGT] Recode more unreachable assertions and tautologies 2021-03-19 09:17:22 -07:00
MC [AsmParser][ms][X86] Fix possible misbehaviour in parsing of special tokens at start of string. 2021-04-21 10:21:09 -04:00
MI [AMDGPU] Rename amdgcn_wwm to amdgcn_strict_wwm 2021-03-03 09:33:57 +01:00
Object [llvm-readelf] Support dumping the BB address map section with --bb-addr-map. 2021-03-08 16:20:11 -08:00
ObjectYAML
Option [clang][cli] Accept strings instead of options in ImpliedByAnyOf 2021-01-26 09:30:36 +01:00
Passes
ProfileData [SampleFDO] Support enabling -funique-internal-linkage-name. 2021-03-09 21:41:40 -08:00
Remarks
Support [Support] Don't include VirtualFileSystem.h in CommandLine.h 2021-04-21 10:19:01 -04:00
TableGen Revert "Make TableGenGlobalISel an object library" 2021-03-31 13:27:00 -07:00
Target [ARM] Remove new ARMSelectionDAGTest unittest. 2021-03-04 10:14:35 +00:00
TextAPI [TextAPI] move source code files out of subdirectory, NFC 2021-04-05 10:24:42 -07:00
tools [Support] Don't include VirtualFileSystem.h in CommandLine.h 2021-04-21 10:19:01 -04:00
Transforms [Support] Don't include VirtualFileSystem.h in CommandLine.h 2021-04-21 10:19:01 -04:00
XRay
CMakeLists.txt
unittest.cfg.in