[PATCH] D115907: [misexpect] Re-implement MisExpect Diagnostics

Hans Wennborg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 25 05:06:44 PDT 2023


hans added a comment.
Herald added subscribers: hoy, Enna1, StephenFan.

We gave this a try in Chromium: https://bugs.chromium.org/p/chromium/issues/detail?id=1434989

While the diagnostics are interesting, two things make this less useful for our developers:

1. It also fires in situations where the developer didn't set any expectations, for example for static variable initialization guards where clang implicitly adds branch weights (https://crbug.com/1434989#c7)
2. Due to inlining etc., it often gets the source locations wrong, which means it points at code where again there were no expectations -- but perhaps that code got inlined into an expectations somewhere else. (e.g. https://crbug.com/1434989#c9)

Especially 2) is probably not easy to fix. Do you have any tips on how developers can use this more effectively?



================
Comment at: clang/include/clang/Driver/Options.td:1434
+def fdiagnostics_misexpect_tolerance_EQ : Joined<["-"], "fdiagnostics-misexpect-tolerance=">,
+    Group<f_Group>, Flags<[CC1Option]>, MetaVarName<"<value>">,
+    HelpText<"Prevent misexpect diagnostics from being output if the profile counts are within N% of the expected. ">;
----------------
Should this be a driver mode option and not just cc1? The doc suggests using it, which currently won't work without an `-Xclang` prefix.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115907/new/

https://reviews.llvm.org/D115907



More information about the cfe-commits mailing list