Example #1
0
void Type::dump() const {
    StringBuilder output;
#ifdef TYPE_DEBUG
    output.enableColor(true);
    output << "TYPE:\n";
    fullDebug(output, INDENT);
    output.setColor(COL_NORM);
#else
    debugPrint(output);
#endif
    fprintf(stderr, "[TYPE] '%s'\n", output.c_str());
}
Example #2
0
void QualType::dump() const {
    if (isNull()) {
        fprintf(stderr, "NULL\n");
    } else {
        StringBuilder output;
#ifdef TYPE_DEBUG
        output.enableColor(true);
        output << "TYPE:\n";
        fullDebug(output, INDENT);
        output.setColor(COL_NORM);
#else
        debugPrint(output);
#endif
        fprintf(stderr, "%s\n", output.c_str());
    }
}
Example #3
0
unsigned TypeResolver::checkUnresolvedType(const UnresolvedType* type, bool used_public) {
    IdentifierExpr* moduleName = type->getModuleName();
    IdentifierExpr* typeName = type->getTypeName();
    SourceLocation tLoc = typeName->getLocation();
    const std::string& tName = typeName->getName();

    Decl* D = 0;
    if (moduleName) {   // mod.type
        const std::string& mName = moduleName->getName();
        const Module* mod = globals.findUsedModule(mName, moduleName->getLocation(), used_public);
        if (!mod) return 1;
        Decl* modDecl = globals.findSymbol(mName, moduleName->getLocation(), true, used_public);
        assert(modDecl);
        moduleName->setDecl(modDecl);

        D =  globals.findSymbolInModule(tName, tLoc, mod);
    } else {
        D = globals.findSymbol(tName, tLoc, true, used_public);
    }
    if (!D) return 1;
    TypeDecl* TD = dyncast<TypeDecl>(D);
    if (!TD) {
        StringBuilder name;
        type->printLiteral(name);
        Diags.Report(tLoc, diag::err_not_a_typename) << name.c_str();
        return 1;
    }
    bool external = globals.isExternal(D->getModule());
    if (used_public &&!external && !TD->isPublic()) {
        StringBuilder name;
        type->printLiteral(name);
        Diags.Report(tLoc, diag::err_non_public_type) << AnalyserUtils::fullName(TD->getModule()->getName(), TD->getName());
        //Diags.Report(tLoc, diag::err_non_public_type) << name;
        return 1;
    }
    D->setUsed();
    if (used_public || external) D->setUsedPublic();
    typeName->setDecl(TD);
    return 0;
}
Example #4
0
void Decl::dump() const {
    StringBuilder buffer;
    print(buffer, 0);
    printf("%s\n", buffer.c_str());
}