1 //===--- Types.h - Input & Temporary Driver Types ---------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_DRIVER_TYPES_H
10 #define LLVM_CLANG_DRIVER_TYPES_H
12 #include "clang/Driver/Phases.h"
13 #include "llvm/ADT/SmallVector.h"
23 #define TYPE(NAME, ID, PP_TYPE, TEMP_SUFFIX, FLAGS) TY_##ID,
24 #include "clang/Driver/Types.def"
29 /// getTypeName - Return the name of the type for \p Id.
30 const char *getTypeName(ID Id);
32 /// getPreprocessedType - Get the ID of the type for this input when
33 /// it has been preprocessed, or INVALID if this input is not
35 ID getPreprocessedType(ID Id);
37 /// getPrecompiledType - Get the ID of the type for this input when
38 /// it has been precompiled, or INVALID if this input is not
40 ID getPrecompiledType(ID Id);
42 /// getTypeTempSuffix - Return the suffix to use when creating a
43 /// temp file of this type, or null if unspecified.
44 const char *getTypeTempSuffix(ID Id, bool CLMode = false);
46 /// onlyAssembleType - Should this type only be assembled.
47 bool onlyAssembleType(ID Id);
49 /// onlyPrecompileType - Should this type only be precompiled.
50 bool onlyPrecompileType(ID Id);
52 /// canTypeBeUserSpecified - Can this type be specified on the
53 /// command line (by the type name); this is used when forwarding
55 bool canTypeBeUserSpecified(ID Id);
57 /// appendSuffixForType - When generating outputs of this type,
58 /// should the suffix be appended (instead of replacing the existing
60 bool appendSuffixForType(ID Id);
62 /// canLipoType - Is this type acceptable as the output of a
63 /// universal build (currently, just the Nothing, Image, and Object
65 bool canLipoType(ID Id);
67 /// isAcceptedByClang - Can clang handle this input type.
68 bool isAcceptedByClang(ID Id);
70 /// isCXX - Is this a "C++" input (C++ and Obj-C++ sources and headers).
76 /// isCuda - Is this a CUDA input.
79 /// isHIP - Is this a HIP input.
82 /// isObjC - Is this an "ObjC" input (Obj-C and Obj-C++ sources and headers).
85 /// isSrcFile - Is this a source file, i.e. something that still has to be
86 /// preprocessed. The logic behind this is the same that decides if the first
87 /// compilation phase is a preprocessing one.
88 bool isSrcFile(ID Id);
90 /// lookupTypeForExtension - Lookup the type to use for the file
92 ID lookupTypeForExtension(llvm::StringRef Ext);
94 /// lookupTypeForTypSpecifier - Lookup the type to use for a user
95 /// specified type name.
96 ID lookupTypeForTypeSpecifier(const char *Name);
98 /// getCompilationPhases - Get the list of compilation phases ('Phases') to be
99 /// done for type 'Id'.
100 void getCompilationPhases(
102 llvm::SmallVectorImpl<phases::ID> &Phases);
104 /// lookupCXXTypeForCType - Lookup CXX input type that corresponds to given
105 /// C type (used for clang++ emulation of g++ behaviour)
106 ID lookupCXXTypeForCType(ID Id);
108 /// Lookup header file input type that corresponds to given
109 /// source file type (used for clang-cl emulation of \Yc).
110 ID lookupHeaderTypeForSourceType(ID Id);
112 } // end namespace types
113 } // end namespace driver
114 } // end namespace clang