clang 10.0.0git

FrontendOptions.cpp
Go to the documentation of this file.
1 //===- FrontendOptions.cpp ------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "clang/Frontend/FrontendOptions.h"
10 #include "clang/Basic/LangStandard.h"
11 #include "llvm/ADT/StringSwitch.h"
12
13 using namespace clang;
14
15 InputKind FrontendOptions::getInputKindForExtension(StringRef Extension) {
16 return llvm::StringSwitch<InputKind>(Extension)
17 .Cases("ast", "pcm", InputKind(Language::Unknown, InputKind::Precompiled))
18 .Case("c", Language::C)
19 .Cases("S", "s", Language::Asm)
20 .Case("i", InputKind(Language::C).getPreprocessed())
21 .Case("ii", InputKind(Language::CXX).getPreprocessed())
22 .Case("cui", InputKind(Language::CUDA).getPreprocessed())
23 .Case("m", Language::ObjC)
24 .Case("mi", InputKind(Language::ObjC).getPreprocessed())
25 .Cases("mm", "M", Language::ObjCXX)
26 .Case("mii", InputKind(Language::ObjCXX).getPreprocessed())
27 .Cases("C", "cc", "cp", Language::CXX)
28 .Cases("cpp", "CPP", "c++", "cxx", "hpp", Language::CXX)
29 .Case("cppm", Language::CXX)
30 .Case("iim", InputKind(Language::CXX).getPreprocessed())
31 .Case("cl", Language::OpenCL)
32 .Case("cu", Language::CUDA)
33 .Cases("ll", "bc", Language::LLVM_IR)
34 .Default(Language::Unknown);
35 }
clang::Language::CUDA
FrontendOptions.h
clang::AttrSyntax::CXX
clang::Language::C
Languages that the frontend can parse and compile.
LangStandard.h
clang::InputKind
The kind of a file that we&#39;ve been handed as an input.
Definition: FrontendOptions.h:144
clang::InputKind::Precompiled
Definition: FrontendOptions.h:155
clang::AtomicScopeModelKind::OpenCL
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:21
clang::Language::ObjCXX
clang::Language::Unknown
clang::Language::Asm
Assembly: we accept this only so that we can preprocess it.
clang::Language::ObjC
clang::Language::LLVM_IR
LLVM IR: we accept this so that we can run the optimizer on it, and compile it to assembly or object ...
clang::FrontendOptions::getInputKindForExtension
static InputKind getInputKindForExtension(StringRef Extension)
getInputKindForExtension - Return the appropriate input kind for a file extension.
Definition: FrontendOptions.cpp:15