Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cpp/ql/integration-tests/header-variant-tests/clang-pch/a.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include "a.h"
#define FOUR 4
3 changes: 3 additions & 0 deletions cpp/ql/integration-tests/header-variant-tests/clang-pch/c.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int main() {
return ONE + FOUR;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#import "d.h"
3 changes: 3 additions & 0 deletions cpp/ql/integration-tests/header-variant-tests/clang-pch/e.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int main() {
return SEVENTEEN;
}
5 changes: 5 additions & 0 deletions cpp/ql/integration-tests/header-variant-tests/clang-pch/f.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#if 1
#pragma hdrstop
extern int x;
#define SEEN_F
#endif
5 changes: 5 additions & 0 deletions cpp/ql/integration-tests/header-variant-tests/clang-pch/g.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifdef SEEN_F
static int g() {
return 20;
}
#endif
4 changes: 4 additions & 0 deletions cpp/ql/integration-tests/header-variant-tests/clang-pch/h.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "h1.h"
#pragma hdrstop
#include "h2.h"
#define SEEN_H
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ static int h2() {
return 32;
}
#endif
// semmle-extractor-options: --clang -include-pch ${testdir}/clang-pch.testproj/h.pch
17 changes: 17 additions & 0 deletions cpp/ql/integration-tests/header-variant-tests/clang-pch/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os


def test(codeql, cpp):
os.mkdir("pch")
extractor = cpp.get_tool("extractor")
codeql.database.create(command=[
f'"{extractor}" --mimic-clang -emit-pch -o pch/a.pch a.c',
f'"{extractor}" --mimic-clang -include-pch pch/a.pch -Iextra_dummy_path b.c',
f'"{extractor}" --mimic-clang -include pch/a -Iextra_dummy_path c.c',
f'"{extractor}" --mimic-clang -emit-pch -o pch/d.pch d.c',
f'"{extractor}" --mimic-clang -include-pch pch/d.pch e.c',
f'"{extractor}" --mimic-clang -emit-pch -o pch/f.pch f.c',
f'"{extractor}" --mimic-clang -include-pch pch/f.pch g.c',
f'"{extractor}" --mimic-clang -emit-pch -o pch/h.pch h.c',
f'"{extractor}" --mimic-clang -include-pch pch/h.pch i.c',
])
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "a.h"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma hdrstop
#include "b.h"

int b() {
return A;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "d.h"
#include "c.h"

int c() {
return A;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import os


def test(codeql, cpp):
os.mkdir("pch")
extractor = cpp.get_tool("extractor")
codeql.database.create(command=[
f'"{extractor}" --mimic-cl /Yca.h /Fppch/a.pch a.c',
f'"{extractor}" --mimic-cl /Yub.h /Fppch/a.pch b.c',
f'"{extractor}" --mimic-cl /Yuc.h /Fppch/a.pch c.c',
])
3 changes: 0 additions & 3 deletions cpp/ql/test/header-variant-tests/clang-pch/_.c

This file was deleted.

3 changes: 0 additions & 3 deletions cpp/ql/test/header-variant-tests/clang-pch/a.c

This file was deleted.

4 changes: 0 additions & 4 deletions cpp/ql/test/header-variant-tests/clang-pch/c.c

This file was deleted.

2 changes: 0 additions & 2 deletions cpp/ql/test/header-variant-tests/clang-pch/d.c

This file was deleted.

4 changes: 0 additions & 4 deletions cpp/ql/test/header-variant-tests/clang-pch/e.c

This file was deleted.

6 changes: 0 additions & 6 deletions cpp/ql/test/header-variant-tests/clang-pch/f.c

This file was deleted.

6 changes: 0 additions & 6 deletions cpp/ql/test/header-variant-tests/clang-pch/g.c

This file was deleted.

5 changes: 0 additions & 5 deletions cpp/ql/test/header-variant-tests/clang-pch/h.c

This file was deleted.

3 changes: 0 additions & 3 deletions cpp/ql/test/header-variant-tests/microsoft-pch/_.c

This file was deleted.

2 changes: 0 additions & 2 deletions cpp/ql/test/header-variant-tests/microsoft-pch/a.c

This file was deleted.

7 changes: 0 additions & 7 deletions cpp/ql/test/header-variant-tests/microsoft-pch/b.c

This file was deleted.

7 changes: 0 additions & 7 deletions cpp/ql/test/header-variant-tests/microsoft-pch/c.c

This file was deleted.