1*f4a2713aSLionel Sambuc //===--- FrontendOptions.cpp ----------------------------------------------===//
2*f4a2713aSLionel Sambuc //
3*f4a2713aSLionel Sambuc // The LLVM Compiler Infrastructure
4*f4a2713aSLionel Sambuc //
5*f4a2713aSLionel Sambuc // This file is distributed under the University of Illinois Open Source
6*f4a2713aSLionel Sambuc // License. See LICENSE.TXT for details.
7*f4a2713aSLionel Sambuc //
8*f4a2713aSLionel Sambuc //===----------------------------------------------------------------------===//
9*f4a2713aSLionel Sambuc
10*f4a2713aSLionel Sambuc #include "clang/Frontend/FrontendOptions.h"
11*f4a2713aSLionel Sambuc #include "llvm/ADT/StringSwitch.h"
12*f4a2713aSLionel Sambuc using namespace clang;
13*f4a2713aSLionel Sambuc
getInputKindForExtension(StringRef Extension)14*f4a2713aSLionel Sambuc InputKind FrontendOptions::getInputKindForExtension(StringRef Extension) {
15*f4a2713aSLionel Sambuc return llvm::StringSwitch<InputKind>(Extension)
16*f4a2713aSLionel Sambuc .Cases("ast", "pcm", IK_AST)
17*f4a2713aSLionel Sambuc .Case("c", IK_C)
18*f4a2713aSLionel Sambuc .Cases("S", "s", IK_Asm)
19*f4a2713aSLionel Sambuc .Case("i", IK_PreprocessedC)
20*f4a2713aSLionel Sambuc .Case("ii", IK_PreprocessedCXX)
21*f4a2713aSLionel Sambuc .Case("m", IK_ObjC)
22*f4a2713aSLionel Sambuc .Case("mi", IK_PreprocessedObjC)
23*f4a2713aSLionel Sambuc .Cases("mm", "M", IK_ObjCXX)
24*f4a2713aSLionel Sambuc .Case("mii", IK_PreprocessedObjCXX)
25*f4a2713aSLionel Sambuc .Cases("C", "cc", "cp", IK_CXX)
26*f4a2713aSLionel Sambuc .Cases("cpp", "CPP", "c++", "cxx", "hpp", IK_CXX)
27*f4a2713aSLionel Sambuc .Case("cl", IK_OpenCL)
28*f4a2713aSLionel Sambuc .Case("cu", IK_CUDA)
29*f4a2713aSLionel Sambuc .Cases("ll", "bc", IK_LLVM_IR)
30*f4a2713aSLionel Sambuc .Default(IK_C);
31*f4a2713aSLionel Sambuc }
32