brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · e7b122d Raw
34 lines · cpp
1//===-- LVSourceLanguage.cpp ----------------------------------------------===//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// This file implements LVSourceLanguage.10//11//===----------------------------------------------------------------------===//12 13#include "llvm/DebugInfo/LogicalView/Core/LVSourceLanguage.h"14#include "llvm/DebugInfo/CodeView/EnumTables.h"15#include "llvm/Support/ScopedPrinter.h"16 17using namespace llvm;18using namespace llvm::logicalview;19 20StringRef LVSourceLanguage::getName() const {21  if (!isValid())22    return {};23  switch (getTag()) {24  case LVSourceLanguage::TagDwarf:25    return llvm::dwarf::LanguageString(getLang());26  case LVSourceLanguage::TagCodeView: {27    static auto LangNames = llvm::codeview::getSourceLanguageNames();28    return LangNames[getLang()].Name;29  }30  default:31    llvm_unreachable("Unsupported language");32  }33}34