2009-11-13 10:06:12 +08:00
|
|
|
//===--- FrontendOptions.cpp ----------------------------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "clang/Frontend/FrontendOptions.h"
|
|
|
|
#include "llvm/ADT/StringSwitch.h"
|
|
|
|
using namespace clang;
|
|
|
|
|
2011-07-23 18:55:15 +08:00
|
|
|
InputKind FrontendOptions::getInputKindForExtension(StringRef Extension) {
|
2009-11-13 10:06:12 +08:00
|
|
|
return llvm::StringSwitch<InputKind>(Extension)
|
|
|
|
.Case("ast", IK_AST)
|
|
|
|
.Case("c", IK_C)
|
|
|
|
.Cases("S", "s", IK_Asm)
|
|
|
|
.Case("i", IK_PreprocessedC)
|
|
|
|
.Case("ii", IK_PreprocessedCXX)
|
|
|
|
.Case("m", IK_ObjC)
|
|
|
|
.Case("mi", IK_PreprocessedObjC)
|
|
|
|
.Cases("mm", "M", IK_ObjCXX)
|
|
|
|
.Case("mii", IK_PreprocessedObjCXX)
|
|
|
|
.Case("C", IK_CXX)
|
|
|
|
.Cases("C", "cc", "cp", IK_CXX)
|
2009-11-17 23:36:35 +08:00
|
|
|
.Cases("cpp", "CPP", "c++", "cxx", "hpp", IK_CXX)
|
2009-11-13 10:06:12 +08:00
|
|
|
.Case("cl", IK_OpenCL)
|
2010-12-01 11:15:20 +08:00
|
|
|
.Case("cu", IK_CUDA)
|
2010-06-08 07:26:47 +08:00
|
|
|
.Cases("ll", "bc", IK_LLVM_IR)
|
2009-11-13 10:06:12 +08:00
|
|
|
.Default(IK_C);
|
|
|
|
}
|