Home | History | Annotate | Download | only in Frontend
      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 InputKind FrontendOptions::getInputKindForExtension(StringRef Extension) {
     15   return llvm::StringSwitch<InputKind>(Extension)
     16     .Cases("ast", "pcm", 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     .Cases("C", "cc", "cp", IK_CXX)
     26     .Cases("cpp", "CPP", "c++", "cxx", "hpp", IK_CXX)
     27     .Case("cl", IK_OpenCL)
     28     .Case("cu", IK_CUDA)
     29     .Cases("ll", "bc", IK_LLVM_IR)
     30     .Default(IK_C);
     31 }
     32