llvm/flang/lib/semantics/attr.h
Tim Keith 6c772ac40b [flang] Improve include file sorting.
Includes like "../dir/file.h" should sort after local includes.
This change fixes that and applies the new formatting.

Now the order (in reverse) is:
- system includes
- includes from llvm or clang (this is from the default IncludeCategories)
- includes of ../something
- everything else

Original-commit: flang-compiler/f18@324643d63a
Reviewed-on: https://github.com/flang-compiler/f18/pull/52
2018-04-12 12:23:20 -07:00

43 lines
1.2 KiB
C++

#ifndef FORTRAN_ATTR_H_
#define FORTRAN_ATTR_H_
#include "enum-set.h"
#include "../parser/idioms.h"
#include <cinttypes>
#include <iostream>
#include <string>
namespace Fortran {
namespace semantics {
// All available attributes.
ENUM_CLASS(Attr, ABSTRACT, ALLOCATABLE, ASYNCHRONOUS, BIND_C, CONTIGUOUS,
DEFERRED, ELEMENTAL, EXTERNAL, IMPURE, INTENT_IN, INTENT_OUT, INTRINSIC,
MODULE, NON_OVERRIDABLE, NON_RECURSIVE, NOPASS, OPTIONAL, PARAMETER, PASS,
POINTER, PRIVATE, PROTECTED, PUBLIC, PURE, RECURSIVE, SAVE, TARGET, VALUE,
VOLATILE)
// Set of attributes
class Attrs : public EnumSet<Attr, Attr_enumSize> {
private:
using enumSetType = EnumSet<Attr, Attr_enumSize>;
public:
using enumSetType::enumSetType;
constexpr bool HasAny(const Attrs &x) const {
return !(*this & x).none();
}
constexpr bool HasAll(const Attrs &x) const {
return (~*this & x).none();
}
// Internal error if any of these attributes are not in allowed.
void CheckValid(const Attrs &allowed) const;
private:
friend std::ostream &operator<<(std::ostream &, const Attrs &);
};
std::ostream &operator<<(std::ostream &o, Attr attr);
std::ostream &operator<<(std::ostream &o, const Attrs &attrs);
} // namespace semantics
} // namespace Fortran
#endif