[PATCH] D65938: [AST] No longer visiting CXXMethodDecl bodies created by compiler when method was default created.

Johan Vikström via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 8 04:11:20 PDT 2019


jvikstrom created this revision.
jvikstrom added reviewers: hokein, ilya-biryukov, gribozavr.
Herald added subscribers: cfe-commits, kadircet, arphaman, jkorous, mgorny.
Herald added a project: clang.

Clang generates function bodies and puts them in the AST for default methods if it is defaulted outside the class definition.

`
struct A {

  A &operator=(A &&O);

};

A &A::operator=(A &&O) = default;
`

This will generate a function body for the `A &A::operator=(A &&O)` and put it in the AST. This body should not be visited if implicit code is not visited as it is implicit.

This was causing SemanticHighlighting in clangd to generate duplicate tokens and putting them in weird places.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65938

Files:
  clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/unittests/Tooling/CMakeLists.txt
  clang/unittests/Tooling/RecursiveASTVisitorTests/CXXMethodDecl.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65938.214109.patch
Type: text/x-patch
Size: 4390 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190808/76160dc1/attachment-0001.bin>


More information about the cfe-commits mailing list