Commit 1e634f39 authored by Petr Hosek's avatar Petr Hosek
Browse files

Revert "Support for instrumenting only selected files or functions"

This reverts commit 4edf35f1 because
the test fails on Windows bots.
parent 7636b1f6
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -2045,12 +2045,6 @@ Set update method of profile counters (atomic,prefer-atomic,single)

Use instrumentation data for profile-guided optimization. If pathname is a directory, it reads from <pathname>/default.profdata. Otherwise, it reads from file <pathname>.

.. program:: clang1
.. option:: -fprofile-list=<file>
.. program:: clang

Filename defining the list of functions/files to instrument. The file uses the sanitizer special case list format.

.. option:: -freciprocal-math, -fno-reciprocal-math

Allow division operations to be reassociated
+0 −45
Original line number Diff line number Diff line
@@ -64,51 +64,6 @@ To compile code with coverage enabled, pass ``-fprofile-instr-generate
Note that linking together code with and without coverage instrumentation is
supported. Uninstrumented code simply won't be accounted for in reports.

Instrumenting only selected files or functions
----------------------------------------------

Sometimes it's useful to only instrument certain files or functions.  For
example in automated testing infrastructure, it may be desirable to only
instrument files or functions that were modified by a patch to reduce the
overhead of instrumenting a full system.

This can be done using the ``-fprofile-list=file.list`` option. The option
can be specified multiple times to pass multiple files:

.. code-block:: console

    $ echo "!fun:*test*" > fun.list
    $ echo "src:code.cc" > src.list
    % clang++ -O2 -fprofile-instr-generate -fcoverage-mapping -fprofile-list=fun.list -fprofile-list=code.list code.cc -o code

The file uses :doc:`SanitizerSpecialCaseList` format. To filter individual
functions or entire source files using ``fun:<name>`` or ``src:<file>``
respectively. To exclude a function or a source file, use ``!fun:<name>`` or
``!src:<file>`` respectively. The format also supports wildcard expansion. The
compiler generated functions are assumed to be located in the main source file.
It is also possible to restrict the filter to a particular instrumentation type
by using a named section. For example:

.. code-block:: none

  # all functions whose name starts with foo will be instrumented.
  fun:foo*

  # except for foo1 which will be excluded from instrumentation.
  !fun:foo1

  # every function in path/to/foo.cc will be instrumented.
  src:path/to/foo.cc

  # bar will be instrumented only when using backend instrumentation.
  # Recognized section names are clang, llvm and csllvm.
  [llvm]
  fun:bar

When the file contains only excludes, all files and functions except for the
excluded ones will be instrumented. Otherwise, only the files and functions
specified will be instrumented.

Running the instrumented program
================================

+0 −13
Original line number Diff line number Diff line
@@ -2268,17 +2268,6 @@ programs using the same instrumentation method as ``-fprofile-generate``.
  This option currently works with ``-fprofile-arcs`` and ``-fprofile-instr-generate``,
  but not with ``-fprofile-generate``.

.. option:: -fprofile-list=<pathname>

  This option can be used to apply profile instrumentation only to selected
  files or functions. ``pathname`` specifies a file in the sanitizer special
  case list format which selects which files and functions to instrument.

  .. code-block:: console

    $ echo "fun:test" > fun.list
    $ clang++ -O2 -fprofile-instr-generate -fprofile-list=fun.list code.cc -o code

Disabling Instrumentation
^^^^^^^^^^^^^^^^^^^^^^^^^

@@ -3751,8 +3740,6 @@ Execute ``clang-cl /?`` to see a list of supported options:
                              Use instrumentation data for profile-guided optimization
      -fprofile-remapping-file=<file>
                              Use the remappings described in <file> to match the profile data against names in the program
      -fprofile-list=<file>
                              Filename defining the list of functions/files to instrument
      -fsanitize-address-field-padding=<value>
                              Level of field padding for AddressSanitizer
      -fsanitize-address-globals-dead-stripping
+0 −7
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@
#include "clang/Basic/Linkage.h"
#include "clang/Basic/OperatorKinds.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/ProfileList.h"
#include "clang/Basic/SanitizerBlacklist.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/Specifiers.h"
@@ -567,10 +566,6 @@ private:
  /// should be imbued with the XRay "always" or "never" attributes.
  std::unique_ptr<XRayFunctionFilter> XRayFilter;

  /// ProfileList object that is used by the profile instrumentation
  /// to decide which entities should be instrumented.
  std::unique_ptr<ProfileList> ProfList;

  /// The allocator used to create AST objects.
  ///
  /// AST objects are never destructed; rather, all memory associated with the
@@ -696,8 +691,6 @@ public:
    return *XRayFilter;
  }

  const ProfileList &getProfileList() const { return *ProfList; }

  DiagnosticsEngine &getDiagnostics() const;

  FullSourceLoc getFullLoc(SourceLocation Loc) const {
+0 −4
Original line number Diff line number Diff line
@@ -285,10 +285,6 @@ public:
  /// attribute(s).
  std::vector<std::string> XRayAttrListFiles;

  /// Paths to special case list files specifying which entities
  /// (files, functions) should or should not be instrumented.
  std::vector<std::string> ProfileListFiles;

  clang::ObjCRuntime ObjCRuntime;

  CoreFoundationABI CFRuntime = CoreFoundationABI::Unspecified;
Loading