Skip to content

Commit adfca18

Browse files
committed
chore: add autogenerated banner to cpp files
1 parent a8a7ef7 commit adfca18

3 files changed

Lines changed: 32 additions & 0 deletions

File tree

acvm-repo/acir/codegen/acir.cpp

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

acvm-repo/acir/codegen/witness.cpp

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

acvm-repo/acir/src/lib.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ mod reflection {
227227
MsgPackCodeGenerator::add_preamble(&mut source);
228228
MsgPackCodeGenerator::add_helpers(&mut source, namespace);
229229
MsgPackCodeGenerator::replace_array_with_shared_ptr(&mut source);
230+
MsgPackCodeGenerator::add_autogen_header(&mut source);
230231

231232
if !should_overwrite()
232233
&& let Some(old_hash) = old_hash
@@ -380,6 +381,23 @@ mod reflection {
380381
}
381382

382383
impl<'a> MsgPackCodeGenerator<'a> {
384+
/// Prepend a banner marking the file as auto-generated and pointing
385+
/// readers at the generator. Without it, the committed `.cpp` files
386+
/// look hand-written and an unsuspecting editor would lose their
387+
/// changes the next time the codegen tests run.
388+
pub(crate) fn add_autogen_header(source: &mut String) {
389+
let header = "\
390+
// AUTO-GENERATED — DO NOT EDIT.
391+
//
392+
// Generated by the `cpp_codegen` tests in `acvm-repo/acir/src/lib.rs`.
393+
// To regenerate, run:
394+
//
395+
// NOIR_CODEGEN_OVERWRITE=1 cargo test -p acir cpp_codegen
396+
//
397+
";
398+
source.insert_str(0, header);
399+
}
400+
383401
/// Add the import of the Barretenberg C++ header for msgpack.
384402
pub(crate) fn add_preamble(source: &mut String) {
385403
let inc = r#"#include "serde.hpp""#;

0 commit comments

Comments
 (0)