[cfe-dev] how to do C++ Instrumentation with Clang?
    Yonggang Chen via cfe-dev 
    cfe-dev at lists.llvm.org
       
    Thu Jun 22 20:55:29 PDT 2017
    
    
  
Hello all,
 
I have a large project which consists of several millions of C++ code. Now I
want to add a log function to each line of code. If do it manually, it's
almost impossible.
 
Suppose my original code is like this:
void snapshot_handler::mouseMoveEvent(IDocView* pDocView, QMouseEvent *
event)
{
    pDocView->getViewPortWidget()->setCursor(Qt::CrossCursor);
    m_ptEnd = event->pos();
    pDocView->updateView();
}
 
I want to log each line of code and the function:
void snapshot_handler::mouseMoveEvent(IDocView* pDocView, QMouseEvent *
event)
{
    Log << "mouseMoveEvent;
    Log << pDocView->getViewPortWidget()->setCursor(Qt::CrossCursor);
    Log << m_ptEnd = event->pos();
    Log << pDocView->updateView();
    Log << "elapsed time in seconds";
}
 
Can Clang support doing this? If so, how can achieve such requirements?
 
Best regards
Yonggang Chen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170623/97ce37c2/attachment.html>
    
    
More information about the cfe-dev
mailing list