about summary refs log tree commit diff stats
path: root/wrapperhelper/utils.h
diff options
context:
space:
mode:
authorwannacu <76616478+wannacu@users.noreply.github.com>2023-07-12 15:43:08 +0800
committerGitHub <noreply@github.com>2023-07-12 09:43:08 +0200
commitb1c09acb0cab2a6c12a275f418c7ce41491c594a (patch)
tree4552d66d83857a5e93b127213ef5e2ffa1444aed /wrapperhelper/utils.h
parenta6b231ce56243972c53b2b88291b4210870f6343 (diff)
downloadbox64-b1c09acb0cab2a6c12a275f418c7ce41491c594a.tar.gz
box64-b1c09acb0cab2a6c12a275f418c7ce41491c594a.zip
[WRAPPER HELPER] Improve Record Parsing (#880)
Diffstat (limited to 'wrapperhelper/utils.h')
-rw-r--r--wrapperhelper/utils.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/wrapperhelper/utils.h b/wrapperhelper/utils.h
index 25865376..06acbb72 100644
--- a/wrapperhelper/utils.h
+++ b/wrapperhelper/utils.h
@@ -1,4 +1,5 @@
 #pragma once
+#include <clang/AST/ASTContext.h>
 #include <clang/AST/Decl.h>
 #include <clang/AST/Type.h>
 #include <clang/Tooling/Tooling.h>
@@ -19,3 +20,14 @@ static const clang::Type* StripTypedef(clang::QualType type) {
         return type.getTypePtr();
     }
 }
+
+// FIXME: Need to support other triple except default target triple
+static std::string GetDeclHeaderFile(clang::ASTContext& Ctx, clang::Decl* Decl) {
+    const auto& SourceManager = Ctx.getSourceManager();
+    const clang::FileID FileID = SourceManager.getFileID(Decl->getBeginLoc());
+    const clang::FileEntry *FileEntry = SourceManager.getFileEntryForID(FileID);
+    if (FileEntry) {
+        return FileEntry->getName().str();
+    }
+    return "";
+}
\ No newline at end of file