Types.h revision 4db938ceb72dbaa5f7b50f6420a72629acbf29eb
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" 14c1b5fa81a2dfa4fea2e25bf057363658e7b43681Daniel Dunbar 15e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbarnamespace clang { 16e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbarnamespace driver { 17e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbarnamespace types { 18e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar enum ID { 19e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar TY_INVALID, 20e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar#define TYPE(NAME, ID, PP_TYPE, TEMP_SUFFIX, FLAGS) TY_##ID, 21e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar#include "clang/Driver/Types.def" 22e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar#undef TYPE 23e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar TY_LAST 24e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar }; 25e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 26e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// getTypeName - Return the name of the type for \arg Id. 27e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar const char *getTypeName(ID Id); 28e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 29e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// getPreprocessedType - Get the ID of the type for this input when 30e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// it has been preprocessed, or INVALID if this input is not 31e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// preprocessed. 32e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar ID getPreprocessedType(ID Id); 33e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 34e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// getTypeTempSuffix - Return the suffix to use when creating a 35e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// temp file of this type, or null if unspecified. 36e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar const char *getTypeTempSuffix(ID Id); 37e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 38e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// onlyAssembleType - Should this type only be assembled. 39e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar bool onlyAssembleType(ID Id); 40e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 41e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// onlyPrecompileType - Should this type only be precompiled. 42e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar bool onlyPrecompileType(ID Id); 43e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 44e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// canTypeBeUserSpecified - Can this type be specified on the 45e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// command line (by the type name); this is used when forwarding 46e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// commands to gcc. 47e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar bool canTypeBeUserSpecified(ID Id); 48e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 49e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// appendSuffixForType - When generating outputs of this type, 50e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// should the suffix be appended (instead of replacing the existing 51e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// suffix). 52e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar bool appendSuffixForType(ID Id); 53e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 549f5ef9426fee383cb42b72cee1d6dc949c8c0189Daniel Dunbar /// canLipoType - Is this type acceptable as the output of a 559f5ef9426fee383cb42b72cee1d6dc949c8c0189Daniel Dunbar /// universal build (currently, just the Nothing, Image, and Object 569f5ef9426fee383cb42b72cee1d6dc949c8c0189Daniel Dunbar /// types). 579f5ef9426fee383cb42b72cee1d6dc949c8c0189Daniel Dunbar bool canLipoType(ID Id); 589f5ef9426fee383cb42b72cee1d6dc949c8c0189Daniel Dunbar 594db938ceb72dbaa5f7b50f6420a72629acbf29ebDaniel Dunbar /// isAcceptedByClang - Can clang handle this input type. 604db938ceb72dbaa5f7b50f6420a72629acbf29ebDaniel Dunbar bool isAcceptedByClang(ID Id); 614db938ceb72dbaa5f7b50f6420a72629acbf29ebDaniel Dunbar 624db938ceb72dbaa5f7b50f6420a72629acbf29ebDaniel Dunbar /// isCXX - Is this a "C++" input (C++ and Obj-C++ sources and headers). 634db938ceb72dbaa5f7b50f6420a72629acbf29ebDaniel Dunbar bool isCXX(ID Id); 644db938ceb72dbaa5f7b50f6420a72629acbf29ebDaniel Dunbar 65e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// lookupTypeForExtension - Lookup the type to use for the file 66e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// extension \arg Ext. 67e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar ID lookupTypeForExtension(const char *Ext); 68e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 69e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// lookupTypeForTypSpecifier - Lookup the type to use for a user 70e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar /// specified type name. 71e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar ID lookupTypeForTypeSpecifier(const char *Name); 72e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 73c1b5fa81a2dfa4fea2e25bf057363658e7b43681Daniel Dunbar /// getNumCompilationPhases - Return the complete number of phases 74c1b5fa81a2dfa4fea2e25bf057363658e7b43681Daniel Dunbar /// to be done for this type. 75c1b5fa81a2dfa4fea2e25bf057363658e7b43681Daniel Dunbar unsigned getNumCompilationPhases(ID Id); 76c1b5fa81a2dfa4fea2e25bf057363658e7b43681Daniel Dunbar 77c1b5fa81a2dfa4fea2e25bf057363658e7b43681Daniel Dunbar /// getCompilationPhase - Return the \args N th compilation phase to 78c1b5fa81a2dfa4fea2e25bf057363658e7b43681Daniel Dunbar /// be done for this type. 79c1b5fa81a2dfa4fea2e25bf057363658e7b43681Daniel Dunbar phases::ID getCompilationPhase(ID Id, unsigned N); 80c1b5fa81a2dfa4fea2e25bf057363658e7b43681Daniel Dunbar 81e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar} // end namespace types 82e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar} // end namespace driver 83e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar} // end namespace clang 84e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar 85e9fba573bd9433b89a12f747f2c4ccfa490a79cbDaniel Dunbar#endif 86