[PATCH] D83592: [Coverage] Add comment to skipped regions

Zequan Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 23 16:02:41 PDT 2020


zequanwu updated this revision to Diff 280283.
zequanwu edited the summary of this revision.
zequanwu added a comment.

In `Preprocessor.cpp`, don't increment `TokenCount` if `LexLevel == 0`.

I tests this with chromium crypto_unittests. It doesn't track comments regions.

I don't why when using the cmake option `-DLLVM_BUILD_INSTRUMENTED_COVERAGE=On` to test coverage for clang itself, it does tracking comments.
Also, with that option on, `llvm-cov` crashes at assertion:`llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp:578: virtual Expected<const char *> (anonymous namespace)::VersionedCovMapFuncRecordReader<llvm::coverage::Version4, unsigned long, llvm::support::little>::readCoverageHeader(const char *, const char *, BinaryCoverageReader::DecompressedData &) [Version = llvm::coverage::Version4, IntPtrT = unsigned long, Endian = llvm::support::little]: Assertion `(CovMapVersion)CovHeader->getVersion<Endian>() == Version' failed.`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83592/new/

https://reviews.llvm.org/D83592

Files:
  clang/include/clang/Lex/Preprocessor.h
  clang/lib/CodeGen/CodeGenAction.cpp
  clang/lib/CodeGen/CoverageMappingGen.cpp
  clang/lib/CodeGen/CoverageMappingGen.h
  clang/lib/Lex/Preprocessor.cpp
  clang/test/CoverageMapping/break.c
  clang/test/CoverageMapping/builtinmacro.c
  clang/test/CoverageMapping/classtemplate.cpp
  clang/test/CoverageMapping/comment-in-macro.c
  clang/test/CoverageMapping/continue.c
  clang/test/CoverageMapping/coroutine.cpp
  clang/test/CoverageMapping/deferred-region.cpp
  clang/test/CoverageMapping/if.cpp
  clang/test/CoverageMapping/includehell.cpp
  clang/test/CoverageMapping/label.cpp
  clang/test/CoverageMapping/logical.cpp
  clang/test/CoverageMapping/loops.cpp
  clang/test/CoverageMapping/macro-expressions.cpp
  clang/test/CoverageMapping/macroparams2.c
  clang/test/CoverageMapping/macros.c
  clang/test/CoverageMapping/macroscopes.cpp
  clang/test/CoverageMapping/moremacros.c
  clang/test/CoverageMapping/objc.m
  clang/test/CoverageMapping/pr32679.cpp
  clang/test/CoverageMapping/preprocessor.c
  clang/test/CoverageMapping/return.c
  clang/test/CoverageMapping/switch.cpp
  clang/test/CoverageMapping/switchmacro.c
  clang/test/CoverageMapping/test.c
  clang/test/CoverageMapping/trycatch.cpp
  clang/test/CoverageMapping/unreachable-macro.c
  clang/test/CoverageMapping/while.c
  clang/test/lit.cfg.py
  compiler-rt/test/profile/Inputs/instrprof-comdat.h
  compiler-rt/test/profile/coverage_comments.cpp
  compiler-rt/test/profile/instrprof-set-file-object-merging.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83592.280283.patch
Type: text/x-patch
Size: 37169 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200723/ab9deeec/attachment-0001.bin>


More information about the cfe-commits mailing list