Generate .rs.dtor() to clean up globals.
BUG=5186750
Change-Id: I9d1996153fe774a5ce95646a8a2e07aa6e7fa85f
diff --git a/slang_rs_export_foreach.h b/slang_rs_export_foreach.h
index 12019c5..13fd3a7 100644
--- a/slang_rs_export_foreach.h
+++ b/slang_rs_export_foreach.h
@@ -139,10 +139,19 @@
return Name.equals(FuncRoot);
}
+ inline static bool isDtorRSFunc(const clang::FunctionDecl *FD) {
+ if (!FD) {
+ return false;
+ }
+ const llvm::StringRef Name = FD->getName();
+ static llvm::StringRef FuncDtor(".rs.dtor");
+ return Name.equals(FuncDtor);
+ }
+
static bool isRSForEachFunc(const clang::FunctionDecl *FD);
inline static bool isSpecialRSFunc(const clang::FunctionDecl *FD) {
- return isRootRSFunc(FD) || isInitRSFunc(FD);
+ return isRootRSFunc(FD) || isInitRSFunc(FD) || isDtorRSFunc(FD);
}
static bool validateSpecialFuncDecl(clang::Diagnostic *Diags,