File tree Expand file tree Collapse file tree 4 files changed +22
-0
lines changed Expand file tree Collapse file tree 4 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,10 @@ class LLVMContext {
130130 // / scope names are ordered by increasing synchronization scope IDs.
131131 void getSyncScopeNames (SmallVectorImpl<StringRef> &SSNs) const ;
132132
133+ // / getSyncScopeName - Returns the name of a SyncScope::ID
134+ // / registered with LLVMContext, if any.
135+ std::optional<StringRef> getSyncScopeName (SyncScope::ID Id) const ;
136+
133137 // / Define the GC for a function
134138 void setGC (const Function &Fn, std::string GCName);
135139
Original file line number Diff line number Diff line change @@ -330,6 +330,10 @@ void LLVMContext::getSyncScopeNames(SmallVectorImpl<StringRef> &SSNs) const {
330330 pImpl->getSyncScopeNames (SSNs);
331331}
332332
333+ std::optional<StringRef> LLVMContext::getSyncScopeName (SyncScope::ID Id) const {
334+ return pImpl->getSyncScopeName (Id);
335+ }
336+
333337void LLVMContext::setGC (const Function &Fn, std::string GCName) {
334338 pImpl->GCNames [&Fn] = std::move (GCName);
335339}
Original file line number Diff line number Diff line change @@ -244,6 +244,16 @@ void LLVMContextImpl::getSyncScopeNames(
244244 SSNs[SSE.second ] = SSE.first ();
245245}
246246
247+ std::optional<StringRef>
248+ LLVMContextImpl::getSyncScopeName (SyncScope::ID Id) const {
249+ for (const auto &SSE : SSC) {
250+ if (SSE.second != Id)
251+ continue ;
252+ return SSE.first ();
253+ }
254+ return std::nullopt ;
255+ }
256+
247257// / Gets the OptPassGate for this LLVMContextImpl, which defaults to the
248258// / singleton OptBisect if not explicitly set.
249259OptPassGate &LLVMContextImpl::getOptPassGate () const {
Original file line number Diff line number Diff line change @@ -1665,6 +1665,10 @@ class LLVMContextImpl {
16651665 /// scope names are ordered by increasing synchronization scope IDs.
16661666 void getSyncScopeNames(SmallVectorImpl<StringRef> &SSNs) const;
16671667
1668+ /// getSyncScopeName - Returns the name of a SyncScope::ID
1669+ /// registered with LLVMContext, if any.
1670+ std::optional<StringRef> getSyncScopeName(SyncScope::ID Id) const;
1671+
16681672 /// Maintain the GC name for each function.
16691673 ///
16701674 /// This saves allocating an additional word in Function for programs which
You can’t perform that action at this time.
0 commit comments