[f69fac7] | 1 | //
|
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2019 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 | // Util.hpp -- General utilities for working with the AST.
|
---|
| 8 | //
|
---|
| 9 | // Author : Andrew Beach
|
---|
| 10 | // Created On : Wed Jan 19 9:37:00 2022
|
---|
| 11 | // Last Modified By : Andrew Beach
|
---|
| 12 | // Last Modified On : Fri Feb 18 9:43:00 2022
|
---|
| 13 | // Update Count : 0
|
---|
| 14 | //
|
---|
| 15 |
|
---|
| 16 | #pragma once
|
---|
| 17 |
|
---|
[d3d54b3] | 18 | #include "Fwd.hpp"
|
---|
| 19 |
|
---|
[f69fac7] | 20 | namespace ast {
|
---|
| 21 |
|
---|
| 22 | class TranslationUnit;
|
---|
| 23 |
|
---|
| 24 | /// Check anything that should always be true of the AST between passes.
|
---|
| 25 | /// Insert this whenever you want additional debugging checks.
|
---|
[d3d54b3] | 26 | void checkInvariants( TranslationUnit & );
|
---|
| 27 |
|
---|
| 28 | /// Maintains an AST-module state for contextual information needed in
|
---|
| 29 | /// ast::* implementations, notably constructors:
|
---|
| 30 | /// early: while parsing, use bootstrap versions
|
---|
| 31 | /// late: once a whole TranslationUnit exists, use its answers
|
---|
| 32 | /// When the program is in the later state, ast::* construcors effectively get
|
---|
| 33 | /// the benefit of WithTranslationUnit, without having to pass them one.
|
---|
| 34 | class TranslationDeps {
|
---|
| 35 |
|
---|
| 36 | TranslationDeps() = delete;
|
---|
| 37 |
|
---|
| 38 | friend class SizeofExpr;
|
---|
| 39 | friend class AlignofExpr;
|
---|
| 40 | friend class CountofExpr;
|
---|
| 41 | friend class OffsetofExpr;
|
---|
| 42 | friend class OffsetPackExpr;
|
---|
| 43 |
|
---|
| 44 | /// Appropriate return type for built-in expressions that report on sizes
|
---|
| 45 | static const Type * getSizeType();
|
---|
| 46 |
|
---|
| 47 | public:
|
---|
| 48 | /// Transition from early to late states
|
---|
| 49 | static void evolve( TranslationUnit & );
|
---|
| 50 | };
|
---|
[f69fac7] | 51 |
|
---|
| 52 | }
|
---|