@@ -310,18 +310,8 @@ typedef size_t CXModuleLookupOutputCallback(void *Context,
310
310
char * Output , size_t MaxLen );
311
311
312
312
/**
313
- * See \c clang_experimental_DependencyScannerWorker_getFileDependencies_v5.
314
- * Returns diagnostics in an unstructured CXString instead of CXDiagnosticSet.
315
- */
316
- CINDEX_LINKAGE enum CXErrorCode
317
- clang_experimental_DependencyScannerWorker_getFileDependencies_v4 (
318
- CXDependencyScannerWorker Worker , int argc , const char * const * argv ,
319
- const char * ModuleName , const char * WorkingDirectory , void * MDCContext ,
320
- CXModuleDiscoveredCallback * MDC , void * MLOContext ,
321
- CXModuleLookupOutputCallback * MLO , unsigned Options ,
322
- CXFileDependenciesList * * Out , CXString * error );
323
-
324
- /**
313
+ * Deprecated, use \c clang_experimental_DependencyScannerWorker_getDepGraph.
314
+ *
325
315
* Calculates the list of file dependencies for a particular compiler
326
316
* invocation.
327
317
*
@@ -351,19 +341,275 @@ clang_experimental_DependencyScannerWorker_getFileDependencies_v4(
351
341
* \param [out] Out A non-NULL pointer to store the resulting dependencies. The
352
342
* output must be freed by calling
353
343
* \c clang_experimental_FileDependenciesList_dispose.
354
- * \param [out] OutDiags The diagnostics emitted during scanning. These must be
355
- * always freed by calling \c clang_disposeDiagnosticSet.
344
+ * \param [out] error the error string to pass back to client (if any).
356
345
*
357
346
* \returns \c CXError_Success on success; otherwise a non-zero \c CXErrorCode
358
347
* indicating the kind of error.
359
348
*/
360
349
CINDEX_LINKAGE enum CXErrorCode
361
- clang_experimental_DependencyScannerWorker_getFileDependencies_v5 (
350
+ clang_experimental_DependencyScannerWorker_getFileDependencies_v4 (
362
351
CXDependencyScannerWorker Worker , int argc , const char * const * argv ,
363
352
const char * ModuleName , const char * WorkingDirectory , void * MDCContext ,
364
353
CXModuleDiscoveredCallback * MDC , void * MLOContext ,
365
354
CXModuleLookupOutputCallback * MLO , unsigned Options ,
366
- CXFileDependenciesList * * Out , CXDiagnosticSet * OutDiags );
355
+ CXFileDependenciesList * * Out , CXString * error );
356
+
357
+ /**
358
+ * Output of \c clang_experimental_DependencyScannerWorker_getDepGraph.
359
+ */
360
+ typedef struct CXOpaqueDepGraph * CXDepGraph ;
361
+
362
+ /**
363
+ * An individual module dependency that is part of an overall compilation
364
+ * \c CXDepGraph.
365
+ */
366
+ typedef struct CXOpaqueDepGraphModule * CXDepGraphModule ;
367
+
368
+ /**
369
+ * An individual command-line invocation that is part of an overall compilation
370
+ * \c CXDepGraph.
371
+ */
372
+ typedef struct CXOpaqueDepGraphTUCommand * CXDepGraphTUCommand ;
373
+
374
+ /**
375
+ * Settings to use for the
376
+ * \c clang_experimental_DependencyScannerWorker_getDepGraph action.
377
+ */
378
+ typedef struct CXOpaqueDependencyScannerWorkerScanSettings
379
+ * CXDependencyScannerWorkerScanSettings ;
380
+
381
+ /**
382
+ * Creates a set of settings for
383
+ * \c clang_experimental_DependencyScannerWorker_getDepGraph action.
384
+ * Must be disposed with
385
+ * \c clang_experimental_DependencyScannerWorkerScanSettings_dispose.
386
+ * Memory for settings is not copied. Any provided pointers must be valid until
387
+ * the call to \c clang_experimental_DependencyScannerWorker_getDepGraph.
388
+ *
389
+ * \param argc the number of compiler invocation arguments (including argv[0]).
390
+ * \param argv the compiler driver invocation arguments (including argv[0]).
391
+ * \param ModuleName If non-null, the dependencies of the named module are
392
+ * returned. Otherwise, the dependencies of the whole
393
+ * translation unit are returned.
394
+ * \param WorkingDirectory the directory in which the invocation runs.
395
+ * \param MLOContext the context that will be passed to \c MLO each time it is
396
+ * called.
397
+ * \param MLO a callback that is called to determine the paths of output files
398
+ * for each module dependency. This may receive the same module on
399
+ * different workers. This should be NULL if
400
+ * \c clang_experimental_DependencyScannerService_create_v1 was
401
+ * called with \c CXDependencyMode_Flat. This callback will be called
402
+ * on the same thread that called \c
403
+ * clang_experimental_DependencyScannerWorker_getDepGraph.
404
+ */
405
+ CINDEX_LINKAGE CXDependencyScannerWorkerScanSettings
406
+ clang_experimental_DependencyScannerWorkerScanSettings_create (
407
+ int argc , const char * const * argv , const char * ModuleName ,
408
+ const char * WorkingDirectory , void * MLOContext ,
409
+ CXModuleLookupOutputCallback * MLO );
410
+
411
+ /**
412
+ * Dispose of a \c CXDependencyScannerWorkerScanSettings object.
413
+ */
414
+ CINDEX_LINKAGE void
415
+ clang_experimental_DependencyScannerWorkerScanSettings_dispose (
416
+ CXDependencyScannerWorkerScanSettings );
417
+
418
+ /**
419
+ * Produces the dependency graph for a particular compiler invocation.
420
+ *
421
+ * \param Settings object created via
422
+ * \c clang_experimental_DependencyScannerWorkerScanSettings_create.
423
+ * \param [out] Out A non-NULL pointer to store the resulting dependencies. The
424
+ * output must be freed by calling
425
+ * \c clang_experimental_DepGraph_dispose.
426
+ *
427
+ * \returns \c CXError_Success on success; otherwise a non-zero \c CXErrorCode
428
+ * indicating the kind of error. When returning \c CXError_Failure there will
429
+ * be a \c CXDepGraph object on \p Out that can be used to get diagnostics via
430
+ * \c clang_experimental_DepGraph_getDiagnostics.
431
+ */
432
+ CINDEX_LINKAGE enum CXErrorCode
433
+ clang_experimental_DependencyScannerWorker_getDepGraph (
434
+ CXDependencyScannerWorker , CXDependencyScannerWorkerScanSettings Settings ,
435
+ CXDepGraph * Out );
436
+
437
+ /**
438
+ * Dispose of a \c CXDepGraph object.
439
+ */
440
+ CINDEX_LINKAGE void clang_experimental_DepGraph_dispose (CXDepGraph );
441
+
442
+ /**
443
+ * \returns the number of \c CXDepGraphModule objects in the graph.
444
+ */
445
+ CINDEX_LINKAGE size_t clang_experimental_DepGraph_getNumModules (CXDepGraph );
446
+
447
+ /**
448
+ * \returns the \c CXDepGraphModule object at the given \p Index.
449
+ *
450
+ * The \c CXDepGraphModule object is only valid to use while \c CXDepGraph is
451
+ * valid. Must be disposed with \c clang_experimental_DepGraphModule_dispose.
452
+ */
453
+ CINDEX_LINKAGE CXDepGraphModule
454
+ clang_experimental_DepGraph_getModule (CXDepGraph , size_t Index );
455
+
456
+ CINDEX_LINKAGE void clang_experimental_DepGraphModule_dispose (CXDepGraphModule );
457
+
458
+ /**
459
+ * \returns the name of the module. This may include `:` for C++20 module
460
+ * partitions, or a header-name for C++20 header units.
461
+ *
462
+ * The string is only valid to use while the \c CXDepGraphModule object is
463
+ * valid.
464
+ */
465
+ CINDEX_LINKAGE
466
+ const char * clang_experimental_DepGraphModule_getName (CXDepGraphModule );
467
+
468
+ /**
469
+ * \returns the context hash of a module represents the set of compiler options
470
+ * that may make one version of a module incompatible from another. This
471
+ * includes things like language mode, predefined macros, header search paths,
472
+ * etc...
473
+ *
474
+ * Modules with the same name but a different \c ContextHash should be treated
475
+ * as separate modules for the purpose of a build.
476
+ *
477
+ * The string is only valid to use while the \c CXDepGraphModule object is
478
+ * valid.
479
+ */
480
+ CINDEX_LINKAGE
481
+ const char * clang_experimental_DepGraphModule_getContextHash (CXDepGraphModule );
482
+
483
+ /**
484
+ * \returns the path to the modulemap file which defines this module. If there's
485
+ * no modulemap (e.g. for a C++ module) returns \c NULL.
486
+ *
487
+ * This can be used to explicitly build this module. This file will
488
+ * additionally appear in \c FileDeps as a dependency.
489
+ *
490
+ * The string is only valid to use while the \c CXDepGraphModule object is
491
+ * valid.
492
+ */
493
+ CINDEX_LINKAGE const char *
494
+ clang_experimental_DepGraphModule_getModuleMapPath (CXDepGraphModule );
495
+
496
+ /**
497
+ * \returns the list of files which this module directly depends on.
498
+ *
499
+ * If any of these change then the module needs to be rebuilt.
500
+ *
501
+ * The strings are only valid to use while the \c CXDepGraphModule object is
502
+ * valid.
503
+ */
504
+ CINDEX_LINKAGE CXCStringArray
505
+ clang_experimental_DepGraphModule_getFileDeps (CXDepGraphModule );
506
+
507
+ /**
508
+ * \returns the list of modules which this module direct depends on.
509
+ *
510
+ * This does include the context hash. The format is
511
+ * `<module-name>:<context-hash>`
512
+ *
513
+ * The strings are only valid to use while the \c CXDepGraphModule object is
514
+ * valid.
515
+ */
516
+ CINDEX_LINKAGE CXCStringArray
517
+ clang_experimental_DepGraphModule_getModuleDeps (CXDepGraphModule );
518
+
519
+ /**
520
+ * \returns the canonical command line to build this module.
521
+ *
522
+ * The strings are only valid to use while the \c CXDepGraphModule object is
523
+ * valid.
524
+ */
525
+ CINDEX_LINKAGE CXCStringArray
526
+ clang_experimental_DepGraphModule_getBuildArguments (CXDepGraphModule );
527
+
528
+ /**
529
+ * \returns the \c ActionCache key for this module, if any.
530
+ */
531
+ CINDEX_LINKAGE
532
+ const char * clang_experimental_DepGraphModule_getCacheKey (CXDepGraphModule );
533
+
534
+ /**
535
+ * \returns the number \c CXDepGraphTUCommand objects in the graph.
536
+ */
537
+ CINDEX_LINKAGE size_t clang_experimental_DepGraph_getNumTUCommands (CXDepGraph );
538
+
539
+ /**
540
+ * \returns the \c CXDepGraphTUCommand object at the given \p Index.
541
+ *
542
+ * The \c CXDepGraphTUCommand object is only valid to use while \c CXDepGraph is
543
+ * valid. Must be disposed with \c clang_experimental_DepGraphTUCommand_dispose.
544
+ */
545
+ CINDEX_LINKAGE CXDepGraphTUCommand
546
+ clang_experimental_DepGraph_getTUCommand (CXDepGraph , size_t Index );
547
+
548
+ /**
549
+ * Dispose of a \c CXDepGraphTUCommand object.
550
+ */
551
+ CINDEX_LINKAGE void
552
+ clang_experimental_DepGraphTUCommand_dispose (CXDepGraphTUCommand );
553
+
554
+ /**
555
+ * \returns the executable name for the command.
556
+ *
557
+ * The string is only valid to use while the \c CXDepGraphTUCommand object is
558
+ * valid.
559
+ */
560
+ CINDEX_LINKAGE const char *
561
+ clang_experimental_DepGraphTUCommand_getExecutable (CXDepGraphTUCommand );
562
+
563
+ /**
564
+ * \returns the canonical command line to build this translation unit.
565
+ *
566
+ * The strings are only valid to use while the \c CXDepGraphTUCommand object is
567
+ * valid.
568
+ */
569
+ CINDEX_LINKAGE CXCStringArray
570
+ clang_experimental_DepGraphTUCommand_getBuildArguments (CXDepGraphTUCommand );
571
+
572
+ /**
573
+ * \returns the \c ActionCache key for this translation unit, if any.
574
+ */
575
+ CINDEX_LINKAGE const char *
576
+ clang_experimental_DepGraphTUCommand_getCacheKey (CXDepGraphTUCommand );
577
+
578
+ /**
579
+ * \returns the list of files which this translation unit directly depends on.
580
+ *
581
+ * The strings are only valid to use while the \c CXDepGraph object is valid.
582
+ */
583
+ CINDEX_LINKAGE
584
+ CXCStringArray clang_experimental_DepGraph_getTUFileDeps (CXDepGraph );
585
+
586
+ /**
587
+ * \returns the list of modules which this translation unit direct depends on.
588
+ *
589
+ * This does include the context hash. The format is
590
+ * `<module-name>:<context-hash>`
591
+ *
592
+ * The strings are only valid to use while the \c CXDepGraph object is valid.
593
+ */
594
+ CINDEX_LINKAGE
595
+ CXCStringArray clang_experimental_DepGraph_getTUModuleDeps (CXDepGraph );
596
+
597
+ /**
598
+ * \returns the context hash of the C++20 module this translation unit exports.
599
+ *
600
+ * If the translation unit is not a module then this is empty.
601
+ *
602
+ * The string is only valid to use while the \c CXDepGraph object is valid.
603
+ */
604
+ CINDEX_LINKAGE
605
+ const char * clang_experimental_DepGraph_getTUContextHash (CXDepGraph );
606
+
607
+ /**
608
+ * \returns The diagnostics emitted during scanning. These must be always freed
609
+ * by calling \c clang_disposeDiagnosticSet.
610
+ */
611
+ CINDEX_LINKAGE
612
+ CXDiagnosticSet clang_experimental_DepGraph_getDiagnostics (CXDepGraph );
367
613
368
614
/**
369
615
* @}
0 commit comments