Skip to content

Commit 44b9cc2

Browse files
committed
updte
1 parent 43270c3 commit 44b9cc2

5 files changed

Lines changed: 375 additions & 420 deletions

File tree

Cargo.lock

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

crates/llmcc-core/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ parking_lot.workspace = true
3131
dashmap.workspace = true
3232
smallvec.workspace = true
3333
uuid.workspace = true
34+
serde_json.workspace = true
35+
toml.workspace = true
3436

3537
[dev-dependencies]
3638
pretty_assertions.workspace = true

crates/llmcc-core/src/context.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use uuid::Uuid;
1414
use crate::block::{BasicBlock, BlockArena, BlockId, reset_block_id_counter};
1515
use crate::block_rel::{BlockIndexMaps, BlockRelationMap};
1616
use crate::file::File;
17-
use crate::meta::{UnitMeta, UnitMetaBuilder};
17+
use crate::meta::{SourceFileMetadata, SourceLayoutIndex};
1818

1919
/// Controls how files are ordered after parallel reading.
2020
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
@@ -182,7 +182,7 @@ impl<'tcx> CompileUnit<'tcx> {
182182

183183
/// Get the module metadata for this compilation unit.
184184
/// Contains package/module/file names and roots.
185-
pub fn unit_meta(&self) -> &UnitMeta {
185+
pub fn unit_meta(&self) -> &SourceFileMetadata {
186186
&self.cc.unit_metas[self.index]
187187
}
188188

@@ -329,7 +329,7 @@ pub struct CompileCtxt<'tcx> {
329329
pub interner: InternPool,
330330
pub files: Vec<File>,
331331
/// Per-file metadata: package/module/file names and roots.
332-
pub unit_metas: Vec<UnitMeta>,
332+
pub unit_metas: Vec<SourceFileMetadata>,
333333
/// Generic parse trees from language-specific parsers
334334
pub parse_trees: Vec<Box<dyn ParseTree>>,
335335
pub hir_root_ids: RwLock<Vec<Option<HirId>>>,
@@ -417,7 +417,7 @@ impl<'tcx> CompileCtxt<'tcx> {
417417
let (parse_trees, mut metrics) = Self::parse_files_with_metrics::<L>(&files)?;
418418
metrics.file_read_seconds = file_read_seconds;
419419

420-
// Build unit metadata using UnitMetaBuilder
420+
// Build unit metadata using SourceLayoutIndex
421421
let unit_metas = Self::build_unit_metas::<L>(&files);
422422
let count = unit_metas.len();
423423

@@ -477,7 +477,7 @@ impl<'tcx> CompileCtxt<'tcx> {
477477
let (parse_trees, mut metrics) = Self::parse_files_with_metrics::<L>(&files)?;
478478
metrics.file_read_seconds = file_read_seconds;
479479

480-
// Build unit metadata using UnitMetaBuilder
480+
// Build unit metadata using SourceLayoutIndex
481481
let unit_metas = Self::build_unit_metas::<L>(&files);
482482
let count = unit_metas.len();
483483

@@ -495,8 +495,8 @@ impl<'tcx> CompileCtxt<'tcx> {
495495
})
496496
}
497497

498-
/// Build unit metadata for all files using UnitMetaBuilder.
499-
fn build_unit_metas<L: Language>(files: &[File]) -> Vec<UnitMeta> {
498+
/// Build unit metadata for all files using SourceLayoutIndex.
499+
fn build_unit_metas<L: Language>(files: &[File]) -> Vec<SourceFileMetadata> {
500500
if files.is_empty() {
501501
return Vec::new();
502502
}
@@ -508,20 +508,20 @@ impl<'tcx> CompileCtxt<'tcx> {
508508
.collect();
509509

510510
if file_paths.is_empty() {
511-
return vec![UnitMeta::default(); files.len()];
511+
return vec![SourceFileMetadata::default(); files.len()];
512512
}
513513

514514
// Build the detector (computes project root internally)
515-
let builder = UnitMetaBuilder::from_language::<L>(&file_paths);
515+
let meta_index = SourceLayoutIndex::from_language::<L>(&file_paths);
516516

517517
// Generate metadata for each file
518-
let mut metas: Vec<UnitMeta> = files
518+
let mut metas: Vec<SourceFileMetadata> = files
519519
.iter()
520520
.map(|f| {
521521
if let Some(path) = f.path() {
522-
builder.get_module_info(std::path::Path::new(path))
522+
meta_index.metadata_for(std::path::Path::new(path))
523523
} else {
524-
UnitMeta::default()
524+
SourceFileMetadata::default()
525525
}
526526
})
527527
.collect();

crates/llmcc-core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub use ir_builder::{HirBuildMetrics, HirBuildOptions, build_file_hir, build_hir
3737
pub use ir_query::HirQuery;
3838
pub use lang_def::{HirBuildAction, Language, LanguageDefinition, NO_FIELD_ID, ParseChild};
3939
pub use lang_registry::{LanguageHandler, LanguageHandlerImpl, LanguageRegistry};
40-
pub use meta::{ArchDepth, UnitMeta, UnitMetaBuilder};
40+
pub use meta::{ArchitectureLevel, SourceFileMetadata, SourceLayoutIndex};
4141
pub use paste;
4242
pub use printer::{PrintConfig, PrintFormat, print_llmcc_graph, print_llmcc_ir, render_llmcc_ir};
4343
pub use resolve::ResolveOptions;

0 commit comments

Comments
 (0)