[PATCH] D94820: Support for instrumenting only selected files or functions

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 20 00:44:28 PST 2021


phosek added inline comments.


================
Comment at: clang/docs/SourceBasedCodeCoverage.rst:86
+.. code-block:: none
+
+  # all functions whose name starts with foo will be instrumented.
----------------
davidxl wrote:
> what is the default section name?
It's `*` which always matches.


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:2569
+  // If the profile list is empty, then instrument everything.
+  if (ProfileList.isEmpty())
+    return true;
----------------
davidxl wrote:
> Should the option to turn on instrumentation also be checked?
Currently, this method is only invoked from `CodeGenFunction` which does its own check, but I'm happy to include a check here in case there are ever other callers.


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:2591
+  }
+  return false;
+}
----------------
davidxl wrote:
> If the profile list contains only one line of exclude list, it seems that all functions will be rejected as the function returns 'false' by default for all other functions?
That's correct, would you expect a different behavior and if so what should that behavior be?

Currently, the profile list is used to build up a list of functions and files that should be instrumented. Any function or file that's not covered by the profile list is automatically excluded (not included may be more correct). Having just excludes without any includes means that nothing will be instrumented.


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

https://reviews.llvm.org/D94820



More information about the llvm-commits mailing list