source: src/Common/SemanticError.cc @ d55d7a6

aaron-thesisarm-ehcleanup-dtorsdeferred_resndemanglerjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerresolv-newwith_gc
Last change on this file since d55d7a6 was d55d7a6, checked in by Thierry Delisle <tdelisle@…>, 4 years ago

Massive change to errors to enable warnings

  • Property mode set to 100644
File size: 1.6 KB
Line 
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//
7// SemanticError.cc --
8//
9// Author           : Richard C. Bilson
10// Created On       : Mon May 18 07:44:20 2015
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Tue Aug 29 18:17:35 2017
13// Update Count     : 3
14//
15
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
21
22#include "Common/utility.h"                                                             // for to_string, CodeLocation (ptr only)
23#include "SemanticError.h"
24
25SemanticError::SemanticError( CodeLocation location, std::string error ) {
26        append( location, error );
27}
28
29void SemanticError::append( SemanticError &other ) {
30        errors.splice( errors.end(), other.errors );
31}
32
33void SemanticError::append( CodeLocation location, const std::string & msg ) {
34        errors.emplace_back( location, msg );
35}
36
37bool SemanticError::isEmpty() const {
38        return errors.empty();
39}
40
41void SemanticError::print() {
42        using std::to_string;
43        for( auto err : errors ) {
44                std::cerr << bold() << err.location << error_str() << reset_font() << err.description << std::endl;
45        }
46}
47
48SemanticWarning::SemanticWarning( CodeLocation location, std::string msg ) {
49        std::cerr << bold() << location << warning_str() << reset_font() << msg << std::endl;
50}
51
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.