Skip to content

Commit

Permalink
Merged master:320389e849f into amd-gfx:a4a145f548f
Browse files Browse the repository at this point in the history
Local branch amd-gfx a4a145f Merged master:a361aa52498 into amd-gfx:81d68cace0c
Remote branch master 320389e [flang] Fix source line continuation in potential macro calls (bugzilla 46768)
  • Loading branch information
Sw authored and Sw committed Jul 22, 2020
2 parents a4a145f + 320389e commit 6a6cb0e
Show file tree
Hide file tree
Showing 81 changed files with 717 additions and 223 deletions.
5 changes: 5 additions & 0 deletions clang/include/clang/Lex/Preprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,9 @@ class Preprocessor {
/// The number of (LexLevel 0) preprocessor tokens.
unsigned TokenCount = 0;

/// Preprocess every token regardless of LexLevel.
bool PreprocessToken = false;

/// The maximum number of (LexLevel 0) tokens before issuing a -Wmax-tokens
/// warning, or zero for unlimited.
unsigned MaxTokens = 0;
Expand Down Expand Up @@ -1038,6 +1041,8 @@ class Preprocessor {
OnToken = std::move(F);
}

void setPreprocessToken(bool Preprocess) { PreprocessToken = Preprocess; }

bool isMacroDefined(StringRef Id) {
return isMacroDefined(&Identifiers.get(Id));
}
Expand Down
12 changes: 9 additions & 3 deletions clang/lib/CodeGen/CGStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1954,12 +1954,16 @@ static llvm::MDNode *getAsmSrcLocInfo(const StringLiteral *Str,
}

static void UpdateAsmCallInst(llvm::CallBase &Result, bool HasSideEffect,
bool ReadOnly, bool ReadNone, const AsmStmt &S,
bool ReadOnly, bool ReadNone, bool NoMerge,
const AsmStmt &S,
const std::vector<llvm::Type *> &ResultRegTypes,
CodeGenFunction &CGF,
std::vector<llvm::Value *> &RegResults) {
Result.addAttribute(llvm::AttributeList::FunctionIndex,
llvm::Attribute::NoUnwind);
if (NoMerge)
Result.addAttribute(llvm::AttributeList::FunctionIndex,
llvm::Attribute::NoMerge);
// Attach readnone and readonly attributes.
if (!HasSideEffect) {
if (ReadNone)
Expand Down Expand Up @@ -2334,12 +2338,14 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
Builder.CreateCallBr(IA, Fallthrough, Transfer, Args);
EmitBlock(Fallthrough);
UpdateAsmCallInst(cast<llvm::CallBase>(*Result), HasSideEffect, ReadOnly,
ReadNone, S, ResultRegTypes, *this, RegResults);
ReadNone, InNoMergeAttributedStmt, S, ResultRegTypes,
*this, RegResults);
} else {
llvm::CallInst *Result =
Builder.CreateCall(IA, Args, getBundlesForFunclet(IA));
UpdateAsmCallInst(cast<llvm::CallBase>(*Result), HasSideEffect, ReadOnly,
ReadNone, S, ResultRegTypes, *this, RegResults);
ReadNone, InNoMergeAttributedStmt, S, ResultRegTypes,
*this, RegResults);
}

