This machine mirrors various open-source projects.
20 Gbit/s uplink.
If there are any issues or you want another project mirrored, please contact
mirror-service -=AT=- netcologne DOT de !
00001 //===-- ast/AttribDecl.cpp ------------------------------------ -*- C++ -*-===// 00002 // 00003 // This file is distributed under the MIT license. See LICENSE.txt for details. 00004 // 00005 // Copyright (C) 2010, Stephen Wilson 00006 // 00007 //===----------------------------------------------------------------------===// 00008 00009 #include "comma/ast/AstResource.h" 00010 #include "comma/ast/AttribDecl.h" 00011 00012 using namespace comma; 00013 using namespace comma::attrib; 00014 using llvm::dyn_cast; 00015 using llvm::cast; 00016 using llvm::isa; 00017 00018 //===----------------------------------------------------------------------===// 00019 // PosAD 00020 PosAD *PosAD::create(AstResource &resource, IntegerDecl *prefixDecl) 00021 { 00022 IntegerType *prefix = prefixDecl->getType(); 00023 IdentifierInfo *name = resource.getIdentifierInfo(getAttributeString(Pos)); 00024 Location loc = prefixDecl->getLocation(); 00025 00026 // S'Pos denotes a function with the following profile: 00027 // function (Arg : S'Base) return universal_integer; 00028 IdentifierInfo *key = resource.getIdentifierInfo("Arg"); 00029 Type *argType = prefix->getBaseSubtype(); 00030 Type *retType = UniversalType::getUniversalInteger(); 00031 00032 FunctionType *fnTy = resource.getFunctionType(&argType, 1, retType); 00033 00034 return new PosAD(prefix, name, loc, &key, fnTy, prefixDecl); 00035 } 00036 00037 PosAD *PosAD::create(AstResource &resource, EnumerationDecl *prefixDecl) 00038 { 00039 EnumerationType *prefix = prefixDecl->getType(); 00040 IdentifierInfo *name = resource.getIdentifierInfo(getAttributeString(Pos)); 00041 Location loc = prefixDecl->getLocation(); 00042 00043 // S'Pos denotes a function with the following profile: 00044 // function (Arg : S'Base) return universal_integer; 00045 IdentifierInfo *key = resource.getIdentifierInfo("Arg"); 00046 Type *argType = prefix->getBaseSubtype(); 00047 Type *retType = UniversalType::getUniversalInteger(); 00048 00049 FunctionType *fnTy = resource.getFunctionType(&argType, 1, retType); 00050 00051 return new PosAD(prefix, name, loc, &key, fnTy, prefixDecl); 00052 } 00053 00054 //===----------------------------------------------------------------------===// 00055 // ValAD 00056 ValAD *ValAD::create(AstResource &resource, IntegerDecl *prefixDecl) 00057 { 00058 IntegerType *prefix = prefixDecl->getType(); 00059 IdentifierInfo *name = resource.getIdentifierInfo(getAttributeString(Val)); 00060 Location loc = prefixDecl->getLocation(); 00061 00062 // S'Val denotes a function with the following profile: 00063 // function (Arg : universal_integer) return S'Base 00064 IdentifierInfo *key = resource.getIdentifierInfo("Arg"); 00065 Type *argType = UniversalType::getUniversalInteger(); 00066 Type *retType = prefix->getBaseSubtype(); 00067 00068 FunctionType *fnTy = resource.getFunctionType(&argType, 1, retType); 00069 00070 return new ValAD(prefix, name, loc, &key, fnTy, prefixDecl); 00071 } 00072 00073 ValAD *ValAD::create(AstResource &resource, EnumerationDecl *prefixDecl) 00074 { 00075 EnumerationType *prefix = prefixDecl->getType(); 00076 IdentifierInfo *name = resource.getIdentifierInfo(getAttributeString(Val)); 00077 Location loc = prefixDecl->getLocation(); 00078 00079 // S'Val denotes a function with the following profile: 00080 // function (Arg : universal_integer) return S'Base 00081 IdentifierInfo *key = resource.getIdentifierInfo("Arg"); 00082 Type *argType = UniversalType::getUniversalInteger(); 00083 Type *retType = prefix->getBaseSubtype(); 00084 00085 FunctionType *fnTy = resource.getFunctionType(&argType, 1, retType); 00086 00087 return new ValAD(prefix, name, loc, &key, fnTy, prefixDecl); 00088 }