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 | |
| 14 | FrontendOptions::InputKind |
| 15 | FrontendOptions::getInputKindForExtension(llvm::StringRef Extension) { |
| 16 | return llvm::StringSwitch<InputKind>(Extension) |
| 17 | .Case("ast", IK_AST) |
| 18 | .Case("c", IK_C) |
| 19 | .Cases("S", "s", IK_Asm) |
| 20 | .Case("i", IK_PreprocessedC) |
| 21 | .Case("ii", IK_PreprocessedCXX) |
| 22 | .Case("m", IK_ObjC) |
| 23 | .Case("mi", IK_PreprocessedObjC) |
| 24 | .Cases("mm", "M", IK_ObjCXX) |
| 25 | .Case("mii", IK_PreprocessedObjCXX) |
| 26 | .Case("C", IK_CXX) |
| 27 | .Cases("C", "cc", "cp", IK_CXX) |
Nuno Lopes | 2059d99 | 2009-11-17 15:36:35 +0000 | [diff] [blame] | 28 | .Cases("cpp", "CPP", "c++", "cxx", "hpp", IK_CXX) |
Daniel Dunbar | fbe2faf | 2009-11-13 02:06:12 +0000 | [diff] [blame] | 29 | .Case("cl", IK_OpenCL) |
| 30 | .Default(IK_C); |
| 31 | } |