[all-commits] [llvm/llvm-project] f33c2c: Fix crash on `user defined literals`

Eduardo Caldas via All-commits all-commits at lists.llvm.org
Fri Jul 10 09:21:35 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: f33c2c27a8d4ea831aa7c2c2649066be91318d85
      https://github.com/llvm/llvm-project/commit/f33c2c27a8d4ea831aa7c2c2649066be91318d85
  Author: Eduardo Caldas <ecaldas at google.com>
  Date:   2020-07-10 (Fri, 10 Jul 2020)

  Changed paths:
    M clang/include/clang/Tooling/Syntax/Nodes.h
    M clang/lib/Tooling/Syntax/BuildTree.cpp
    M clang/lib/Tooling/Syntax/Nodes.cpp
    M clang/unittests/Tooling/Syntax/TreeTest.cpp

  Log Message:
  -----------
  Fix crash on `user defined literals`

Summary:
Given an UserDefinedLiteral `1.2_w`:
Problem: Lexer generates one Token for the literal, but ClangAST
references two source locations
Fix: Ignore the operator and interpret it as the underlying literal.
e.g.: `1.2_w` token generates syntax node IntegerLiteral(1.2_w)

Subscribers: cfe-commits

Tags: #clang

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


  Commit: 1db5b348c4c93b6610afb4fd515b389989efc302
      https://github.com/llvm/llvm-project/commit/1db5b348c4c93b6610afb4fd515b389989efc302
  Author: Eduardo Caldas <ecaldas at google.com>
  Date:   2020-07-10 (Fri, 10 Jul 2020)

  Changed paths:
    M clang/include/clang/Tooling/Syntax/Nodes.h
    M clang/lib/Tooling/Syntax/BuildTree.cpp
    M clang/lib/Tooling/Syntax/Nodes.cpp
    M clang/unittests/Tooling/Syntax/TreeTest.cpp

  Log Message:
  -----------
  Add kinded UDL for raw literal operator and  numeric literal operator template


  Commit: a474d5bae4773782d50d4a5a62300c0f4a2dff28
      https://github.com/llvm/llvm-project/commit/a474d5bae4773782d50d4a5a62300c0f4a2dff28
  Author: Eduardo Caldas <ecaldas at google.com>
  Date:   2020-07-10 (Fri, 10 Jul 2020)

  Changed paths:
    M clang/lib/Tooling/Syntax/BuildTree.cpp

  Log Message:
  -----------
  Use FileRange::text instead of Lexer::getSpelling

* as we are using them only for integer and floating literals they have
the same behavior
* FileRange::text is simpler to call and is within the context of
syntax trees


Compare: https://github.com/llvm/llvm-project/compare/e5123ea248eb...a474d5bae477


More information about the All-commits mailing list