[llvm] [SYCL][LLVM] Adding property set I/O library for SYCL (PR #110771)
Arvind Sudarsanam via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 14 17:23:13 PDT 2024
================
@@ -0,0 +1,207 @@
+//= SYCLPropertySetIO.cpp - models a sequence of property sets and their I/O =//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/SYCLPropertySetIO.h"
+
+#include "llvm/ADT/APInt.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/Base64.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/LineIterator.h"
+
+#include <memory>
+#include <string>
+
+using namespace llvm::util;
+using namespace llvm;
+
+namespace {
+
+::llvm::Error makeError(const Twine &Msg) {
+ return createStringError(std::error_code{}, Msg);
+}
+
+} // anonymous namespace
+
+Expected<std::unique_ptr<SYCLPropertySetRegistry>>
+SYCLPropertySetRegistry::read(const MemoryBuffer *Buf) {
+ auto Res = std::make_unique<SYCLPropertySetRegistry>();
+ SYCLPropertySet *CurPropSet = nullptr;
+
+ for (line_iterator LI(*Buf); !LI.is_at_end(); LI++) {
+ // See if this line starts a new property set
+ if (LI->starts_with("[")) {
+ // Parse the category (property name)
+ auto EndPos = LI->rfind(']');
----------------
asudarsa wrote:
I have updated most of the sites.
Thanks for pointing this out.
I am traditionally an 'almost always auto' implementer. But I have adjusted my approach here.
Thanks
https://github.com/llvm/llvm-project/pull/110771
More information about the llvm-commits
mailing list