ADT
ast-experimental
pthread-emulation
Last change
on this file since 747d0fa was 7b71402, checked in by Andrew Beach <ajbeach@…>, 3 years ago |
Some white-space and comment fixes.
|
-
Property mode
set to
100644
|
File size:
1011 bytes
|
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 | // Inspect.cpp -- Helpers to get information from the AST.
|
---|
8 | //
|
---|
9 | // Author : Thierry Delisle
|
---|
10 | // Created On : Fri Jun 24 13:16:31 2022
|
---|
11 | // Last Modified By : Andrew Beach
|
---|
12 | // Last Modified On : Mon Jun 27 15:35:00 2022
|
---|
13 | // Update Count : 1
|
---|
14 | //
|
---|
15 |
|
---|
16 | #include "AST/Decl.hpp"
|
---|
17 | #include "AST/Type.hpp"
|
---|
18 |
|
---|
19 | #include <iostream>
|
---|
20 | #include <AST/Print.hpp>
|
---|
21 |
|
---|
22 | namespace ast {
|
---|
23 |
|
---|
24 | bool structHasFlexibleArray( const ast::StructDecl * decl ) {
|
---|
25 | if(decl->members.size() == 0) return false;
|
---|
26 | const auto & last = *decl->members.rbegin();
|
---|
27 | auto lastd = last.as<ast::DeclWithType>();
|
---|
28 | // I don't know what this is possible, but it might be.
|
---|
29 | if(!lastd) return false;
|
---|
30 | auto atype = dynamic_cast<const ast::ArrayType *>(lastd->get_type());
|
---|
31 | if(!atype) return false;
|
---|
32 | return !atype->isVarLen && !atype->dimension;
|
---|
33 | }
|
---|
34 |
|
---|
35 | } // namespace ast
|
---|
Note:
See
TracBrowser
for help on using the repository browser.