blob: ea4005f7c96028e5a6dce6c1220ed50adaa9eae8 [file] [log] [blame]
Daniel Dunbarfbe2faf2009-11-13 02:06:12 +00001//===--- 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"
12using namespace clang;
13
Chris Lattner5f9e2722011-07-23 10:55:15 +000014InputKind FrontendOptions::getInputKindForExtension(StringRef Extension) {
Daniel Dunbarfbe2faf2009-11-13 02:06:12 +000015 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 Lopes2059d992009-11-17 15:36:35 +000027 .Cases("cpp", "CPP", "c++", "cxx", "hpp", IK_CXX)
Daniel Dunbarfbe2faf2009-11-13 02:06:12 +000028 .Case("cl", IK_OpenCL)
Peter Collingbourne895fcca2010-12-01 03:15:20 +000029 .Case("cu", IK_CUDA)
Daniel Dunbarfaddc3e2010-06-07 23:26:47 +000030 .Cases("ll", "bc", IK_LLVM_IR)
Daniel Dunbarfbe2faf2009-11-13 02:06:12 +000031 .Default(IK_C);
32}