================ @@ -622,6 +622,28 @@ static bool checkAliasedGlobal( return true; } +// Emit a warning if toc-data attribute is requested for global variables that +// have aliases and remove the toc-data attribute. +static void checkAliasForTocData(llvm::GlobalVariable *GVar, + const CodeGenOptions &CodeGenOpts, + DiagnosticsEngine &Diags, + SourceLocation Location) { + if (GVar->hasAttribute("toc-data")) { + auto GVId = GVar->getGlobalIdentifier(); + // Is this a global variable specified by the user as local? + bool UserSpecifiedTOC = + llvm::binary_search(CodeGenOpts.TocDataVarsUserSpecified, GVId); + if (UserSpecifiedTOC) { ---------------- diggerlin wrote:
we not need to introduce a new variable `UserSpecifiedTOC` change to `if ((llvm::binary_search(CodeGenOpts.TocDataVarsUserSpecified, GVId))) {` https://github.com/llvm/llvm-project/pull/67999 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits