2018-03-27 05:45:04 +08:00
|
|
|
//===- FrontendOptions.cpp ------------------------------------------------===//
|
2009-11-13 10:06:12 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2009-11-13 10:06:12 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "clang/Frontend/FrontendOptions.h"
|
|
|
|
#include "llvm/ADT/StringSwitch.h"
|
2018-03-27 05:45:04 +08:00
|
|
|
|
2009-11-13 10:06:12 +08:00
|
|
|
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)
|
2017-04-27 02:57:40 +08:00
|
|
|
.Cases("ast", "pcm", InputKind(InputKind::Unknown, InputKind::Precompiled))
|
|
|
|
.Case("c", InputKind::C)
|
|
|
|
.Cases("S", "s", InputKind::Asm)
|
2017-04-28 09:49:42 +08:00
|
|
|
.Case("i", InputKind(InputKind::C).getPreprocessed())
|
|
|
|
.Case("ii", InputKind(InputKind::CXX).getPreprocessed())
|
|
|
|
.Case("cui", InputKind(InputKind::CUDA).getPreprocessed())
|
2017-04-27 02:57:40 +08:00
|
|
|
.Case("m", InputKind::ObjC)
|
2017-04-28 09:49:42 +08:00
|
|
|
.Case("mi", InputKind(InputKind::ObjC).getPreprocessed())
|
2017-04-27 02:57:40 +08:00
|
|
|
.Cases("mm", "M", InputKind::ObjCXX)
|
2017-04-28 09:49:42 +08:00
|
|
|
.Case("mii", InputKind(InputKind::ObjCXX).getPreprocessed())
|
2017-04-27 02:57:40 +08:00
|
|
|
.Cases("C", "cc", "cp", InputKind::CXX)
|
|
|
|
.Cases("cpp", "CPP", "c++", "cxx", "hpp", InputKind::CXX)
|
|
|
|
.Case("cppm", InputKind::CXX)
|
2017-04-28 09:49:42 +08:00
|
|
|
.Case("iim", InputKind(InputKind::CXX).getPreprocessed())
|
2017-04-27 02:57:40 +08:00
|
|
|
.Case("cl", InputKind::OpenCL)
|
|
|
|
.Case("cu", InputKind::CUDA)
|
|
|
|
.Cases("ll", "bc", InputKind::LLVM_IR)
|
|
|
|
.Default(InputKind::Unknown);
|
2009-11-13 10:06:12 +08:00
|
|
|
}
|