[all-commits] [llvm/llvm-project] d42de8: reland: [clang][ScanDeps] Canonicalize -D and -U f...

Michael Spencer via All-commits all-commits at lists.llvm.org
Fri Feb 23 17:44:44 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d42de86eb37b08b3007a67650b3ca73b9ae174b1
      https://github.com/llvm/llvm-project/commit/d42de86eb37b08b3007a67650b3ca73b9ae174b1
  Author: Michael Spencer <bigcheesegs at gmail.com>
  Date:   2024-02-23 (Fri, 23 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:
  -----------
  reland: [clang][ScanDeps] Canonicalize -D and -U flags (#82568)

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.

Previous version of this had issues with sed differences between macOS,
Linux, and Windows. This test doesn't check paths, so just don't run
sed.
Other tests should use `sed -E 's:\\\\?:/:g'` to get portable behavior.

Windows has different command line parsing behavior than Linux for
compilation databases, so the test has been adjusted to ignore that
difference.



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