aboutsummaryrefslogtreecommitdiff
path: root/lib/xixanta
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-03-09 17:02:36 +0100
committerMiquel Sabaté Solà <mssola@mssola.com>2026-03-09 23:06:23 +0100
commitae54968ec2e2cac6cace95b25958ed5550d2aad9 (patch)
tree24f817999da8bdd264d38c222178637d66163760 /lib/xixanta
parent84eb36b71b61ee39794f1f262ad859843948e44c (diff)
downloadtools.nes-ae54968ec2e2cac6cace95b25958ed5550d2aad9.tar.gz
tools.nes-ae54968ec2e2cac6cace95b25958ed5550d2aad9.zip
asan: ignore names from macro arguments
These are usually capitalized, and thus they are not going to be following the usual zp_/m_/wr_ pattern. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'lib/xixanta')
-rw-r--r--lib/xixanta/src/assembler.rs8
-rw-r--r--lib/xixanta/src/object.rs3
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/xixanta/src/assembler.rs b/lib/xixanta/src/assembler.rs
index 3dc0577..d624c7e 100644
--- a/lib/xixanta/src/assembler.rs
+++ b/lib/xixanta/src/assembler.rs
@@ -1313,7 +1313,7 @@ impl<'a> Assembler<'a> {
node: Some(arg.clone()),
mapping: self.current_mapping,
segment: self.current_segment,
- object_type: ObjectType::Value,
+ object_type: ObjectType::Argument,
asan_ignore: false,
asan_reserve: 1,
accessed: 0,
@@ -2926,7 +2926,7 @@ impl<'a> Assembler<'a> {
// let it be (e.g. 'lda palettes, x'; where 'palettes' is a
// legitimate name even if not 'is_asan_friendly_name').
if let Ok(var) = self.context.get_variable(&node.value, &self.mappings) {
- if matches!(var.object_type, ObjectType::Address) {
+ if matches!(var.object_type, ObjectType::Address | ObjectType::Argument) {
return Ok(());
}
}
@@ -2957,12 +2957,12 @@ impl<'a> Assembler<'a> {
// If everything failed but because it was an address
// (e.g. 'lda palettes + 1, x'), then return early.
if let Ok(var) = self.context.get_variable(left_name, &self.mappings) {
- if matches!(var.object_type, ObjectType::Address) {
+ if matches!(var.object_type, ObjectType::Address | ObjectType::Argument) {
return Ok(());
}
}
if let Ok(var) = self.context.get_variable(right_name, &self.mappings) {
- if matches!(var.object_type, ObjectType::Address) {
+ if matches!(var.object_type, ObjectType::Address | ObjectType::Argument) {
return Ok(());
}
}
diff --git a/lib/xixanta/src/object.rs b/lib/xixanta/src/object.rs
index c70afb7..c16ddb0 100644
--- a/lib/xixanta/src/object.rs
+++ b/lib/xixanta/src/object.rs
@@ -119,6 +119,7 @@ impl Bundle {
pub enum ObjectType {
Address,
Value,
+ Argument,
}
/// Bundle and metadata which is stored on the context table for a given
@@ -241,7 +242,7 @@ impl Context {
match self.map.get_mut(scope_name) {
Some(scope) => match scope.get_mut(var_name) {
Some(var) => match var.object_type {
- ObjectType::Value => {
+ ObjectType::Value | ObjectType::Argument => {
var.accessed += 1;
Ok(var.clone())
}