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