Skip to content

[RemoveDIs] Update syntax highlighting to include debug records #93660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions llvm/utils/emacs/llvm-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@
`(,(regexp-opt '("extractvalue" "insertvalue") 'symbols) . font-lock-keyword-face)
;; Metadata types
`(,(regexp-opt '("distinct") 'symbols) . font-lock-keyword-face)
;; Debug records
`(,(concat "#" (regexp-opt '("dbg_assign" "dbg_declare" "dbg_label" "dbg_value") 'symbols)) . font-lock-keyword-face)
;; Atomic memory ordering constraints
`(,(regexp-opt '("unordered" "monotonic" "acquire" "release" "acq_rel" "seq_cst") 'symbols) . font-lock-keyword-face)
;; Fast-math flags
Expand Down
3 changes: 3 additions & 0 deletions llvm/utils/vim/syntax/llvm.vim
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ syn keyword llvmStatement sle slt srem store sub switch trunc udiv ueq uge ugt
syn keyword llvmStatement uitofp ule ult umax umin une uno unreachable unwind
syn keyword llvmStatement urem va_arg xchg xor zext

" Debug records.
syn match llvmStatement /\v#dbg_(assign|declare|label|value)/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's \v, and why do we need to wrap in /? (Not familiar with this stuff)

Copy link
Contributor

@felipepiovezan felipepiovezan May 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ is just what you type in vim when you're about to start a search
\v is to control the "very magic" behaviour of regex spelling:

Vim's default 'magic' setting makes characters have the same meaning as in grep, and \v (very magic) makes them the same as the extended regular expressions used by egrep.

In practice, it means fewer escape sequences for the regex operators


" Keywords.
syn keyword llvmKeyword
\ acq_rel
Expand Down
3 changes: 2 additions & 1 deletion llvm/utils/vscode/llvm/syntaxes/ll.tmLanguage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ patterns:
captures:
1:
name: storage.type.llvm
- match: "\\badd\\b|\
- match: "(?<=\\s|^)#dbg_(assign|declare|label|value)\\b|\
\\badd\\b|\
\\baddrspacecast\\b|\
\\balloca\\b|\
\\band\\b|\
Expand Down
Loading