private static boolean canTypeCheckWithoutFailure(TranslationUnit reference, ShadingLanguageVersion shadingLanguageVersion) { // Debugging aid: fail early if we end up messing up the translation unit so that type checking // does not work. new Typer(reference, shadingLanguageVersion); return true; }
SimplifyExprReductionOpportunities( TranslationUnit tu, ReducerContext context) { super(tu, context); this.typer = new Typer(tu, context.getShadingLanguageVersion()); this.inLiveInjectedStmtOrDeclaration = false; }
private void makeInjectedArrayAccessesInBounds(TranslationUnit tu, List<Stmt> injectedStmts, ShadingLanguageVersion shadingLanguageVersion) { Typer typer = new Typer(tu, shadingLanguageVersion); for (Stmt stmt : injectedStmts) { MakeArrayAccessesInBounds.makeInBounds(stmt, typer); } }
private Inliner(FunctionCallExpr call, TranslationUnit tu, ShadingLanguageVersion shadingLanguageVersion) { this.call = call; this.tu = tu; this.shadingLanguageVersion = shadingLanguageVersion; this.typer = new Typer(tu, shadingLanguageVersion); this.parentMap = IParentMap.createParentMap(tu); }
@Override public boolean apply(TranslationUnit tu, TransformationProbabilities probabilities, ShadingLanguageVersion shadingLanguageVersion, IRandom generator, GenerationParams generationParams) { List<IMutationPoint> mutationPoints = new MutationPoints(new Typer(tu, shadingLanguageVersion), tu, shadingLanguageVersion, generator, generationParams).getMutationPoints(probabilities); mutationPoints.forEach(IMutationPoint::applyMutation); return !mutationPoints.isEmpty(); }
private FunctionReductionOpportunities(TranslationUnit tu, ReducerContext context) { this.typer = new Typer(tu, context.getShadingLanguageVersion()); this.opportunities = new ArrayList<>(); this.calledFunctions = new HashSet<>(); this.declaredFunctions = Collections .unmodifiableList(AstUtil.getFunctionPrototypesFromShader(tu)); }
private void obfuscateTranslationUnit(TranslationUnit tu) { this.typer = new Typer(tu, tu.getShadingLanguageVersion()); visit(tu); for (VariableDeclInfo declInfo : varDeclMapping.keySet()) { assert varDeclMapping.containsKey(declInfo); declInfo.setName(varDeclMapping.get(declInfo)); } for (ParameterDecl parameterDecl : paramDeclMapping.keySet()) { assert paramDeclMapping.containsKey(parameterDecl); parameterDecl.setName(paramDeclMapping.get(parameterDecl)); } for (StructDefinitionType structDefinitionType : structDefinitionTypes) { if (structDefinitionType.hasStructNameType()) { final StructNameType structNameType = structDefinitionType.getStructNameType(); for (int i = 0; i < structDefinitionType.getNumFields(); i++) { assert structFieldRenaming.get(structNameType) .containsKey(structDefinitionType.getFieldName(i)); structDefinitionType.setFieldName(i, structFieldRenaming.get(structNameType) .get(structDefinitionType.getFieldName(i))); } } } new StandardVisitor() { @Override public void visitStructNameType(StructNameType structNameType) { structNameType.setName(namedStructRenaming.get(structNameType.getName())); } }.visit(tu); }
final Typer typer = new Typer(tu, ShadingLanguageVersion.ESSL_100);