File tree Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Original file line number Diff line number Diff line change @@ -459,6 +459,40 @@ LLVMMetadataRef LLVMDILocationGetScope(LLVMMetadataRef Location);
459
459
*/
460
460
LLVMMetadataRef LLVMDILocationGetInlinedAt (LLVMMetadataRef Location );
461
461
462
+ /**
463
+ * Get the metadata of the file associated with a given scope.
464
+ * \param Scope The scope object.
465
+ *
466
+ * @see DIScope::getFile()
467
+ */
468
+ LLVMMetadataRef LLVMDIScopeGetFile (LLVMMetadataRef Scope );
469
+
470
+ /**
471
+ * Get the directory of a given file.
472
+ * \param File The file object.
473
+ * \param Len The length of the returned string.
474
+ *
475
+ * @see DIFile::getDirectory()
476
+ */
477
+ const char * LLVMDIFileGetDirectory (LLVMMetadataRef File , unsigned * Len );
478
+
479
+ /**
480
+ * Get the name of a given file.
481
+ * \param File The file object.
482
+ * \param Len The length of the returned string.
483
+ *
484
+ * @see DIFile::getFilename()
485
+ */
486
+ const char * LLVMDIFileGetFilename (LLVMMetadataRef File , unsigned * Len );
487
+
488
+ /**
489
+ * Get the source of a given file.
490
+ * \param File The file object.
491
+ * \param Len The length of the returned string.
492
+ *
493
+ * @see DIFile::getSource()
494
+ */
495
+ const char * LLVMDIFileGetSource (LLVMMetadataRef File , unsigned * Len );
462
496
463
497
/**
464
498
* Create a type array.
Original file line number Diff line number Diff line change @@ -903,6 +903,31 @@ LLVMMetadataRef LLVMDILocationGetInlinedAt(LLVMMetadataRef Location) {
903
903
return wrap (unwrapDI<DILocation>(Location)->getInlinedAt ());
904
904
}
905
905
906
+ LLVMMetadataRef LLVMDIScopeGetFile (LLVMMetadataRef Scope) {
907
+ return wrap (unwrapDI<DIScope>(Scope)->getFile ());
908
+ }
909
+
910
+ const char *LLVMDIFileGetDirectory (LLVMMetadataRef File, unsigned *Len) {
911
+ auto Dir = unwrapDI<DIFile>(File)->getDirectory ();
912
+ *Len = Dir.size ();
913
+ return Dir.data ();
914
+ }
915
+
916
+ const char *LLVMDIFileGetFilename (LLVMMetadataRef File, unsigned *Len) {
917
+ auto Name = unwrapDI<DIFile>(File)->getFilename ();
918
+ *Len = Name.size ();
919
+ return Name.data ();
920
+ }
921
+
922
+ const char *LLVMDIFileGetSource (LLVMMetadataRef File, unsigned *Len) {
923
+ if (auto Src = unwrapDI<DIFile>(File)->getSource ()) {
924
+ *Len = Src->size ();
925
+ return Src->data ();
926
+ }
927
+ *Len = 0 ;
928
+ return " " ;
929
+ }
930
+
906
931
LLVMMetadataRef LLVMDIBuilderCreateEnumerator (LLVMDIBuilderRef Builder,
907
932
const char *Name, size_t NameLen,
908
933
int64_t Value,
You can’t perform that action at this time.
0 commit comments