Phase 3f complete: Advanced Memory Management (Steps 64-67)

Step 64: AnnotationValidator — @Deallocate missing-intent, @Owner(Single) alias detection, parent/child conflict (5/5 tests)
Step 65: MemoryStrategyInference — language defaults, per-function pattern analysis, confidence scores (5/5 tests)
Step 66: CrossLanguageProjector — deep-copy AST projection, annotation-aware CppGenerator (shared_ptr/unique_ptr) (5/5 tests)
Step 67: Optimization annotations — HotCold, Inline, Pure, ConstExpr with C++ attribute generation (9/9 tests)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Bill
2026-02-08 20:57:58 -07:00
parent 7fb9e89e25
commit 650e8557ae
9 changed files with 870 additions and 83 deletions

View File

@@ -107,8 +107,8 @@ class AllocateAnnotation : public Annotation {
public:
std::string strategy; // "Static", "Register", "Allocator" for allocation strategies
std::string allocationPattern;
AllocateAnnotation() {
conceptType = "AllocateAnnotation";
AllocateAnnotation() {
conceptType = "AllocateAnnotation";
strategy = "Static";
}
AllocateAnnotation(const std::string& id, const std::string& strategy_val)
@@ -117,3 +117,27 @@ public:
this->conceptType = "AllocateAnnotation";
}
};
// Optimization annotations (Step 67)
class HotColdAnnotation : public Annotation {
public:
std::string hint; // "Hot" or "Cold"
HotColdAnnotation() { conceptType = "HotColdAnnotation"; }
};
class InlineAnnotation : public Annotation {
public:
std::string mode; // "Always", "Never", "Hint"
InlineAnnotation() { conceptType = "InlineAnnotation"; }
};
class PureAnnotation : public Annotation {
public:
PureAnnotation() { conceptType = "PureAnnotation"; }
};
class ConstExprAnnotation : public Annotation {
public:
ConstExprAnnotation() { conceptType = "ConstExprAnnotation"; }
};