function [allFilesToInstrument, allInstrumentationUpToDate, sharedUtilIdx] = ...
getAllFilesToInstrument...
(buildInfo, filterReadOnlyFolders, lBuildSharedUtils, ...
lOriginalBuildFolder, ...
lInstrPrefix, lInstrPartOfPath)
%getAllFilesToInstrument identifies files that must be instrumented
% Files returned by this function include files for the specified
% buildInfo as well as any associated shared library files. This
% legacy function will be removed with g2094786.

% Copyright 2009-2019 The MathWorks, Inc.

if lBuildSharedUtils
[sharedBuildInfos, lSharedLibPathsOriginalAbs] = ...
coder.coverage.getSharedBuildInfos(buildInfo, lOriginalBuildFolder, lInstrPartOfPath);
else
sharedBuildInfos = [];
end

[modelFilesToInstrument, modelInstrumentionUpToDate] = coder.coverage.getFilesToInstrument...
(buildInfo, filterReadOnlyFolders, lInstrPrefix, ...
lOriginalBuildFolder);

sharedFilesToInstrument = {}; sharedInstrumenationUpToDate = [];
for i=1:length(sharedBuildInfos)
[tmpFilesToInstrument, tmpInstrumenationUpToDate] = coder.coverage.getFilesToInstrument...
(sharedBuildInfos(i), filterReadOnlyFolders, lInstrPrefix, ...
lSharedLibPathsOriginalAbs{i});
sharedFilesToInstrument = [sharedFilesToInstrument tmpFilesToInstrument]; %#ok
sharedInstrumenationUpToDate = [sharedInstrumenationUpToDate tmpInstrumenationUpToDate]; %#ok
end

allFilesToInstrument = [modelFilesToInstrument sharedFilesToInstrument];
allInstrumentationUpToDate = [modelInstrumentionUpToDate sharedInstrumenationUpToDate];
sharedUtilIdx = [false(size(modelFilesToInstrument)) true(size(sharedFilesToInstrument))];