Daniel Dunbar | fbe2faf | 2009-11-13 02:06:12 +0000 | [diff] [blame] | 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 | |
Chris Lattner | 5f9e272 | 2011-07-23 10:55:15 +0000 | [diff] [blame] | 14 | InputKind FrontendOptions::getInputKindForExtension(StringRef Extension) { |
Daniel Dunbar | fbe2faf | 2009-11-13 02:06:12 +0000 | [diff] [blame] | 15 | return llvm::StringSwitch<InputKind>(Extension) |
| 16 | .Case("ast", 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("m", IK_ObjC) |
| 22 | .Case("mi", IK_PreprocessedObjC) |
| 23 | .Cases("mm", "M", IK_ObjCXX) |
| 24 | .Case("mii", IK_PreprocessedObjCXX) |
| 25 | .Case("C", IK_CXX) |
| 26 | .Cases("C", "cc", "cp", IK_CXX) |
Nuno Lopes | 2059d99 | 2009-11-17 15:36:35 +0000 | [diff] [blame] | 27 | .Cases("cpp", "CPP", "c++", "cxx", "hpp", IK_CXX) |
Daniel Dunbar | fbe2faf | 2009-11-13 02:06:12 +0000 | [diff] [blame] | 28 | .Case("cl", IK_OpenCL) |
Peter Collingbourne | 895fcca | 2010-12-01 03:15:20 +0000 | [diff] [blame] | 29 | .Case("cu", IK_CUDA) |
Daniel Dunbar | faddc3e | 2010-06-07 23:26:47 +0000 | [diff] [blame] | 30 | .Cases("ll", "bc", IK_LLVM_IR) |
Daniel Dunbar | fbe2faf | 2009-11-13 02:06:12 +0000 | [diff] [blame] | 31 | .Default(IK_C); |
| 32 | } |