clang  19.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 
13 using namespace clang;
14 
16  return llvm::StringSwitch<InputKind>(Extension)
17  .Cases("ast", "pcm", InputKind(Language::Unknown, InputKind::Precompiled))
18  .Case("c", Language::C)
19  .Cases("S", "s", Language::Asm)
20  .Case("i", InputKind(Language::C).getPreprocessed())
21  .Case("ii", InputKind(Language::CXX).getPreprocessed())
22  .Case("cui", InputKind(Language::CUDA).getPreprocessed())
23  .Case("m", Language::ObjC)
24  .Case("mi", InputKind(Language::ObjC).getPreprocessed())
25  .Cases("mm", "M", Language::ObjCXX)
26  .Case("mii", InputKind(Language::ObjCXX).getPreprocessed())
27  .Cases("C", "cc", "cp", Language::CXX)
28  .Cases("cpp", "CPP", "c++", "cxx", "hpp", "hxx", Language::CXX)
29  .Case("cppm", Language::CXX)
30  .Cases("iim", "iih", InputKind(Language::CXX).getPreprocessed())
31  .Case("cl", Language::OpenCL)
32  .Case("clcpp", Language::OpenCLCXX)
33  .Cases("cu", "cuh", Language::CUDA)
34  .Case("hip", Language::HIP)
35  .Cases("ll", "bc", Language::LLVM_IR)
36  .Case("hlsl", Language::HLSL)
37  .Case("cir", Language::CIR)
38  .Default(Language::Unknown);
39 }
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.
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.