source: icGREP/icgrep-devel/icgrep/grep_engine.cpp @ 5732

Last change on this file since 5732 was 5732, checked in by cameron, 19 months ago

More changes in preparation for LLVM 3.9, 4.0

File size: 19.3 KB
RevLine 
[4324]1/*
[5476]2 *  Copyright (c) 2017 International Characters.
[4324]3 *  This software is licensed to the public under the Open Software License 3.0.
4 *  icgrep is a trademark of International Characters.
5 */
6
[5234]7#include "grep_engine.h"
[5476]8#include "grep_interface.h"
[5267]9#include <llvm/IR/Module.h>
[5234]10#include <boost/filesystem.hpp>
[5206]11#include <UCD/resolve_properties.h>
[5585]12#include <kernels/charclasses.h>
[5142]13#include <kernels/cc_kernel.h>
[5404]14#include <kernels/grep_kernel.h>
[5357]15#include <kernels/linebreak_kernel.h>
[5338]16#include <kernels/streams_merge.h>
[5429]17#include <kernels/source_kernel.h>
[5234]18#include <kernels/s2p_kernel.h>
19#include <kernels/scanmatchgen.h>
20#include <kernels/streamset.h>
[5450]21#include <kernels/until_n.h>
[5436]22#include <kernels/kernel_builder.h>
[5087]23#include <pablo/pablo_kernel.h>
[5234]24#include <re/re_cc.h>
25#include <re/re_toolchain.h>
[5425]26#include <toolchain/toolchain.h>
[5585]27#include <re/re_name_resolve.h>   
28#include <re/re_collect_unicodesets.h>
29#include <re/re_multiplex.h>
[5700]30#include <toolchain/toolchain.h>
[5464]31#include <toolchain/cpudriver.h>
[5234]32#include <iostream>
[5369]33#include <cc/multiplex_CCs.h>
[5377]34#include <llvm/Support/raw_ostream.h>
[5418]35#include <util/aligned_allocator.h>
[5386]36#include <sys/stat.h>
[5418]37#include <fcntl.h>
[5484]38#include <errno.h>
[5696]39#include <llvm/ADT/STLExtras.h> // for make_unique
[5700]40#include <llvm/Support/CommandLine.h>
[5377]41
[5241]42using namespace parabix;
[5267]43using namespace llvm;
[5703]44static cl::opt<int> Threads("t", cl::desc("Total number of threads."), cl::init(2));
[5241]45
[5473]46namespace grep {
47
[5704]48// Grep Engine construction and initialization.
49   
50GrepEngine::GrepEngine() :
51    mGrepDriver(nullptr),
52    grepMatchFound(false),
53    fileCount(0),
54    mMoveMatchesToEOL(true) {}
55   
56GrepEngine::~GrepEngine() {
57    delete mGrepDriver;
58}
59   
60QuietModeEngine::QuietModeEngine() : GrepEngine() {
61    mMoveMatchesToEOL = false;
62}
[5473]63
[5704]64MatchOnlyEngine::MatchOnlyEngine(bool showFilesWithoutMatch) :
65    GrepEngine(), mRequiredCount(showFilesWithoutMatch) {
66    mFileSuffix = NullFlag ? std::string("\0", 1) : "\n";
67    mMoveMatchesToEOL = false;
68}
[5484]69
[5704]70CountOnlyEngine::CountOnlyEngine() : GrepEngine() {
71    mFileSuffix = ":";
72}
[5484]73
[5704]74EmitMatchesEngine::EmitMatchesEngine() : GrepEngine() {
75    mFileSuffix = InitialTabFlag ? "\t:" : ":";
76    if (LineRegexpFlag) mMoveMatchesToEOL = false;
[5484]77}
[5704]78
79void GrepEngine::initFileResult(std::vector<std::string> & filenames) {
[5732]80    const unsigned n = filenames.size();
[5704]81    mResultStrs.resize(n);
[5707]82    for (unsigned i = 0; i < n; i++) {
83        mResultStrs[i] = make_unique<std::stringstream>();
84    }
[5704]85    inputFiles = filenames;
86}
[5695]87   
[5704]88
89// Code Generation
90//
91// All engines share a common pipeline to compute a stream of Matches from a given input Bytestream.
92
93std::pair<StreamSetBuffer *, StreamSetBuffer *> GrepEngine::grepPipeline(std::vector<re::RE *> & REs, StreamSetBuffer * ByteStream) {
94    auto & idb = mGrepDriver->getBuilder();
95    const unsigned segmentSize = codegen::SegmentSize;
96    const unsigned bufferSegments = codegen::BufferSegments * codegen::ThreadNum;
97    const unsigned encodingBits = 8;
[5695]98   
[5704]99    StreamSetBuffer * BasisBits = mGrepDriver->addBuffer(make_unique<CircularBuffer>(idb, idb->getStreamSetTy(encodingBits, 1), segmentSize * bufferSegments));
100    kernel::Kernel * s2pk = mGrepDriver->addKernelInstance(make_unique<kernel::S2PKernel>(idb));
101    mGrepDriver->makeKernelCall(s2pk, {ByteStream}, {BasisBits});
102   
103    StreamSetBuffer * LineBreakStream = mGrepDriver->addBuffer(make_unique<CircularBuffer>(idb, idb->getStreamSetTy(1, 1), segmentSize * bufferSegments));
104    kernel::Kernel * linebreakK = mGrepDriver->addKernelInstance(make_unique<kernel::LineBreakKernelBuilder>(idb, encodingBits));
105    mGrepDriver->makeKernelCall(linebreakK, {BasisBits}, {LineBreakStream});
106   
107    kernel::Kernel * requiredStreamsK = mGrepDriver->addKernelInstance(make_unique<kernel::RequiredStreams_UTF8>(idb));
108    StreamSetBuffer * RequiredStreams = mGrepDriver->addBuffer(make_unique<CircularBuffer>(idb, idb->getStreamSetTy(4, 1), segmentSize * bufferSegments));
109    mGrepDriver->makeKernelCall(requiredStreamsK, {BasisBits}, {RequiredStreams});
110   
111    const auto n = REs.size();
112   
113    std::vector<std::vector<UCD::UnicodeSet>> charclasses(n);
114   
115    for (unsigned i = 0; i < n; i++) {
116        REs[i] = re::resolveNames(REs[i]);
117        std::vector<UCD::UnicodeSet> UnicodeSets = re::collect_UnicodeSets(REs[i]);
118        std::vector<std::vector<unsigned>> exclusiveSetIDs;
119        doMultiplexCCs(UnicodeSets, exclusiveSetIDs, charclasses[i]);
120        REs[i] = multiplex(REs[i], UnicodeSets, exclusiveSetIDs);
[5695]121    }
[5704]122   
123    std::vector<StreamSetBuffer *> MatchResultsBufs(n);
124   
125    for(unsigned i = 0; i < n; ++i){
126        const auto numOfCharacterClasses = charclasses[i].size();
127        StreamSetBuffer * CharClasses = mGrepDriver->addBuffer(make_unique<CircularBuffer>(idb, idb->getStreamSetTy(numOfCharacterClasses), segmentSize * bufferSegments));
128        kernel::Kernel * ccK = mGrepDriver->addKernelInstance(make_unique<kernel::CharClassesKernel>(idb, std::move(charclasses[i])));
129        mGrepDriver->makeKernelCall(ccK, {BasisBits}, {CharClasses});
130        StreamSetBuffer * MatchResults = mGrepDriver->addBuffer(make_unique<CircularBuffer>(idb, idb->getStreamSetTy(1, 1), segmentSize * bufferSegments));
131        kernel::Kernel * icgrepK = mGrepDriver->addKernelInstance(make_unique<kernel::ICGrepKernel>(idb, REs[i], numOfCharacterClasses));
132        mGrepDriver->makeKernelCall(icgrepK, {CharClasses, LineBreakStream, RequiredStreams}, {MatchResults});
133        MatchResultsBufs[i] = MatchResults;
134    }
135    StreamSetBuffer * MergedResults = MatchResultsBufs[0];
136    if (REs.size() > 1) {
137        MergedResults = mGrepDriver->addBuffer(make_unique<CircularBuffer>(idb, idb->getStreamSetTy(1, 1), segmentSize * bufferSegments));
138        kernel::Kernel * streamsMergeK = mGrepDriver->addKernelInstance(make_unique<kernel::StreamsMerge>(idb, 1, REs.size()));
139        mGrepDriver->makeKernelCall(streamsMergeK, MatchResultsBufs, {MergedResults});
140    }
141    StreamSetBuffer * Matches = MergedResults;
142   
143    if (mMoveMatchesToEOL) {
144        StreamSetBuffer * OriginalMatches = Matches;
145        kernel::Kernel * matchedLinesK = mGrepDriver->addKernelInstance(make_unique<kernel::MatchedLinesKernel>(idb));
146        Matches = mGrepDriver->addBuffer(make_unique<CircularBuffer>(idb, idb->getStreamSetTy(1, 1), segmentSize * bufferSegments));
147        mGrepDriver->makeKernelCall(matchedLinesK, {OriginalMatches, LineBreakStream}, {Matches});
148    }
149   
150    if (InvertMatchFlag) {
151        kernel::Kernel * invertK = mGrepDriver->addKernelInstance(make_unique<kernel::InvertMatchesKernel>(idb));
152        StreamSetBuffer * OriginalMatches = Matches;
153        Matches = mGrepDriver->addBuffer(make_unique<CircularBuffer>(idb, idb->getStreamSetTy(1, 1), segmentSize * bufferSegments));
154        mGrepDriver->makeKernelCall(invertK, {OriginalMatches, LineBreakStream}, {Matches});
155    }
156    if (MaxCountFlag > 0) {
157        kernel::Kernel * untilK = mGrepDriver->addKernelInstance(make_unique<kernel::UntilNkernel>(idb));
158        untilK->setInitialArguments({idb->getSize(MaxCountFlag)});
159        StreamSetBuffer * AllMatches = Matches;
160        Matches = mGrepDriver->addBuffer(make_unique<CircularBuffer>(idb, idb->getStreamSetTy(1, 1), segmentSize * bufferSegments));
161        mGrepDriver->makeKernelCall(untilK, {AllMatches}, {Matches});
162    }
163    return std::pair<StreamSetBuffer *, StreamSetBuffer *>(LineBreakStream, Matches);
[5700]164}
[5704]165
166// The QuietMode, MatchOnly and CountOnly engines share a common code generation main function,
167// which returns a count of the matches found (possibly subject to a MaxCount).
[5700]168//
169
[5704]170void GrepEngine::grepCodeGen(std::vector<re::RE *> REs) {
171   
172    assert (mGrepDriver == nullptr);
173    mGrepDriver = new ParabixDriver("engine");
174    auto & idb = mGrepDriver->getBuilder();
175    Module * M = idb->getModule();
176   
177    const unsigned segmentSize = codegen::SegmentSize;
178    const unsigned encodingBits = 8;
179   
180    Function * mainFunc = cast<Function>(M->getOrInsertFunction("Main", idb->getInt64Ty(), idb->getInt32Ty(), nullptr));
181    mainFunc->setCallingConv(CallingConv::C);
182    idb->SetInsertPoint(BasicBlock::Create(M->getContext(), "entry", mainFunc, 0));
183    auto args = mainFunc->arg_begin();
184   
185    Value * const fileDescriptor = &*(args++);
186    fileDescriptor->setName("fileDescriptor");
187   
188    StreamSetBuffer * ByteStream = mGrepDriver->addBuffer(make_unique<SourceBuffer>(idb, idb->getStreamSetTy(1, encodingBits)));
189    kernel::Kernel * sourceK = mGrepDriver->addKernelInstance(make_unique<kernel::FDSourceKernel>(idb, segmentSize));
190    sourceK->setInitialArguments({fileDescriptor});
191    mGrepDriver->makeKernelCall(sourceK, {}, {ByteStream});
192   
193    StreamSetBuffer * LineBreakStream;
194    StreamSetBuffer * Matches;
195    std::tie(LineBreakStream, Matches) = grepPipeline(REs, ByteStream);
196   
197    kernel::Kernel * matchCountK = mGrepDriver->addKernelInstance(make_unique<kernel::PopcountKernel>(idb));
198    mGrepDriver->makeKernelCall(matchCountK, {Matches}, {});
199    mGrepDriver->generatePipelineIR();
200    idb->setKernel(matchCountK);
201    Value * matchedLineCount = idb->getAccumulator("countResult");
202    matchedLineCount = idb->CreateZExt(matchedLineCount, idb->getInt64Ty());
203    mGrepDriver->deallocateBuffers();
204    idb->CreateRet(matchedLineCount);
205    mGrepDriver->finalizeObject();
206}
207
208//
209// The EmitMatches engine uses an EmitMatchesAccumulator object to concatenate together
210// matched lines.
211
[5700]212class EmitMatch : public MatchAccumulator {
[5703]213    friend class EmitMatchesEngine;
[5700]214public:
215    EmitMatch(std::string linePrefix, std::stringstream * strm) : mLinePrefix(linePrefix), mLineCount(0), mPrevious_line_end(nullptr), mResultStr(strm) {}
216    void accumulate_match(const size_t lineNum, char * line_start, char * line_end) override;
217    void finalize_match(char * buffer_end) override;
[5703]218protected:
[5700]219    std::string mLinePrefix;
220    size_t mLineCount;
221    char * mPrevious_line_end;
222    std::stringstream* mResultStr;
223};
224
[5704]225//
226//  Default Report Match:  lines are emitted with whatever line terminators are found in the
227//  input.  However, if the final line is not terminated, a new line is appended.
[5726]228//
229//  It is possible that the line_end position is past the EOF, if there is an unterminated
230//  final line.   To avoid potential bus errors, we only emit bytes up to but not
231//  including the line_end position when we first find a match.
[5700]232void EmitMatch::accumulate_match (const size_t lineNum, char * line_start, char * line_end) {
233    if (!(WithFilenameFlag | LineNumberFlag) && (line_start == mPrevious_line_end + 1)) {
234        // Consecutive matches: only one write call needed.
235        mResultStr->write(mPrevious_line_end, line_end - mPrevious_line_end);
236    }
237    else {
238        if (mLineCount > 0) {
[5726]239            // Deal with the terminator of the previous line.  It could be an LF, the
240            // last byte of NEL, LS or PS, or a two byte CRLF sequence.
241            if (LLVM_UNLIKELY(mPrevious_line_end[0] == 0x0D)) {
242                mResultStr->write(mPrevious_line_end, mPrevious_line_end[1] == 0x0A ? 2 : 1);
243            }
244            else {
245                mResultStr->write(mPrevious_line_end, 1);
246            }
[5695]247        }
[5700]248        if (WithFilenameFlag) {
249            *mResultStr << mLinePrefix;
250        }
251        if (LineNumberFlag) {
252            // Internally line numbers are counted from 0.  For display, adjust
253            // the line number so that lines are numbered from 1.
254            if (InitialTabFlag) {
255                *mResultStr << lineNum+1 << "\t:";
[5695]256            }
[5700]257            else {
258                *mResultStr << lineNum+1 << ":";
259            }
[5695]260        }
[5700]261        mResultStr->write(line_start, line_end - line_start);
[5695]262    }
[5700]263    mPrevious_line_end = line_end;
264    mLineCount++;
265}
[5484]266
[5700]267void EmitMatch::finalize_match(char * buffer_end) {
268    if (mLineCount == 0) return;  // No matches.
269    if (mPrevious_line_end < buffer_end) {
[5726]270        if (LLVM_UNLIKELY(mPrevious_line_end[0] == 0x0D)) {
271            mResultStr->write(mPrevious_line_end, mPrevious_line_end[1] == 0x0A ? 2 : 1);
272        }
273        else {
274            mResultStr->write(mPrevious_line_end, 1);
275        }
[5700]276    }
277    else {
278        // Likely unterminated final line.
279        char last_byte = mPrevious_line_end[-1];
280        if (last_byte == 0x0D) {
281            // The final CR is acceptable as a line_end.
282            return;
283        }
284        // Terminate the line with an LF
285        // (Even if we had an incomplete UTF-8 sequence.)
286        *mResultStr << "\n";
287    }
288}
289
[5704]290void EmitMatchesEngine::grepCodeGen(std::vector<re::RE *> REs) {
291    assert (mGrepDriver == nullptr);
292    mGrepDriver = new ParabixDriver("engine");
293    auto & idb = mGrepDriver->getBuilder();
294    Module * M = idb->getModule();
295   
296    const unsigned segmentSize = codegen::SegmentSize;
297    const unsigned encodingBits = 8;
298   
299    Function * mainFunc = cast<Function>(M->getOrInsertFunction("Main", idb->getInt64Ty(), idb->getInt32Ty(), idb->getIntAddrTy(), nullptr));
300    mainFunc->setCallingConv(CallingConv::C);
301    idb->SetInsertPoint(BasicBlock::Create(M->getContext(), "entry", mainFunc, 0));
302    auto args = mainFunc->arg_begin();
303   
304    Value * const fileDescriptor = &*(args++);
305    fileDescriptor->setName("fileDescriptor");
306    Value * match_accumulator = &*(args++);
307    match_accumulator->setName("match_accumulator");
308   
309    StreamSetBuffer * ByteStream = mGrepDriver->addBuffer(make_unique<SourceBuffer>(idb, idb->getStreamSetTy(1, encodingBits)));
310    kernel::Kernel * sourceK = mGrepDriver->addKernelInstance(make_unique<kernel::FDSourceKernel>(idb, segmentSize));
311    sourceK->setInitialArguments({fileDescriptor});
312    mGrepDriver->makeKernelCall(sourceK, {}, {ByteStream});
313   
314    StreamSetBuffer * LineBreakStream;
315    StreamSetBuffer * Matches;
316    std::tie(LineBreakStream, Matches) = grepPipeline(REs, ByteStream);
317   
318    kernel::Kernel * scanMatchK = mGrepDriver->addKernelInstance(make_unique<kernel::ScanMatchKernel>(idb));
319    scanMatchK->setInitialArguments({match_accumulator});
320    mGrepDriver->makeKernelCall(scanMatchK, {Matches, LineBreakStream, ByteStream}, {});
321    mGrepDriver->LinkFunction(*scanMatchK, "accumulate_match_wrapper", &accumulate_match_wrapper);
322    mGrepDriver->LinkFunction(*scanMatchK, "finalize_match_wrapper", &finalize_match_wrapper);
323   
324    mGrepDriver->generatePipelineIR();
325    mGrepDriver->deallocateBuffers();
326    idb->CreateRet(idb->getInt64(0));
327    mGrepDriver->finalizeObject();
328}
[5700]329
330
[5704]331//
332//  The doGrep methods apply a GrepEngine to a single file, processing the results
333//  differently based on the engine type.
334   
335uint64_t GrepEngine::doGrep(const std::string & fileName, const uint32_t fileIdx) {
336    typedef uint64_t (*GrepFunctionType)(int32_t fileDescriptor);
337    auto f = reinterpret_cast<GrepFunctionType>(mGrepDriver->getMain());
338   
[5707]339    int32_t fileDescriptor = openFile(fileName, mResultStrs[fileIdx].get());
[5704]340    if (fileDescriptor == -1) return 0;
341   
342    uint64_t grepResult = f(fileDescriptor);
343    close(fileDescriptor);
344    return grepResult;
345}
346
347uint64_t CountOnlyEngine::doGrep(const std::string & fileName, const uint32_t fileIdx) {
348    uint64_t grepResult = GrepEngine::doGrep(fileName, fileIdx);
[5707]349    if (WithFilenameFlag) *mResultStrs[fileIdx] << linePrefix(fileName);
350    *mResultStrs[fileIdx] << grepResult << "\n";
[5704]351    return grepResult;
352}
353
354std::string GrepEngine::linePrefix(std::string fileName) {
355    if (fileName == "-") {
356        return LabelFlag + mFileSuffix;
[5548]357    }
[5704]358    else {
359        return fileName + mFileSuffix;
[5548]360    }
361}
[5704]362   
363uint64_t MatchOnlyEngine::doGrep(const std::string & fileName, const uint32_t fileIdx) {
364    uint64_t grepResult = GrepEngine::doGrep(fileName, fileIdx);
365    if (grepResult == mRequiredCount) {
[5707]366       *mResultStrs[fileIdx] << linePrefix(fileName);
[5704]367    }
368    return grepResult;
369}
[5700]370
[5704]371uint64_t EmitMatchesEngine::doGrep(const std::string & fileName, const uint32_t fileIdx) {
372    typedef uint64_t (*GrepFunctionType)(int32_t fileDescriptor, intptr_t accum_addr);
373    auto f = reinterpret_cast<GrepFunctionType>(mGrepDriver->getMain());
374   
[5707]375    int32_t fileDescriptor = openFile(fileName, mResultStrs[fileIdx].get());
[5704]376    if (fileDescriptor == -1) return 0;
[5707]377    EmitMatch accum(linePrefix(fileName), mResultStrs[fileIdx].get());
[5704]378    uint64_t grepResult = f(fileDescriptor, reinterpret_cast<intptr_t>(&accum));
379    close(fileDescriptor);
380    if (accum.mLineCount > 0) grepMatchFound = true;
381    return accum.mLineCount;
382}
383
[5703]384// Open a file and return its file desciptor.
[5707]385int32_t GrepEngine::openFile(const std::string & fileName, std::stringstream * msgstrm) {
[5693]386    if (fileName == "-") {
[5700]387        return STDIN_FILENO;
[5693]388    }
[5700]389    else {
390        struct stat sb;
391        int32_t fileDescriptor = open(fileName.c_str(), O_RDONLY);
392        if (LLVM_UNLIKELY(fileDescriptor == -1)) {
393            if (!NoMessagesFlag) {
394                if (errno == EACCES) {
[5707]395                    *msgstrm << "icgrep: " << fileName << ": Permission denied.\n";
[5700]396                }
397                else if (errno == ENOENT) {
[5707]398                    *msgstrm << "icgrep: " << fileName << ": No such file.\n";
[5700]399                }
400                else {
[5707]401                    *msgstrm << "icgrep: " << fileName << ": Failed.\n";
[5700]402                }
[5484]403            }
[5700]404            return fileDescriptor;
405        }
406        if (stat(fileName.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode)) {
407            if (!NoMessagesFlag) {
[5707]408                *msgstrm << "icgrep: " << fileName << ": Is a directory.\n";
[5484]409            }
[5700]410            close(fileDescriptor);
[5704]411            return -1;
[5484]412        }
[5700]413        return fileDescriptor;
[4788]414    }
[5700]415}
416
[5704]417// The process of searching a group of files may use a sequential or a task
418// parallel approach.
[4949]419
[5704]420bool GrepEngine::searchAllFiles() {
421    if (Threads <= 1) {
422        for (unsigned i = 0; i != inputFiles.size(); ++i) {
423            size_t grepResult = doGrep(inputFiles[i], i);
424            if (grepResult > 0) {
425                grepMatchFound = true;
426                if (QuietMode) break;
427            }
[5484]428        }
[5704]429    } else if (Threads > 1) {
430        const unsigned numOfThreads = Threads; // <- convert the command line value into an integer to allow stack allocation
431        pthread_t threads[numOfThreads];
432       
433        for(unsigned long i = 0; i < numOfThreads; ++i) {
434            const int rc = pthread_create(&threads[i], nullptr, DoGrepThreadFunction, (void *)this);
435            if (rc) {
436                llvm::report_fatal_error("Failed to create thread: code " + std::to_string(rc));
437            }
438        }
439        for(unsigned i = 0; i < numOfThreads; ++i) {
440            void * status = nullptr;
441            const int rc = pthread_join(threads[i], &status);
442            if (rc) {
443                llvm::report_fatal_error("Failed to join thread: code " + std::to_string(rc));
444            }
445        }
[5484]446    }
[5704]447    return grepMatchFound;
[5377]448}
[5314]449
[5338]450
[5704]451// DoGrep thread function.
452void * GrepEngine::DoGrepThreadFunction(void *args) {
453    size_t fileIdx;
454    grep::GrepEngine * grepEngine = (grep::GrepEngine *)args;
[5574]455
[5704]456    grepEngine->count_mutex.lock();
457    fileIdx = grepEngine->fileCount;
458    grepEngine->fileCount++;
459    grepEngine->count_mutex.unlock();
[5585]460
[5704]461    while (fileIdx < grepEngine->inputFiles.size()) {
462        size_t grepResult = grepEngine->doGrep(grepEngine->inputFiles[fileIdx], fileIdx);
463       
464        grepEngine->count_mutex.lock();
465        if (grepResult > 0) grepEngine->grepMatchFound = true;
466        fileIdx = grepEngine->fileCount;
467        grepEngine->fileCount++;
468        grepEngine->count_mutex.unlock();
469        if (QuietMode && grepEngine->grepMatchFound) pthread_exit(nullptr);
[5574]470    }
[5704]471    pthread_exit(nullptr);
[5574]472}
[5698]473   
[5704]474void GrepEngine::writeMatches() {
475    for (unsigned i = 0; i < inputFiles.size(); ++i) {
[5707]476        std::cout << mResultStrs[i]->str();
[5398]477    }
[5703]478}
479
[5481]480}
481
Note: See TracBrowser for help on using the repository browser.