[PATCH] D38954: [Sema] -Wzero-as-null-pointer-constant: don't warn for system macros other than NULL.

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 25 13:56:01 PDT 2017


lebedev.ri added a comment.

> Hm, that's a lot of overhead. Granted, it's a synthetic benchmark, but I think it'd be good to try this on some real codebase to make sure it really is negligible overhead in real-world scenarios.

Hm wait, i'm comparing apples and oranges here, my local build at least has the assertions enabled.
Local build, **without** the patch:

  $ time /build/llvm-build-Clang-release/bin/clang -fsyntax-only -Wzero-as-null-pointer-constant -Wsystem-headers -std=c++11 test.cpp -w;
  
  real    0m10.130s
  user    0m9.985s
  sys     0m0.144s
  $ time /build/llvm-build-Clang-release/bin/clang -fsyntax-only -Wzero-as-null-pointer-constant -Wsystem-headers -std=c++11 test.cpp -w;
  
  real    0m10.195s
  user    0m10.081s
  sys     0m0.112s
  $ time /build/llvm-build-Clang-release/bin/clang -fsyntax-only -Wzero-as-null-pointer-constant -Wsystem-headers -std=c++11 test.cpp -w;
  
  real    0m10.099s
  user    0m9.977s
  sys     0m0.120s
  $ time /build/llvm-build-Clang-release/bin/clang -fsyntax-only -Wzero-as-null-pointer-constant -Wsystem-headers -std=c++11 test.cpp -w;
  
  real    0m10.110s
  user    0m9.979s
  sys     0m0.130s
  $ time /build/llvm-build-Clang-release/bin/clang -fsyntax-only -Wzero-as-null-pointer-constant -Wsystem-headers -std=c++11 test.cpp -w;
  
  real    0m10.063s
  user    0m9.969s
  sys     0m0.092s

Local build, **with** the patch:

  $ time /build/llvm-build-Clang-release/bin/clang -fsyntax-only -Wzero-as-null-pointer-constant -Wsystem-headers -std=c++11 test.cpp -w;
  
  real    0m10.534s
  user    0m10.399s
  sys     0m0.133s
  $ time /build/llvm-build-Clang-release/bin/clang -fsyntax-only -Wzero-as-null-pointer-constant -Wsystem-headers -std=c++11 test.cpp -w;
  
  real    0m10.478s
  user    0m10.286s
  sys     0m0.159s
  $ time /build/llvm-build-Clang-release/bin/clang -fsyntax-only -Wzero-as-null-pointer-constant -Wsystem-headers -std=c++11 test.cpp -w;
  
  real    0m10.359s
  user    0m10.226s
  sys     0m0.133s
  $ time /build/llvm-build-Clang-release/bin/clang -fsyntax-only -Wzero-as-null-pointer-constant -Wsystem-headers -std=c++11 test.cpp -w;
  
  real    0m10.292s
  user    0m10.146s
  sys     0m0.145s
  $ time /build/llvm-build-Clang-release/bin/clang -fsyntax-only -Wzero-as-null-pointer-constant -Wsystem-headers -std=c++11 test.cpp -w;
  
  real    0m10.383s
  user    0m10.305s
  sys     0m0.077s

So it seems the overhead is around `+0.5s`, not `+3.0s`


Repository:
  rL LLVM

https://reviews.llvm.org/D38954





More information about the cfe-commits mailing list