diff options
author | Justin Bogner <mail@justinbogner.com> | 2015-05-05 21:46:14 +0000 |
---|---|---|
committer | Justin Bogner <mail@justinbogner.com> | 2015-05-05 21:46:14 +0000 |
commit | 6d721fa28c868eaaf06ab417131c10d13c3ed10f (patch) | |
tree | ec77e26f2457f68a1d6f9a20ebfc2a1f2d2743e6 /clang/lib/CodeGen/CoverageMappingGen.cpp | |
parent | 801caff64d2f3eea7b97270855d765c34e102c19 (diff) | |
download | bcm5719-llvm-6d721fa28c868eaaf06ab417131c10d13c3ed10f.tar.gz bcm5719-llvm-6d721fa28c868eaaf06ab417131c10d13c3ed10f.zip |
InstrProf: Don't start or end coverage regions inside of system macros
It doesn't make much sense to try to show coverage inside system
macros, and source locations in builtins confuses the coverage
mapping. Just avoid doing this.
Fixes an assert that fired when a __block storage specifier starts a
region.
llvm-svn: 236547
Diffstat (limited to 'clang/lib/CodeGen/CoverageMappingGen.cpp')
-rw-r--r-- | clang/lib/CodeGen/CoverageMappingGen.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp index fca17264e8f..65415d9d2d2 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.cpp +++ b/clang/lib/CodeGen/CoverageMappingGen.cpp @@ -134,18 +134,18 @@ public: : SM.getIncludeLoc(SM.getFileID(Loc)); } - /// \brief Get the start of \c S ignoring macro argument locations. + /// \brief Get the start of \c S ignoring macro arguments and system macros. SourceLocation getStart(const Stmt *S) { SourceLocation Loc = S->getLocStart(); - while (SM.isMacroArgExpansion(Loc)) + while (SM.isMacroArgExpansion(Loc) || SM.isInSystemMacro(Loc)) Loc = SM.getImmediateExpansionRange(Loc).first; return Loc; } - /// \brief Get the end of \c S ignoring macro argument locations. + /// \brief Get the end of \c S ignoring macro arguments and system macros. SourceLocation getEnd(const Stmt *S) { SourceLocation Loc = S->getLocEnd(); - while (SM.isMacroArgExpansion(Loc)) + while (SM.isMacroArgExpansion(Loc) || SM.isInSystemMacro(Loc)) Loc = SM.getImmediateExpansionRange(Loc).first; return getPreciseTokenLocEnd(Loc); } |