[all-commits] [llvm/llvm-project] 146d68: clang-format: [JS] detect C++ keywords.

Martin Probst via All-commits all-commits at lists.llvm.org
Fri Apr 3 05:24:04 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 146d685cd657399a4698015f16cc5910cc828728
      https://github.com/llvm/llvm-project/commit/146d685cd657399a4698015f16cc5910cc828728
  Author: Martin Probst <martin at probst.io>
  Date:   2020-04-03 (Fri, 03 Apr 2020)

  Changed paths:
    M clang/lib/Format/FormatToken.h
    M clang/lib/Format/TokenAnnotator.cpp
    M clang/unittests/Format/FormatTestJS.cpp

  Log Message:
  -----------
  clang-format: [JS] detect C++ keywords.

Summary:
C++ defines a number of keywords that are regular identifiers in
JavaScript, e.g. `concept`:

    const concept = 1; // legit JS

This change expands the existing `IsJavaScriptIdentifier(Tok)` function
to return false for C++ keywords that aren't keywords in JS.

Reviewers: krasimir

Subscribers: jfb, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77311




More information about the All-commits mailing list