brintos

brintos / llvm-project-archived public Read only

0
0
Text · 952 B · 888593b Raw
31 lines · c
1//===- CXFile.h - Routines for manipulating CXFile --------------*- C++ -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLVM_CLANG_TOOLS_LIBCLANG_CXFILE_H10#define LLVM_CLANG_TOOLS_LIBCLANG_CXFILE_H11 12#include "clang-c/CXFile.h"13#include "clang/Basic/FileEntry.h"14 15namespace clang {16namespace cxfile {17inline CXFile makeCXFile(OptionalFileEntryRef FE) {18  return CXFile(FE ? const_cast<FileEntryRef::MapEntry *>(&FE->getMapEntry())19                   : nullptr);20}21 22inline OptionalFileEntryRef getFileEntryRef(CXFile File) {23  if (!File)24    return std::nullopt;25  return FileEntryRef(*reinterpret_cast<const FileEntryRef::MapEntry *>(File));26}27} // namespace cxfile28} // namespace clang29 30#endif31