• Lukasz Anforowicz's avatar
    Avoid rewriting C-only or |extern "C"| field decls. · 28d01461
    Lukasz Anforowicz authored
    CheckedPtr requires C++11 - including checked_ptr.h will cause
    compilation errors when compiling C-only sources.  This CL suppresses
    rewrites if the clang::CompilerInstance indicates that it is compiling
    a C-only source file.
    
    Additionally, the CL excludes from the rewrite fields declared under a
    |extern "C"| declaration context - such context is a strong hint that
    1) the struct might need to be used from a C-only source and
    2) the struct needs strict ABI compatibility (not guaranteed by the
       CheckedPtr which might repurpose some bits of the pointer).
    
    Bug: 1069567
    Change-Id: Ib146acbf1f5ae075c2498c000104cebe9cc36b71
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2181527Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
    Reviewed-by: default avatarBartek Nowierski <bartekn@chromium.org>
    Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#774754}
    28d01461
RewriteRawPtrFields.cpp 16.8 KB