Skip to content

Commit 1def108

Browse files
committed
Instantiate templates when CLI is invoked with -fcheck
Signed-off-by: Roberto Raggi <[email protected]>
1 parent d5b9752 commit 1def108

File tree

14 files changed

+9
-19
lines changed

14 files changed

+9
-19
lines changed

scripts/update-tests.mjs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,8 @@ async function updateTest(unitTestPath) {
5151

5252
const fcheck = sourceLines[index]?.includes("-fcheck") ? "-fcheck" : "";
5353

54-
const ftemplates = sourceLines[index]?.includes("-ftemplates")
55-
? "-ftemplates"
56-
: "";
57-
5854
const ast =
59-
await $`${cxx} -verify -ast-dump ${unitTestPath} ${fcheck} ${ftemplates}`.quiet();
55+
await $`${cxx} -verify -ast-dump ${unitTestPath} ${fcheck}`.quiet();
6056

6157
const lines = ast.stdout.split("\n");
6258

src/frontend/cxx/frontend.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,6 @@ auto runOnFile(const CLI& cli, const std::string& fileName) -> bool {
316316
.fuzzyTemplateResolution = true,
317317
.staticAssert = cli.opt_fstatic_assert || cli.opt_fcheck,
318318
.reflect = !cli.opt_fno_reflect,
319-
.templates = cli.opt_ftemplates,
320319
});
321320

322321
if (cli.opt_freport_missing_types) {

src/lsp/cxx/lsp/cxx_document.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ void CxxDocument::parse(std::string source) {
273273
.fuzzyTemplateResolution = true,
274274
.staticAssert = cli.opt_fstatic_assert || cli.opt_fcheck,
275275
.reflect = !cli.opt_fno_reflect,
276-
.templates = cli.opt_ftemplates,
277276
.stopParsingPredicate = stopParsingPredicate,
278277
.complete = complete,
279278
});

src/parser/cxx/cli.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,6 @@ std::vector<CLIOptionDescr> options{
149149
{"-fstatic-assert", "Enable static asserts", &CLI::opt_fstatic_assert,
150150
CLIOptionVisibility::kExperimental},
151151

152-
{"-ftemplates", "Enable templates (WIP)", &CLI::opt_ftemplates},
153-
154152
{"-freport-missing-types", "Report missing types",
155153
&CLI::opt_freport_missing_types},
156154

src/parser/cxx/cli.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ class CLI {
6868
bool opt_fsyntax_only = false;
6969
bool opt_fstatic_assert = false;
7070
bool opt_fcheck = false;
71-
bool opt_ftemplates = false;
7271
bool opt_freport_missing_types = false;
7372
bool opt_fno_reflect = false;
7473
bool opt_verify = false;

src/parser/cxx/parser.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5807,7 +5807,7 @@ auto Parser::parse_complex_type_specifier(SpecifierAST*& yyast,
58075807
}
58085808

58095809
auto Parser::instantiate(SimpleTemplateIdAST* templateId) -> Symbol* {
5810-
if (!config_.templates) return nullptr;
5810+
if (!config_.checkTypes) return nullptr;
58115811

58125812
std::vector<TemplateArgument> args;
58135813
for (auto it = templateId->templateArgumentList; it; it = it->next) {

src/parser/cxx/parser_fwd.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ struct ParserConfiguration {
4949
bool fuzzyTemplateResolution = false;
5050
bool staticAssert = false;
5151
bool reflect = true;
52-
bool templates = false;
5352
std::function<bool()> stopParsingPredicate;
5453
std::function<void(const CodeCompletionContext&)> complete;
5554
};

tests/unit_tests/sema/template_alias_01.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %cxx -fcheck -ftemplates -dump-symbols %s | %filecheck %s
1+
// RUN: %cxx -fcheck -dump-symbols %s | %filecheck %s
22

33
template <typename T>
44
using Pointer = T*;

tests/unit_tests/sema/template_alias_02.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %cxx -verify -fcheck -ftemplates -dump-symbols %s | %filecheck %s
1+
// RUN: %cxx -verify -fcheck -dump-symbols %s | %filecheck %s
22

33
template <typename Key, typename Value>
44
struct HashMap {

tests/unit_tests/sema/template_class_01.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %cxx -verify -fcheck -ftemplates -dump-symbols %s | %filecheck %s
1+
// RUN: %cxx -verify -fcheck -dump-symbols %s | %filecheck %s
22

33
template <typename T>
44
struct A {

0 commit comments

Comments
 (0)