Types.h revision 909930fc19ff69b08f2ea6f6e2996d24c816f311
1e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar//===--- Types.h - Input & Temporary Driver Types ---------------*- C++ -*-===// 2e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar// 3e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar// The LLVM Compiler Infrastructure 4e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar// 5e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar// This file is distributed under the University of Illinois Open Source 6e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar// License. See LICENSE.TXT for details. 7e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar// 8e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar//===----------------------------------------------------------------------===// 9e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 10e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar#ifndef CLANG_DRIVER_TYPES_H_ 11e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar#define CLANG_DRIVER_TYPES_H_ 12e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 13c1b5fa81a2dfa4fea2e25bf057363658e7b43681Daniel Dunbar#include "clang/Driver/Phases.h" 14b9aa6739700d10e99da64cfa9b58ba7ca1c248e2Matthew Curtis#include "llvm/ADT/SmallVector.h" 15c1b5fa81a2dfa4fea2e25bf057363658e7b43681Daniel Dunbar 16e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbarnamespace clang { 17e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbarnamespace driver { 18e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbarnamespace types { 19e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar enum ID { 20e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar TY_INVALID, 21e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar#define TYPE(NAME, ID, PP_TYPE, TEMP_SUFFIX, FLAGS) TY_##ID, 22e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar#include "clang/Driver/Types.def" 23e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar#undef TYPE 24e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar TY_LAST 25e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar }; 26e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 27c1a88f27bea81b270c63329a87811f91c8e467feJames Dennett /// getTypeName - Return the name of the type for \p Id. 28e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar const char *getTypeName(ID Id); 29e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 30e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// getPreprocessedType - Get the ID of the type for this input when 31e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// it has been preprocessed, or INVALID if this input is not 32e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// preprocessed. 33e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar ID getPreprocessedType(ID Id); 34e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 35e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// getTypeTempSuffix - Return the suffix to use when creating a 36e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// temp file of this type, or null if unspecified. 37909930fc19ff69b08f2ea6f6e2996d24c816f311Hans Wennborg const char *getTypeTempSuffix(ID Id, bool CLMode = false); 38e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 39e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// onlyAssembleType - Should this type only be assembled. 40e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar bool onlyAssembleType(ID Id); 41e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 42e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// onlyPrecompileType - Should this type only be precompiled. 43e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar bool onlyPrecompileType(ID Id); 44e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 45e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// canTypeBeUserSpecified - Can this type be specified on the 46e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// command line (by the type name); this is used when forwarding 47e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// commands to gcc. 48e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar bool canTypeBeUserSpecified(ID Id); 49e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 50e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// appendSuffixForType - When generating outputs of this type, 51e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// should the suffix be appended (instead of replacing the existing 52e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// suffix). 53e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar bool appendSuffixForType(ID Id); 54e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 559f5ef9426fee383cb42b72cee1d6dc949c8c0189Daniel Dunbar /// canLipoType - Is this type acceptable as the output of a 569f5ef9426fee383cb42b72cee1d6dc949c8c0189Daniel Dunbar /// universal build (currently, just the Nothing, Image, and Object 579f5ef9426fee383cb42b72cee1d6dc949c8c0189Daniel Dunbar /// types). 589f5ef9426fee383cb42b72cee1d6dc949c8c0189Daniel Dunbar bool canLipoType(ID Id); 599f5ef9426fee383cb42b72cee1d6dc949c8c0189Daniel Dunbar 605bab9ae87c41148ee2f92d312945c1e9303222e8Nick Lewycky /// isAcceptedByClang - Can clang handle this input type. 615bab9ae87c41148ee2f92d312945c1e9303222e8Nick Lewycky bool isAcceptedByClang(ID Id); 625bab9ae87c41148ee2f92d312945c1e9303222e8Nick Lewycky 634db938ceb72dbaa5f7b50f6420a72629acbf29ebDaniel Dunbar /// isCXX - Is this a "C++" input (C++ and Obj-C++ sources and headers). 644db938ceb72dbaa5f7b50f6420a72629acbf29ebDaniel Dunbar bool isCXX(ID Id); 654db938ceb72dbaa5f7b50f6420a72629acbf29ebDaniel Dunbar 6677544fde702fdab2a6150ba812ecf04eb1e6eab6Daniel Dunbar /// isObjC - Is this an "ObjC" input (Obj-C and Obj-C++ sources and headers). 6777544fde702fdab2a6150ba812ecf04eb1e6eab6Daniel Dunbar bool isObjC(ID Id); 6877544fde702fdab2a6150ba812ecf04eb1e6eab6Daniel Dunbar 69e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// lookupTypeForExtension - Lookup the type to use for the file 70c1a88f27bea81b270c63329a87811f91c8e467feJames Dennett /// extension \p Ext. 71e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar ID lookupTypeForExtension(const char *Ext); 72e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 73e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// lookupTypeForTypSpecifier - Lookup the type to use for a user 74e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// specified type name. 75e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar ID lookupTypeForTypeSpecifier(const char *Name); 76e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 77b9aa6739700d10e99da64cfa9b58ba7ca1c248e2Matthew Curtis /// getCompilationPhases - Get the list of compilation phases ('Phases') to be 78b9aa6739700d10e99da64cfa9b58ba7ca1c248e2Matthew Curtis /// done for type 'Id'. 79b9aa6739700d10e99da64cfa9b58ba7ca1c248e2Matthew Curtis void getCompilationPhases( 80b9aa6739700d10e99da64cfa9b58ba7ca1c248e2Matthew Curtis ID Id, 816b9240e058bf3451685df73fc8ce181b3046e92bCraig Topper llvm::SmallVectorImpl<phases::ID> &Phases); 82c1b5fa81a2dfa4fea2e25bf057363658e7b43681Daniel Dunbar 8351679c5e4828b8a64953c4f3db162ca963bf7b03Daniel Dunbar /// lookupCXXTypeForCType - Lookup CXX input type that corresponds to given 8451679c5e4828b8a64953c4f3db162ca963bf7b03Daniel Dunbar /// C type (used for clang++ emulation of g++ behaviour) 8551679c5e4828b8a64953c4f3db162ca963bf7b03Daniel Dunbar ID lookupCXXTypeForCType(ID Id); 86c1b5fa81a2dfa4fea2e25bf057363658e7b43681Daniel Dunbar 87e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar} // end namespace types 88e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar} // end namespace driver 89e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar} // end namespace clang 90e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 91e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar#endif 92