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