• Yonghong Song's avatar
    fix compilation error with latest llvm · 806627e3
    Yonghong Song authored
    The clang commit https://reviews.llvm.org/rL331155
    changed the clang::SourceManager function prototype
       SourceRange getExpansionRange(SourceRange Range)
    to
       CharSourceRange getExpansionRange(SourceRange Range)
    and caused the following compilation failure:
    
      /home/yhs/work/bcc/src/cc/frontends/clang/b_frontend_action.cc:
      In member function ‘clang::SourceRange ebpf::ProbeVisitor::expansionRange(clang::SourceRange)’:
      /home/yhs/work/bcc/src/cc/frontends/clang/b_frontend_action.cc:267:58:
      error: could not convert ‘(&(&((ebpf::ProbeVisitor *)this)->ebpf::ProbeVisitor::rewriter_)
             ->clang::Rewriter::getSourceMgr())->clang::SourceManager::getExpansionRange(range)’
      from ‘clang::CharSourceRange’ to ‘clang::SourceRange’
         return rewriter_.getSourceMgr().getExpansionRange(range);
                                                                ^
      ...
    
    It is hard to find a compatible change which works
    for both old llvm and the latest change. So this patch
    just fixed the problem for clang 7.0.0 and the old code
    is used for clang 6.x and lower.
    Signed-off-by: default avatarYonghong Song <yhs@fb.com>
    806627e3
b_frontend_action.cc 36.6 KB