source: src/Common/ErrorObjects.h @ f7496c5

ADTast-experimentalenumpthread-emulationqualifiedEnum
Last change on this file since f7496c5 was 9d1e3f7, checked in by Rob Schluntz <rschlunt@…>, 7 years ago

Minor updates

  • 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// ErrorObjects.h --
8//
9// Author           : Thierry Delisle
10// Created On       : Wed Feb 28 15:16:47 2018
11// Last Modified By :
12// Last Modified On :
13// Update Count     :
14//
15
16#pragma once
17
18
19#include <exception>    // for exception
20#include <iostream>     // for ostream
21#include <list>         // for list
22#include <string>               // for string
23#include <unistd.h>     // for isatty
24
25#include "CodeLocation.h"                                                               // for CodeLocation, toString
26
27struct error {
28        CodeLocation location;
29        std::string description;
30
31        error() = default;
32        error( CodeLocation loc, const std::string & str ) : location( loc ), description( str ) {}
33};
34
35class SemanticErrorException : public std::exception {
36  public:
37        SemanticErrorException() = default;
38        SemanticErrorException( CodeLocation location, std::string error );
39        ~SemanticErrorException() throw() {}
40
41        void append( SemanticErrorException & other );
42        void append( CodeLocation location, const std::string & );
43        bool isEmpty() const;
44        void print();
45  private:
46        std::list< error > errors;
47};
48
49void SemanticWarningImpl( CodeLocation location, std::string error );
50
51template< typename T >
52static inline void SemanticWarningImpl( const T * obj, const std::string & error ) {
53        SemanticWarning( obj->location, toString( error, obj ) );
54}
55
56template< typename T >
57static inline void SemanticWarningImpl( CodeLocation location, const T * obj, const std::string & error ) {
58        SemanticWarningImpl( location, toString( error, obj ) );
59}
Note: See TracBrowser for help on using the repository browser.