Support assigning to a variable through an imported macro (#6827)

Support assigning to a variable through an imported macro

Example:

```carbon
import Cpp inline '''
int v = 1;
#define m v
''';

fn F() {
  Cpp.m = 2;
}
```
This commit is contained in:
Nicholas Bishop
2026-03-05 18:24:32 +00:00
committed by GitHub
parent 002b7c74ea
commit e5957037fb
4 changed files with 223 additions and 47 deletions
+1 -2
View File
@@ -2085,8 +2085,7 @@ static auto ImportMacro(Context& context, SemIR::LocId loc_id,
SemIR::NameScopeId scope_id, SemIR::NameId name_id,
clang::MacroInfo* macro_info)
-> SemIR::ScopeLookupResult {
auto inst_id =
TryEvaluateMacroToConstant(context, loc_id, name_id, macro_info);
auto inst_id = TryEvaluateMacro(context, loc_id, name_id, macro_info);
if (inst_id == SemIR::ErrorInst::InstId) {
return SemIR::ScopeLookupResult::MakeNotFound();
}