clang  16.0.0git
Types.h
Go to the documentation of this file.
1 //===--- Types.h - Input & Temporary Driver Types ---------------*- C++ -*-===//
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 #ifndef LLVM_CLANG_DRIVER_TYPES_H
10 #define LLVM_CLANG_DRIVER_TYPES_H
11 
12 #include "clang/Driver/Phases.h"
13 #include "llvm/ADT/SmallVector.h"
14 #include "llvm/Option/ArgList.h"
15 
16 namespace llvm {
17 class StringRef;
18 }
19 namespace clang {
20 namespace driver {
21 class Driver;
22 namespace types {
23  enum ID {
25 #define TYPE(NAME, ID, PP_TYPE, TEMP_SUFFIX, ...) TY_##ID,
26 #include "clang/Driver/Types.def"
27 #undef TYPE
29  };
30 
31  /// getTypeName - Return the name of the type for \p Id.
32  const char *getTypeName(ID Id);
33 
34  /// getPreprocessedType - Get the ID of the type for this input when
35  /// it has been preprocessed, or INVALID if this input is not
36  /// preprocessed.
38 
39  /// getPrecompiledType - Get the ID of the type for this input when
40  /// it has been precompiled, or INVALID if this input is not
41  /// precompiled.
43 
44  /// getTypeTempSuffix - Return the suffix to use when creating a
45  /// temp file of this type, or null if unspecified.
46  const char *getTypeTempSuffix(ID Id, bool CLMode = false);
47 
48  /// onlyPrecompileType - Should this type only be precompiled.
49  bool onlyPrecompileType(ID Id);
50 
51  /// canTypeBeUserSpecified - Can this type be specified on the
52  /// command line (by the type name); this is used when forwarding
53  /// commands to gcc.
55 
56  /// appendSuffixForType - When generating outputs of this type,
57  /// should the suffix be appended (instead of replacing the existing
58  /// suffix).
60 
61  /// canLipoType - Is this type acceptable as the output of a
62  /// universal build (currently, just the Nothing, Image, and Object
63  /// types).
64  bool canLipoType(ID Id);
65 
66  /// isAcceptedByClang - Can clang handle this input type.
67  bool isAcceptedByClang(ID Id);
68 
69  /// isAcceptedByFlang - Can flang handle this input type.
70  bool isAcceptedByFlang(ID Id);
71 
72  /// isDerivedFromC - Is the input derived from C.
73  ///
74  /// That is, does the lexer follow the rules of
75  /// TokenConcatenation::AvoidConcat. If this is the case, the preprocessor may
76  /// add and remove whitespace between tokens. Used to determine whether the
77  /// input can be processed by -fminimize-whitespace.
78  bool isDerivedFromC(ID Id);
79 
80  /// isCXX - Is this a "C++" input (C++ and Obj-C++ sources and headers).
81  bool isCXX(ID Id);
82 
83  /// Is this LLVM IR.
84  bool isLLVMIR(ID Id);
85 
86  /// isCuda - Is this a CUDA input.
87  bool isCuda(ID Id);
88 
89  /// isHIP - Is this a HIP input.
90  bool isHIP(ID Id);
91 
92  /// isObjC - Is this an "ObjC" input (Obj-C and Obj-C++ sources and headers).
93  bool isObjC(ID Id);
94 
95  /// isOpenCL - Is this an "OpenCL" input.
96  bool isOpenCL(ID Id);
97 
98  /// isHLSL - Is this an HLSL input.
99  bool isHLSL(ID Id);
100 
101  /// isSrcFile - Is this a source file, i.e. something that still has to be
102  /// preprocessed. The logic behind this is the same that decides if the first
103  /// compilation phase is a preprocessing one.
104  bool isSrcFile(ID Id);
105 
106  /// lookupTypeForExtension - Lookup the type to use for the file
107  /// extension \p Ext.
108  ID lookupTypeForExtension(llvm::StringRef Ext);
109 
110  /// lookupTypeForTypSpecifier - Lookup the type to use for a user
111  /// specified type name.
112  ID lookupTypeForTypeSpecifier(const char *Name);
113 
114  /// getCompilationPhases - Get the list of compilation phases ('Phases') to be
115  /// done for type 'Id' up until including LastPhase.
120  llvm::opt::DerivedArgList &DAL, ID Id);
121 
122  /// lookupCXXTypeForCType - Lookup CXX input type that corresponds to given
123  /// C type (used for clang++ emulation of g++ behaviour)
125 
126  /// Lookup header file input type that corresponds to given
127  /// source file type (used for clang-cl emulation of \Yc).
129 
130 } // end namespace types
131 } // end namespace driver
132 } // end namespace clang
133 
134 #endif
clang::driver::types::isHLSL
bool isHLSL(ID Id)
isHLSL - Is this an HLSL input.
Definition: Types.cpp:289
llvm
YAML serialization mapping.
Definition: Dominators.h:30
clang::driver::types::isCuda
bool isCuda(ID Id)
isCuda - Is this a CUDA input.
Definition: Types.cpp:265
clang::driver::types::getCompilationPhases
llvm::SmallVector< phases::ID, phases::MaxNumberOfPhases > getCompilationPhases(ID Id, phases::ID LastPhase=phases::IfsMerge)
getCompilationPhases - Get the list of compilation phases ('Phases') to be done for type 'Id' up unti...
Definition: Types.cpp:376
llvm::SmallVector
Definition: LLVM.h:38
clang::driver::phases::ID
ID
ID - Ordered values for successive stages in the compilation process which interact with user options...
Definition: Phases.h:17
clang::driver::types::isAcceptedByClang
bool isAcceptedByClang(ID Id)
isAcceptedByClang - Can clang handle this input type.
Definition: Types.cpp:129
clang::driver::types::getPrecompiledType
ID getPrecompiledType(ID Id)
getPrecompiledType - Get the ID of the type for this input when it has been precompiled,...
Definition: Types.cpp:73
clang::driver::types::isCXX
bool isCXX(ID Id)
isCXX - Is this a "C++" input (C++ and Obj-C++ sources and headers).
Definition: Types.cpp:230
clang::driver::types::lookupTypeForExtension
ID lookupTypeForExtension(llvm::StringRef Ext)
lookupTypeForExtension - Lookup the type to use for the file extension Ext.
Definition: Types.cpp:295
clang::driver::types::onlyPrecompileType
bool onlyPrecompileType(ID Id)
onlyPrecompileType - Should this type only be precompiled.
Definition: Types.cpp:100
Id
int Id
Definition: ASTDiff.cpp:189
clang::driver::types::lookupTypeForTypeSpecifier
ID lookupTypeForTypeSpecifier(const char *Name)
lookupTypeForTypSpecifier - Lookup the type to use for a user specified type name.
Definition: Types.cpp:361
clang::driver::types::TY_INVALID
@ TY_INVALID
Definition: Types.h:24
clang::driver::types::isSrcFile
bool isSrcFile(ID Id)
isSrcFile - Is this a source file, i.e.
Definition: Types.cpp:291
clang::driver::types::isObjC
bool isObjC(ID Id)
isObjC - Is this an "ObjC" input (Obj-C and Obj-C++ sources and headers).
Definition: Types.cpp:215
clang::driver::types::appendSuffixForType
bool appendSuffixForType(ID Id)
appendSuffixForType - When generating outputs of this type, should the suffix be appended (instead of...
Definition: Types.cpp:117
clang::driver::types::isLLVMIR
bool isLLVMIR(ID Id)
Is this LLVM IR.
Definition: Types.cpp:252
Phases.h
clang::driver::types::canTypeBeUserSpecified
bool canTypeBeUserSpecified(ID Id)
canTypeBeUserSpecified - Can this type be specified on the command line (by the type name); this is u...
Definition: Types.cpp:105
clang::driver::types::isOpenCL
bool isOpenCL(ID Id)
isOpenCL - Is this an "OpenCL" input.
Definition: Types.cpp:228
clang::driver::types::isAcceptedByFlang
bool isAcceptedByFlang(ID Id)
isAcceptedByFlang - Can flang handle this input type.
Definition: Types.cpp:162
clang::driver::types::canLipoType
bool canLipoType(ID Id)
canLipoType - Is this type acceptable as the output of a universal build (currently,...
Definition: Types.cpp:122
clang::driver::types::getTypeTempSuffix
const char * getTypeTempSuffix(ID Id, bool CLMode=false)
getTypeTempSuffix - Return the suffix to use when creating a temp file of this type,...
Definition: Types.cpp:83
clang::driver::phases::IfsMerge
@ IfsMerge
Definition: Phases.h:24
clang::driver::types::ID
ID
Definition: Types.h:23
clang::driver::types::isDerivedFromC
bool isDerivedFromC(ID Id)
isDerivedFromC - Is the input derived from C.
Definition: Types.cpp:176
clang::driver::types
Definition: Types.h:22
clang
Definition: CalledOnceCheck.h:17
clang::driver::Driver
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:75
clang::driver::types::lookupCXXTypeForCType
ID lookupCXXTypeForCType(ID Id)
lookupCXXTypeForCType - Lookup CXX input type that corresponds to given C type (used for clang++ emul...
Definition: Types.cpp:392
clang::driver::types::isHIP
bool isHIP(ID Id)
isHIP - Is this a HIP input.
Definition: Types.cpp:277
clang::driver::types::getPreprocessedType
ID getPreprocessedType(ID Id)
getPreprocessedType - Get the ID of the type for this input when it has been preprocessed,...
Definition: Types.cpp:56
clang::driver::types::getTypeName
const char * getTypeName(ID Id)
getTypeName - Return the name of the type for Id.
Definition: Types.cpp:52
clang::driver::types::lookupHeaderTypeForSourceType
ID lookupHeaderTypeForSourceType(ID Id)
Lookup header file input type that corresponds to given source file type (used for clang-cl emulation...
Definition: Types.cpp:408
clang::driver::types::TY_LAST
@ TY_LAST
Definition: Types.h:28