]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Add call to ast validation checker
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Tue, 24 Oct 2023 14:46:21 +0000 (16:46 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:13:10 +0000 (19:13 +0100)
Add call to ast validation check, also add appropriate step to this pass
and the feature gating.

gcc/rust/ChangeLog:

* rust-session-manager.cc (Session::compile_crate): Add call to ast
validation.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/rust-session-manager.cc

index b1ecb8ca32e1d70e944952963c8c3069f1cb0512..62c47b2e6de33d0f764d5dddac93fc16530cfe42 100644 (file)
@@ -47,6 +47,7 @@
 #include "rust-unicode.h"
 #include "rust-attribute-values.h"
 #include "rust-borrow-checker.h"
+#include "rust-ast-validation.h"
 
 #include "input.h"
 #include "selftest.h"
@@ -600,7 +601,15 @@ Session::compile_crate (const char *filename)
       rust_debug ("END POST-EXPANSION AST DUMP");
     }
 
+  // AST Validation pass
+  if (last_step == CompileOptions::CompileStep::ASTValidation)
+    return;
+
+  ASTValidation ().check (parsed_crate);
+
   // feature gating
+  if (last_step == CompileOptions::CompileStep::FeatureGating)
+    return;
   FeatureGate ().check (parsed_crate);
 
   if (last_step == CompileOptions::CompileStep::NameResolution)