Skip to content

Commit a0430f3

Browse files
authored
Include and path handling optimization (#447)
1 parent c7e9974 commit a0430f3

File tree

5 files changed

+372
-476
lines changed

5 files changed

+372
-476
lines changed

integration_test.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,13 @@ def test_same_name_header(record_property, tmpdir):
237237
assert stderr == ""
238238

239239
def test_pragma_once_matching(record_property, tmpdir):
240-
if platform.system() == "win32":
240+
test_dir = os.path.join(tmpdir, "test_dir")
241+
test_subdir = os.path.join(test_dir, "test_subdir")
242+
243+
test_file = os.path.join(test_dir, "test.c")
244+
once_header = os.path.join(test_dir, "once.h")
245+
246+
if platform.system() == "Windows":
241247
names_to_test = [
242248
'"once.h"',
243249
'"Once.h"',
@@ -251,21 +257,21 @@ def test_pragma_once_matching(record_property, tmpdir):
251257
'"test_subdir/../Once.h"',
252258
'"Test_Subdir/../once.h"',
253259
'"Test_Subdir/../Once.h"',
260+
f"\"{test_dir}/once.h\"",
261+
f"\"{test_dir}/Once.h\"",
262+
f"<{test_dir}/once.h>",
263+
f"<{test_dir}/Once.h>",
254264
]
255265
else:
256266
names_to_test = [
257267
'"once.h"',
258268
'<once.h>',
259269
'"../test_dir/once.h"',
260270
'"test_subdir/../once.h"',
271+
f"\"{test_dir}/once.h\"",
272+
f"<{test_dir}/once.h>",
261273
]
262274

263-
test_dir = os.path.join(tmpdir, "test_dir")
264-
test_subdir = os.path.join(test_dir, "test_subdir")
265-
266-
test_file = os.path.join(test_dir, "test.c")
267-
once_header = os.path.join(test_dir, "once.h")
268-
269275
os.mkdir(test_dir)
270276
os.mkdir(test_subdir)
271277

main.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <cstring>
1010
#include <fstream>
1111
#include <iostream>
12-
#include <map>
1312
#include <string>
1413
#include <vector>
1514

@@ -128,7 +127,7 @@ int main(int argc, char **argv)
128127
}
129128
rawtokens->removeComments();
130129
simplecpp::TokenList outputTokens(files);
131-
std::map<std::string, simplecpp::TokenList*> filedata;
130+
simplecpp::FileDataCache filedata;
132131
simplecpp::preprocess(outputTokens, *rawtokens, files, filedata, dui, &outputList);
133132
simplecpp::cleanup(filedata);
134133
delete rawtokens;

0 commit comments

Comments
 (0)