[all-commits] [llvm/llvm-project] 3ff805: [clang][ScanDeps] Canonicalize -D and -U flags (#8...

Michael Spencer via All-commits all-commits at lists.llvm.org
Tue Feb 20 15:20:51 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3ff805540173b83d73b673b39ac5760fc19bac15
      https://github.com/llvm/llvm-project/commit/3ff805540173b83d73b673b39ac5760fc19bac15
  Author: Michael Spencer <bigcheesegs at gmail.com>
  Date:   2024-02-20 (Tue, 20 Feb 2024)

  Changed paths:
    M clang/include/clang/Tooling/DependencyScanning/DependencyScanningService.h
    M clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
    A clang/test/ClangScanDeps/optimize-canonicalize-macros.m
    M clang/tools/clang-scan-deps/ClangScanDeps.cpp

  Log Message:
  -----------
  [clang][ScanDeps] Canonicalize -D and -U flags (#82298)

Canonicalize `-D` and `-U` flags by sorting them and only keeping the
last instance of a given name.

This optimization will only fire if all `-D` and `-U` flags start with a
simple identifier that we can guarantee a simple analysis of can
determine if two flags refer to the same identifier or not. See the
comment on `getSimpleMacroName()` for details of what the issues are.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list