clang 22.0.0git
FrontendOptions.cpp
Go to the documentation of this file.
1//===- FrontendOptions.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-exception
6//
7//===----------------------------------------------------------------------===//
8
11#include "llvm/ADT/StringSwitch.h"
12
13using namespace clang;
14
16 return llvm::StringSwitch<InputKind>(Extension)
17 .Cases({"ast", "pcm"},
19 .Case("c", Language::C)
20 .Cases({"S", "s"}, Language::Asm)
21 .Case("i", InputKind(Language::C).getPreprocessed())
22 .Case("ii", InputKind(Language::CXX).getPreprocessed())
23 .Case("cui", InputKind(Language::CUDA).getPreprocessed())
24 .Case("m", Language::ObjC)
25 .Case("mi", InputKind(Language::ObjC).getPreprocessed())
26 .Cases({"mm", "M"}, Language::ObjCXX)
27 .Case("mii", InputKind(Language::ObjCXX).getPreprocessed())
28 .Cases({"C", "cc", "cp"}, Language::CXX)
29 .Cases({"cpp", "CPP", "c++", "cxx", "hpp", "hxx"}, Language::CXX)
30 .Case("cppm", Language::CXX)
31 .Cases({"iim", "iih"}, InputKind(Language::CXX).getPreprocessed())
32 .Case("cl", Language::OpenCL)
33 .Case("clcpp", Language::OpenCLCXX)
34 .Cases({"cu", "cuh"}, Language::CUDA)
35 .Case("hip", Language::HIP)
36 .Cases({"ll", "bc"}, Language::LLVM_IR)
37 .Case("hlsl", Language::HLSL)
38 .Case("cir", Language::CIR)
39 .Default(Language::Unknown);
40}
static InputKind getInputKindForExtension(StringRef Extension)
getInputKindForExtension - Return the appropriate input kind for a file extension.
The kind of a file that we've been handed as an input.
InputKind getPreprocessed() const
The JSON file list parser is used to communicate input to InstallAPI.
@ C
Languages that the frontend can parse and compile.
@ CIR
LLVM IR & CIR: we accept these so that we can run the optimizer on them, and compile them to assembly...
@ Asm
Assembly: we accept this only so that we can preprocess it.