clang API Documentation

FrontendOptions.cpp
Go to the documentation of this file.
00001 //===--- FrontendOptions.cpp ----------------------------------------------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #include "clang/Frontend/FrontendOptions.h"
00011 #include "llvm/ADT/StringSwitch.h"
00012 using namespace clang;
00013 
00014 InputKind FrontendOptions::getInputKindForExtension(StringRef Extension) {
00015   return llvm::StringSwitch<InputKind>(Extension)
00016     .Cases("ast", "pcm", IK_AST)
00017     .Case("c", IK_C)
00018     .Cases("S", "s", IK_Asm)
00019     .Case("i", IK_PreprocessedC)
00020     .Case("ii", IK_PreprocessedCXX)
00021     .Case("m", IK_ObjC)
00022     .Case("mi", IK_PreprocessedObjC)
00023     .Cases("mm", "M", IK_ObjCXX)
00024     .Case("mii", IK_PreprocessedObjCXX)
00025     .Cases("C", "cc", "cp", IK_CXX)
00026     .Cases("cpp", "CPP", "c++", "cxx", "hpp", IK_CXX)
00027     .Case("cl", IK_OpenCL)
00028     .Case("cu", IK_CUDA)
00029     .Cases("ll", "bc", IK_LLVM_IR)
00030     .Default(IK_C);
00031 }