[all-commits] [llvm/llvm-project] 835462: [include-cleaner] Ignore builtin symbols in the Wa...

Haojian Wu via All-commits all-commits at lists.llvm.org
Thu Mar 30 04:47:21 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 83546221af43ca347f8e1b1197a9df54810244e0
      https://github.com/llvm/llvm-project/commit/83546221af43ca347f8e1b1197a9df54810244e0
  Author: Haojian Wu <hokein.wu at gmail.com>
  Date:   2023-03-30 (Thu, 30 Mar 2023)

  Changed paths:
    M clang-tools-extra/include-cleaner/lib/WalkAST.cpp
    M clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp

  Log Message:
  -----------
  [include-cleaner] Ignore builtin symbols in the WalkAST.

There is no need to add headers for builtin symbols.

Additionally, there is a bonus benefit which help eliminate some bugs -- builtin
functions are modeled as implicit FunctionDecls in the clang AST, which results in
them being treated as normal FunctionDecls in the implementation of the include-cleaner
(going through the path: ast-node -> decl -> source location -> header).
And, the source location of these built-in symbols' AST nodes is not precise (e.g. points to the first call site),
which leads to subtle behavior that inserts a header of the call site.

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




More information about the All-commits mailing list