@@ -15,6 +15,11 @@ namespace llvm
1515 class SMDiagnostic ;
1616} // namespace llvm
1717
18+ namespace ctrace ::stack::analysis
19+ {
20+ class CompilationDatabase ;
21+ } // namespace ctrace::stack::analysis
22+
1823namespace ctrace ::stack
1924{
2025
@@ -26,33 +31,39 @@ namespace ctrace::stack
2631 ABI
2732 };
2833
29- // Configuration de l'analyse (mode + limite de stack)
34+ // Analysis configuration (mode + stack limit).
3035 struct AnalysisConfig
3136 {
3237 AnalysisMode mode = AnalysisMode::IR ;
33- StackSize stackLimit = 8ull * 1024ull * 1024ull ; // 8 MiB par défaut
38+ StackSize stackLimit = 8ull * 1024ull * 1024ull ; // 8 MiB default
3439 bool quiet = false ;
3540 bool warningsOnly = false ;
3641 std::vector<std::string> extraCompileArgs;
42+ std::shared_ptr<const analysis::CompilationDatabase> compilationDatabase;
43+ bool requireCompilationDatabase = false ;
44+ bool compdbFast = false ;
45+ bool timing = false ;
3746 std::vector<std::string> onlyFiles;
3847 std::vector<std::string> onlyDirs;
3948 std::vector<std::string> onlyFunctions;
4049 bool dumpFilter = false ;
50+ std::string dumpIRPath;
51+ bool dumpIRIsDir = false ;
4152 };
4253
43- // Résultat par fonction
54+ // Per-function result
4455 struct FunctionResult
4556 {
4657 std::string filePath;
4758 std::string name;
48- StackSize localStack = 0 ; // taille frame locale (suivant le mode)
49- StackSize maxStack = 0 ; // max stack incluant les callees
50- bool localStackUnknown = false ; // taille locale inconnue (alloca dynamique )
51- bool maxStackUnknown = false ; // max stack inconnue (propagée via appels )
52- bool hasDynamicAlloca = false ; // alloca dynamique détectée dans la fonction
53-
54- bool isRecursive = false ; // dans un cycle F <-> G ...
55- bool hasInfiniteSelfRecursion = false ; // heuristique DominatorTree
59+ StackSize localStack = 0 ; // local frame size (depends on mode)
60+ StackSize maxStack = 0 ; // max stack including callees
61+ bool localStackUnknown = false ; // unknown local size (dynamic alloca )
62+ bool maxStackUnknown = false ; // unknown max stack (propagated via calls )
63+ bool hasDynamicAlloca = false ; // dynamic alloca detected in the function
64+
65+ bool isRecursive = false ; // part of a cycle F <-> G ...
66+ bool hasInfiniteSelfRecursion = false ; // DominatorTree heuristic
5667 bool exceedsLimit = false ; // maxStack > config.stackLimit
5768 };
5869
@@ -151,7 +162,7 @@ namespace ctrace::stack
151162 std::string message;
152163 };
153164
154- // Résultat global pour un module
165+ // Global result for a module
155166 struct AnalysisResult
156167 {
157168 AnalysisConfig config;
@@ -162,22 +173,22 @@ namespace ctrace::stack
162173 std::vector<Diagnostic> diagnostics;
163174 };
164175
165- // Serialize an AnalysisResult to a simple JSON format (pour CI / GitHub Actions).
166- // `inputFile` : chemin du fichier analysé (celui que tu passes à analyzeFile).
176+ // Serialize an AnalysisResult to a simple JSON format (for CI / GitHub Actions).
177+ // `inputFile`: path of the analyzed file (the one you pass to analyzeFile).
167178 std::string toJson (const AnalysisResult& result, const std::string& inputFile);
168179 std::string toJson (const AnalysisResult& result, const std::vector<std::string>& inputFiles);
169180
170181 // Serialize an AnalysisResult to SARIF 2.1.0 (compatible GitHub Code Scanning).
171- // `inputFile` : chemin du fichier analysé .
172- // `toolName` / `toolVersion` : metadata du tool dans le SARIF.
182+ // `inputFile`: path of the analyzed file .
183+ // `toolName` / `toolVersion`: tool metadata in SARIF.
173184 std::string toSarif (const AnalysisResult& result, const std::string& inputFile,
174185 const std::string& toolName = " coretrace-stack-analyzer" ,
175186 const std::string& toolVersion = " 0.1.0" );
176187
177- // Analyse un module déjà chargé (tu peux réutiliser dans d'autres outils)
188+ // Analyze an already loaded module (can be reused by other tools).
178189 AnalysisResult analyzeModule (llvm::Module& mod, const AnalysisConfig& config);
179190
180- // Helper pratique : charge un .ll et appelle analyzeModule()
191+ // Convenience helper: load a .ll and call analyzeModule()
181192 AnalysisResult analyzeFile (const std::string& filename, const AnalysisConfig& config,
182193 llvm::LLVMContext& ctx, llvm::SMDiagnostic& err);
183194
0 commit comments