: 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);
}
--- /dev/null
+// RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -triple x86_64-apple-darwin -fobjc-runtime=macosx-10.10.0 -fblocks -fobjc-arc %s | FileCheck %s
+
+@interface Foo
+@end
+
+// CHECK-LABEL: doSomething:
+void doSomething() { // CHECK: File 0, [[@LINE]]:20 -> {{[0-9:]+}} = #0
+ return;
+ __block Foo *f; // CHECK: File 0, [[@LINE]]:3 -> {{[0-9:]+}} = 0
+}
+
+int main() {}