assert(RegResults.size() == ResultRegTypes.size());
Expand Down
8 changes: 3 additions & 5 deletions clang/lib/CodeGen/CodeGenAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -990,11 +990,9 @@ CodeGenAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {

CoverageSourceInfo *CoverageInfo = nullptr;
// Add the preprocessor callback only when the coverage mapping is generated.
if (CI.getCodeGenOpts().CoverageMapping) {
CoverageInfo = new CoverageSourceInfo;
CI.getPreprocessor().addPPCallbacks(
std::unique_ptr<PPCallbacks>(CoverageInfo));
}
if (CI.getCodeGenOpts().CoverageMapping)
CoverageInfo = CodeGen::CoverageMappingModuleGen::setUpCoverageCallbacks(
CI.getPreprocessor());

std::unique_ptr<BackendConsumer> Result(new BackendConsumer(
BA, CI.getDiagnostics(), CI.getHeaderSearchOpts(),
Expand Down
74 changes: 69 additions & 5 deletions clang/lib/CodeGen/CoverageMappingGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,40 @@ using namespace clang;
using namespace CodeGen;
using namespace llvm::coverage;

CoverageSourceInfo *
CoverageMappingModuleGen::setUpCoverageCallbacks(Preprocessor &PP) {
CoverageSourceInfo *CoverageInfo = new CoverageSourceInfo;
PP.addPPCallbacks(std::unique_ptr<PPCallbacks>(CoverageInfo));
PP.addCommentHandler(CoverageInfo);
PP.setPreprocessToken(true);
PP.setTokenWatcher([CoverageInfo](clang::Token Tok) {
// Update previous token location.
CoverageInfo->PrevTokLoc = Tok.getLocation();
CoverageInfo->updateNextTokLoc(Tok.getLocation());
});
return CoverageInfo;
}

void CoverageSourceInfo::SourceRangeSkipped(SourceRange Range, SourceLocation) {
SkippedRanges.push_back(Range);
SkippedRanges.push_back({Range});
}

bool CoverageSourceInfo::HandleComment(Preprocessor &PP, SourceRange Range) {
if (PrevTokLoc.isValid() && PrevTokLoc == BeforeCommentLoc)
SkippedRanges.back().Range.setEnd(Range.getEnd());
else {
SkippedRanges.push_back({Range, PrevTokLoc});
BeforeCommentLoc = PrevTokLoc;
}
LastCommentIndex = SkippedRanges.size() - 1;
return false;
}

void CoverageSourceInfo::updateNextTokLoc(SourceLocation Loc) {
if (LastCommentIndex) {
SkippedRanges[LastCommentIndex.getValue()].NextTokLoc = Loc;
LastCommentIndex = None;
}
}

namespace {
Expand Down Expand Up @@ -274,8 +306,34 @@ class CoverageMappingBuilder {
return None;
}

/// This shrinks the skipped range if it spans a line that contains a
/// non-comment token. If shrinking the skipped range would make it empty,
/// this returns None.
Optional<SpellingRegion> adjustSkippedRange(SourceManager &SM,
SpellingRegion SR,
SourceLocation PrevTokLoc,
SourceLocation NextTokLoc) {
// If Range begin location is invalid, it's not a comment region.
if (PrevTokLoc.isInvalid())
return SR;
unsigned PrevTokLine = SM.getSpellingLineNumber(PrevTokLoc);
unsigned NextTokLine = SM.getSpellingLineNumber(NextTokLoc);
SpellingRegion newSR(SR);
if (SR.LineStart == PrevTokLine) {
newSR.LineStart = SR.LineStart + 1;
newSR.ColumnStart = 1;
}
if (SR.LineEnd == NextTokLine) {
newSR.LineEnd = SR.LineEnd - 1;
newSR.ColumnEnd = 1;
}
if (newSR.isInSourceOrder())
return newSR;
return None;
}

/// Gather all the regions that were skipped by the preprocessor
/// using the constructs like #if.
/// using the constructs like #if or comments.
void gatherSkippedRegions() {
/// An array of the minimum lineStarts and the maximum lineEnds
/// for mapping regions from the appropriate source files.
Expand All @@ -291,16 +349,22 @@ class CoverageMappingBuilder {
}

auto SkippedRanges = CVM.getSourceInfo().getSkippedRanges();
for (const auto &I : SkippedRanges) {
auto LocStart = I.getBegin();
auto LocEnd = I.getEnd();
for (auto &I : SkippedRanges) {
SourceRange Range = I.Range;
auto LocStart = Range.getBegin();
auto LocEnd = Range.getEnd();
assert(SM.isWrittenInSameFile(LocStart, LocEnd) &&
"region spans multiple files");

auto CovFileID = getCoverageFileID(LocStart);
if (!CovFileID)
continue;
SpellingRegion SR{SM, LocStart, LocEnd};
if (Optional<SpellingRegion> res =
adjustSkippedRange(SM, SR, I.PrevTokLoc, I.NextTokLoc))
SR = res.getValue();
else
continue;
auto Region = CounterMappingRegion::makeSkipped(
*CovFileID, SR.LineStart, SR.ColumnStart, SR.LineEnd, SR.ColumnEnd);
// Make sure that we only collect the regions that are inside
Expand Down
36 changes: 33 additions & 3 deletions clang/lib/CodeGen/CoverageMappingGen.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Lex/PPCallbacks.h"
#include "clang/Lex/Preprocessor.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/Support/raw_ostream.h"
Expand All @@ -29,15 +30,42 @@ class Preprocessor;
class Decl;
class Stmt;

struct SkippedRange {
SourceRange Range;
// The location of token before the skipped source range.
SourceLocation PrevTokLoc;
// The location of token after the skipped source range.
SourceLocation NextTokLoc;

SkippedRange(SourceRange Range, SourceLocation PrevTokLoc = SourceLocation(),
SourceLocation NextTokLoc = SourceLocation())
: Range(Range), PrevTokLoc(PrevTokLoc), NextTokLoc(NextTokLoc) {}
};

/// Stores additional source code information like skipped ranges which
/// is required by the coverage mapping generator and is obtained from
/// the preprocessor.
class CoverageSourceInfo : public PPCallbacks {
std::vector<SourceRange> SkippedRanges;
class CoverageSourceInfo : public PPCallbacks, public CommentHandler {
// A vector of skipped source ranges and PrevTokLoc with NextTokLoc.
std::vector<SkippedRange> SkippedRanges;
Optional<unsigned> LastCommentIndex = None;

public:
ArrayRef<SourceRange> getSkippedRanges() const { return SkippedRanges; }
// Location of the token parsed before HandleComment is called. This is
// updated every time Preprocessor::Lex lexes a new token.
SourceLocation PrevTokLoc;
// The location of token before comment.
SourceLocation BeforeCommentLoc;

std::vector<SkippedRange> &getSkippedRanges() {
return SkippedRanges;
}

void SourceRangeSkipped(SourceRange Range, SourceLocation EndifLoc) override;

bool HandleComment(Preprocessor &PP, SourceRange Range) override;

void updateNextTokLoc(SourceLocation Loc);
};

namespace CodeGen {
Expand Down Expand Up @@ -66,6 +94,8 @@ class CoverageMappingModuleGen {
uint64_t FilenamesRef);

public:
static CoverageSourceInfo *setUpCoverageCallbacks(Preprocessor &PP);

CoverageMappingModuleGen(CodeGenModule &CGM, CoverageSourceInfo &SourceInfo)
: CGM(CGM), SourceInfo(SourceInfo) {}

Expand Down
3 changes: 2 additions & 1 deletion clang/lib/Lex/Preprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,8 @@ void Preprocessor::Lex(Token &Result) {
LastTokenWasAt = Result.is(tok::at);
--LexLevel;

if (LexLevel == 0 && !Result.getFlag(Token::IsReinjected)) {
if ((LexLevel == 0 || PreprocessToken) &&
!Result.getFlag(Token::IsReinjected)) {
++TokenCount;
if (OnToken)
OnToken(Result);
Expand Down
1 change: 1 addition & 0 deletions clang/lib/Sema/SemaStmtAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ class CallExprFinder : public ConstEvaluatedExprVisitor<CallExprFinder> {
bool foundCallExpr() { return FoundCallExpr; }

void VisitCallExpr(const CallExpr *E) { FoundCallExpr = true; }
void VisitAsmStmt(const AsmStmt *S) { FoundCallExpr = true; }

void Visit(const Stmt *St) {
if (!St)
Expand Down
3 changes: 3 additions & 0 deletions clang/test/CodeGen/attr-nomerge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ void foo(int i) {
[[clang::nomerge]] f(bar(), bar());
[[clang::nomerge]] [] { bar(); bar(); }(); // nomerge only applies to the anonymous function call
[[clang::nomerge]] for (bar(); bar(); bar()) {}
[[clang::nomerge]] { asm("nop"); }
bar();
}
// CHECK: call zeroext i1 @_Z3barv() #[[NOMERGEATTR:[0-9]+]]
Expand All @@ -22,5 +23,7 @@ void foo(int i) {
// CHECK: call zeroext i1 @_Z3barv() #[[NOMERGEATTR]]
// CHECK: call zeroext i1 @_Z3barv() #[[NOMERGEATTR]]
// CHECK: call zeroext i1 @_Z3barv() #[[NOMERGEATTR]]
// CHECK: call void asm {{.*}} #[[NOMERGEATTR2:[0-9]+]]
// CHECK: call zeroext i1 @_Z3barv()
// CHECK: attributes #[[NOMERGEATTR]] = { nomerge }
// CHECK: attributes #[[NOMERGEATTR2]] = { nomerge nounwind }
3 changes: 2 additions & 1 deletion clang/test/CoverageMapping/break.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name break.c %s | FileCheck %s
// RUN: %strip_comments > %t.stripped.c
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name break.c %t.stripped.c | FileCheck %s

int main() { // CHECK: File 0, [[@LINE]]:12 -> {{[0-9]+}}:2 = #0
int cnt = 0; // CHECK-NEXT: File 0, [[@LINE+1]]:9 -> [[@LINE+1]]:18 = #0
Expand Down
3 changes: 2 additions & 1 deletion clang/test/CoverageMapping/builtinmacro.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name builtinmacro.c %s | FileCheck %s
// RUN: %strip_comments > %t.stripped.c
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name builtinmacro.c %t.stripped.c | FileCheck %s

// Test the coverage mapping generation for built-in macroes.

Expand Down
3 changes: 2 additions & 1 deletion clang/test/CoverageMapping/classtemplate.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple %itanium_abi_triple -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name classtemplate.cpp %s > %tmapping
// RUN: %strip_comments > %t.stripped.cpp
// RUN: %clang_cc1 -triple %itanium_abi_triple -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name classtemplate.cpp %t.stripped.cpp > %tmapping
// RUN: FileCheck -input-file %tmapping %s --check-prefix=CHECK-CONSTRUCTOR
// RUN: FileCheck -input-file %tmapping %s --check-prefix=CHECK-GETTER
// RUN: FileCheck -input-file %tmapping %s --check-prefix=CHECK-SETTER
Expand Down
7 changes: 4 additions & 3 deletions clang/test/CoverageMapping/comment-in-macro.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only %s | FileCheck %s
// RUN: %strip_comments > %t.stripped.c
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only %t.stripped.c | FileCheck %s

#define x1 "" // ...
#define x2 return 0
Expand All @@ -7,5 +8,5 @@ int main() { // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+3]]:2 = #0
x1; // CHECK-NEXT: Expansion,File 0, [[@LINE]]:3 -> [[@LINE]]:5 = #0
x2; // CHECK-NEXT: Expansion,File 0, [[@LINE]]:3 -> [[@LINE]]:5 = #0
}
// CHECK-NEXT: File 1, 3:12 -> 3:14 = #0
// CHECK-NEXT: File 2, 4:12 -> 4:20 = #0
// CHECK-NEXT: File 1, 4:12 -> 4:14 = #0
// CHECK-NEXT: File 2, 5:12 -> 5:20 = #0
3 changes: 2 additions & 1 deletion clang/test/CoverageMapping/continue.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name continue.c %s | FileCheck %s
// RUN: %strip_comments > %t.stripped.c
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name continue.c %t.stripped.c | FileCheck %s

int main() { // CHECK: File 0, [[@LINE]]:12 -> [[@LINE+21]]:2 = #0
int j = 0; // CHECK-NEXT: File 0, [[@LINE+2]]:18 -> [[@LINE+2]]:24 = (#0 + #1)
Expand Down
3 changes: 2 additions & 1 deletion clang/test/CoverageMapping/coroutine.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// fixme: the following line is added to cleanup bots, will be removed in weeks.
// RUN: rm -f %S/coroutine.ll
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcoroutines-ts -std=c++14 -emit-llvm -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping %s -o - | FileCheck %s
// RUN: %strip_comments > %t.stripped.cpp
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcoroutines-ts -std=c++14 -emit-llvm -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping %t.stripped.cpp -o - | FileCheck %s

namespace std::experimental {
template <typename... T>
Expand Down
3 changes: 2 additions & 1 deletion clang/test/CoverageMapping/deferred-region.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -std=c++11 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -fexceptions -fcxx-exceptions -emit-llvm-only -triple %itanium_abi_triple -main-file-name deferred-region.cpp -I %S/Inputs %s | FileCheck %s
// RUN: %strip_comments > %t.stripped.cpp
// RUN: %clang_cc1 -std=c++11 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -fexceptions -fcxx-exceptions -emit-llvm-only -triple %itanium_abi_triple -main-file-name deferred-region.cpp -I %S/Inputs %t.stripped.cpp | FileCheck %s

#define IF if
#define STMT(S) S
Expand Down
3 changes: 2 additions & 1 deletion clang/test/CoverageMapping/if.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -std=c++1z -triple %itanium_abi_triple -main-file-name if.cpp %s | FileCheck %s
// RUN: %strip_comments > %t.stripped.cpp
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -std=c++1z -triple %itanium_abi_triple -main-file-name if.cpp %t.stripped.cpp | FileCheck %s

int nop() { return 0; }

Expand Down
6 changes: 4 additions & 2 deletions clang/test/CoverageMapping/includehell.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name includehell.cpp %s > %tmapping

// RUN: %strip_comments > %t.stripped.cpp
// RUN: %clang_cc1 -I/%S -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name includehell.cpp %t.stripped.cpp > %tmapping
int main() {
int x = 0;

Expand Down Expand Up @@ -51,13 +51,15 @@ int main() {
// CHECK-START: File [[START3]], 4:29 -> 5:1 = #9

// CHECK-CODE: File [[CODE1:[0-9]]], 1:1 -> 14:1 = #1
// CHECK-CODE: Skipped,File [[CODE1]], 1:1 -> 1:41 = 0
// CHECK-CODE-NEXT: File [[CODE1]], 4:5 -> 4:11 = #1
// CHECK-CODE: File [[CODE1]], 4:13 -> 6:2 = #2
// CHECK-CODE: File [[CODE1]], 6:8 -> 8:2 = (#1 - #2)
// CHECK-CODE-NEXT: File [[CODE1]], 9:5 -> 9:9 = #1
// CHECK-CODE: File [[CODE1]], 9:11 -> 11:2 = #3
// CHECK-CODE: File [[CODE1]], 11:8 -> 13:2 = (#1 - #3)
// CHECK-CODE: File [[CODE2:[0-9]]], 1:1 -> 14:1 = #5
// CHECK-CODE: Skipped,File [[CODE2]], 1:1 -> 1:41 = 0
// CHECK-CODE-NEXT: File [[CODE2]], 4:5 -> 4:11 = #5
// CHECK-CODE: File [[CODE2]], 4:13 -> 6:2 = #6
// CHECK-CODE: File [[CODE2]], 6:8 -> 8:2 = (#5 - #6)
Expand Down
5 changes: 3 additions & 2 deletions clang/test/CoverageMapping/label.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name label.cpp %s | FileCheck %s
// RUN: %strip_comments > %t.stripped.cpp
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name label.cpp %t.stripped.cpp | FileCheck %s

// CHECK: func
// CHECK: func
void func() { // CHECK-NEXT: File 0, [[@LINE]]:13 -> {{[0-9]+}}:2 = #0
int i = 0; // CHECK-NEXT: File 0, [[@LINE+2]]:14 -> [[@LINE+2]]:20 = (#0 + #3)
// CHECK-NEXT: File 0, [[@LINE+1]]:22 -> [[@LINE+1]]:25 = #3
Expand Down
3 changes: 2 additions & 1 deletion clang/test/CoverageMapping/logical.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name logical.cpp %s | FileCheck %s
// RUN: %strip_comments > %t.stripped.cpp
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name logical.cpp %t.stripped.cpp | FileCheck %s

int main() { // CHECK: File 0, [[@LINE]]:12 -> [[@LINE+15]]:2 = #0
bool bt = true;
Expand Down
5 changes: 3 additions & 2 deletions clang/test/CoverageMapping/loops.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 -std=c++11 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name loops.cpp %s | FileCheck %s
// RUN: %strip_comments > %t.stripped.cpp
// RUN: %clang_cc1 -std=c++11 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name loops.cpp %t.stripped.cpp | FileCheck %s

// CHECK: rangedFor
// CHECK: rangedFor
void rangedFor() { // CHECK-NEXT: File 0, [[@LINE]]:18 -> {{[0-9]+}}:2 = #0
int arr[] = { 1, 2, 3, 4, 5 };
int sum = 0; // CHECK: Gap,File 0, [[@LINE+1]]:20 -> [[@LINE+1]]:21 = #1
Expand Down
4 changes: 2 additions & 2 deletions clang/test/CoverageMapping/macro-expressions.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -std=c++11 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name macro-expressions.cpp -w %s | FileCheck %s

// RUN: %strip_comments > %t.stripped.cpp
// RUN: %clang_cc1 -std=c++11 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name macro-expressions.cpp -w %t.stripped.cpp | FileCheck %s
#define EXPR(x) (x)
#define NEXPR(x) (!x)
#define DECL(T, x) T x
Expand Down
Loading

0 comments on commit 6a6cb0e

Please sign in to comment.