source: src/Common/SemanticError.cc @ d55d7a6

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since d55d7a6 was d55d7a6, checked in by Thierry Delisle <tdelisle@…>, 6 years ago

Massive change to errors to enable warnings

  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[51587aa]1//
2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
[3906301]7// SemanticError.cc --
[51587aa]8//
9// Author           : Richard C. Bilson
10// Created On       : Mon May 18 07:44:20 2015
[01aeade]11// Last Modified By : Peter A. Buhr
[9ed4f94]12// Last Modified On : Tue Aug 29 18:17:35 2017
13// Update Count     : 3
[51587aa]14//
[51b7345]15
[9ed4f94]16#include <cstdio>                                                                               // for fileno, stderr
17#include <unistd.h>                                                                             // for isatty
18#include <iostream>                                                                             // for basic_ostream, operator<<, ostream
19#include <list>                                                                                 // for list, _List_iterator
20#include <string>                                                                               // for string, operator<<, operator+, to_string
[51b7345]21
[9ed4f94]22#include "Common/utility.h"                                                             // for to_string, CodeLocation (ptr only)
[51b7345]23#include "SemanticError.h"
24
[d55d7a6]25SemanticError::SemanticError( CodeLocation location, std::string error ) {
26        append( location, error );
[51b7345]27}
28
[01aeade]29void SemanticError::append( SemanticError &other ) {
[138e29e]30        errors.splice( errors.end(), other.errors );
[3906301]31}
32
[d55d7a6]33void SemanticError::append( CodeLocation location, const std::string & msg ) {
34        errors.emplace_back( location, msg );
[51b7345]35}
36
[01aeade]37bool SemanticError::isEmpty() const {
38        return errors.empty();
[51b7345]39}
40
[d55d7a6]41void SemanticError::print() {
[138e29e]42        using std::to_string;
[9ed4f94]43        for( auto err : errors ) {
[d55d7a6]44                std::cerr << bold() << err.location << error_str() << reset_font() << err.description << std::endl;
[138e29e]45        }
[51b7345]46}
[01aeade]47
[d55d7a6]48SemanticWarning::SemanticWarning( CodeLocation location, std::string msg ) {
49        std::cerr << bold() << location << warning_str() << reset_font() << msg << std::endl;
[294647b]50}
51
[51587aa]52// Local Variables: //
53// tab-width: 4 //
54// mode: c++ //
55// compile-command: "make install" //
56// End: //
Note: See TracBrowser for help on using the repository browser.