diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-01-10 01:50:42 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-01-10 01:50:42 +0000 |
commit | d38c11e43822513d29a5e652c751c75198ec8a33 (patch) | |
tree | 85b9423a9e407ee0a0d1ff2596b9a2d153f605f6 | |
parent | 5a2f5d304897220f16e00c05cf122dd95e859aa9 (diff) |
ccc: Add information about whether type can be user specified (a -x
argument) to InputType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62019 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | tools/ccc/ccclib/Types.py | 68 |
1 files changed, 45 insertions, 23 deletions
diff --git a/tools/ccc/ccclib/Types.py b/tools/ccc/ccclib/Types.py index 4d04e0a3d1..40fe01f550 100644 --- a/tools/ccc/ccclib/Types.py +++ b/tools/ccc/ccclib/Types.py @@ -3,13 +3,15 @@ class InputType(object): the driver recognizes and control processing.""" def __init__(self, name, preprocess=None, onlyAssemble=False, - onlyPrecompile=False, tempSuffix=None): + onlyPrecompile=False, tempSuffix=None, + canBeUserSpecified=False): assert preprocess is None or isinstance(preprocess, InputType) self.name = name self.preprocess = preprocess self.onlyAssemble = onlyAssemble self.onlyPrecompile = onlyPrecompile self.tempSuffix = tempSuffix + self.canBeUserSpecified = canBeUserSpecified def __repr__(self): return '%s(%r, %r, %r, %r, %r)' % (self.__class__.__name__, @@ -17,40 +19,55 @@ class InputType(object): self.preprocess, self.onlyAssemble, self.onlyPrecompile, - self.tempSuffix) + self.tempSuffix, + self.canBeUserSpecified) # C family source language (with and without preprocessing). -CTypeNoPP = InputType('cpp-output', tempSuffix='i') -CType = InputType('c', CTypeNoPP) -ObjCTypeNoPP = InputType('objective-c-cpp-output', tempSuffix='mi') -ObjCType = InputType('objective-c', ObjCTypeNoPP) -CXXTypeNoPP = InputType('c++-cpp-output', tempSuffix='ii') -CXXType = InputType('c++', CXXTypeNoPP) -ObjCXXTypeNoPP = InputType('objective-c++-cpp-output', tempSuffix='mii') -ObjCXXType = InputType('c++', ObjCXXTypeNoPP) +CTypeNoPP = InputType('cpp-output', tempSuffix='i', + canBeUserSpecified=True) +CType = InputType('c', CTypeNoPP, + canBeUserSpecified=True) +ObjCTypeNoPP = InputType('objective-c-cpp-output', tempSuffix='mi', + canBeUserSpecified=True) +ObjCType = InputType('objective-c', ObjCTypeNoPP, + canBeUserSpecified=True) +CXXTypeNoPP = InputType('c++-cpp-output', tempSuffix='ii', + canBeUserSpecified=True) +CXXType = InputType('c++', CXXTypeNoPP, + canBeUserSpecified=True) +ObjCXXTypeNoPP = InputType('objective-c++-cpp-output', tempSuffix='mii', + canBeUserSpecified=True) +ObjCXXType = InputType('objective-c++', ObjCXXTypeNoPP, + canBeUserSpecified=True) # C family input files to precompile. CHeaderNoPPType = InputType('c-header-cpp-output', onlyPrecompile=True, tempSuffix='pch') -CHeaderType = InputType('c-header', CHeaderNoPPType, onlyPrecompile=True) +CHeaderType = InputType('c-header', CHeaderNoPPType, onlyPrecompile=True, + canBeUserSpecified=True) ObjCHeaderNoPPType = InputType('objective-c-header-cpp-output', onlyPrecompile=True, tempSuffix='pch') -ObjCHeaderType = InputType('objective-c-header', ObjCHeaderNoPPType, onlyPrecompile=True) +ObjCHeaderType = InputType('objective-c-header', ObjCHeaderNoPPType, onlyPrecompile=True, + canBeUserSpecified=True) CXXHeaderNoPPType = InputType('c++-header-cpp-output', onlyPrecompile=True, tempSuffix='pch') -CXXHeaderType = InputType('c++-header', CXXHeaderNoPPType, onlyPrecompile=True) +CXXHeaderType = InputType('c++-header', CXXHeaderNoPPType, onlyPrecompile=True, + canBeUserSpecified=True) ObjCXXHeaderNoPPType = InputType('objective-c++-header-cpp-output', onlyPrecompile=True, tempSuffix='pch') -ObjCXXHeaderType = InputType('objective-c++-header', ObjCXXHeaderNoPPType, onlyPrecompile=True) +ObjCXXHeaderType = InputType('objective-c++-header', ObjCXXHeaderNoPPType, onlyPrecompile=True, + canBeUserSpecified=True) # Other languages. -AdaType = InputType('ada') -AsmTypeNoPP = InputType('assembler', onlyAssemble=True, tempSuffix='s') -AsmType = InputType('assembler-with-cpp', AsmTypeNoPP, onlyAssemble=True) -FortranTypeNoPP = InputType('fortran') -FortranType = InputType('fortran', FortranTypeNoPP) -JavaType = InputType('java') +AdaType = InputType('ada', canBeUserSpecified=True) +AsmTypeNoPP = InputType('assembler', onlyAssemble=True, tempSuffix='s', + canBeUserSpecified=True) +AsmType = InputType('assembler-with-cpp', AsmTypeNoPP, onlyAssemble=True, + canBeUserSpecified=True) +FortranTypeNoPP = InputType('f95', canBeUserSpecified=True) +FortranType = InputType('f95-cpp-input', FortranTypeNoPP, canBeUserSpecified=True) +JavaType = InputType('java', canBeUserSpecified=True) # Misc. PCHType = InputType('precompiled-header') ObjectType = InputType('object', tempSuffix='o') -TreelangType = InputType('treelang') +TreelangType = InputType('treelang', canBeUserSpecified=True) ImageType = InputType('image', tempSuffix='out') NothingType = InputType('nothing') @@ -116,8 +133,13 @@ kTypeSpecifierMap = { 'assembler' : AsmTypeNoPP, 'assembler-with-cpp' : AsmType, 'ada' : AdaType, - 'f95' : FortranType, - 'f95-cpp-input' : FortranTypeNoPP, + 'f95-cpp-input' : FortranType, + 'f95' : FortranTypeNoPP, 'java' : JavaType, 'treelang' : TreelangType, } + +# Check that the type specifier map at least matches what the types +# believe to be true. +assert not [name for name,type in kTypeSpecifierMap.items() + if type and (type.name != name or not type.canBeUserSpecified)] |