Skip to content

Commit

Permalink
Changed .clang-format so that it will not add a comment after the clo…
Browse files Browse the repository at this point in the history
…sing brace of each namespace. Removed all such previous comments from all .cc and .h files
  • Loading branch information
jeanPerier committed Oct 25, 2018
1 parent 304c6f6 commit aa7f55e
Show file tree
Hide file tree
Showing 120 changed files with 152 additions and 238 deletions.
1 change: 1 addition & 0 deletions .clang-format
Expand Up @@ -12,6 +12,7 @@ AlignTrailingComments: false
ConstructorInitializerIndentWidth: 2
SpaceAfterTemplateKeyword: false
SpacesBeforeTrailingComments: 2
FixNamespaceComments: false
IncludeCategories:
- Regex: '^<'
Priority: 4
Expand Down
6 changes: 3 additions & 3 deletions include/flang/ISO_Fortran_binding.h
Expand Up @@ -99,7 +99,7 @@ typedef signed char CFI_type_t;
#define CFI_type_other (-1) // must be negative

/* Error code macros */
#define CFI_SUCCESS 0 /* must be zero */
#define CFI_SUCCESS 0 /* must be zero */
#define CFI_ERROR_BASE_ADDR_NULL 1
#define CFI_ERROR_BASE_ADDR_NOT_NULL 2
#define CFI_INVALID_ELEM_LEN 3
Expand Down Expand Up @@ -152,8 +152,8 @@ int CFI_setpointer(
#ifdef __cplusplus
} // extern "C"
} // inline namespace Fortran_2018
} // namespace ISO
} // namespace Fortran
}
}
#endif

#undef CFI_ISO_FORTRAN_BINDING_FLEXIBLE_ARRAY
Expand Down
2 changes: 1 addition & 1 deletion lib/common/bit-population-count.h
Expand Up @@ -85,5 +85,5 @@ template<typename UINT> inline constexpr bool Parity(UINT x) {
template<typename UINT> inline constexpr int TrailingZeroCount(UINT x) {
return BitPopulationCount(x ^ (x - 1)) - !!x;
}
} // namespace Fortran::common
}
#endif // FORTRAN_COMMON_BIT_POPULATION_COUNT_H_
2 changes: 1 addition & 1 deletion lib/common/constexpr-bitset.h
Expand Up @@ -149,5 +149,5 @@ template<int BITS> class BitSet {
private:
Word bits_{0};
};
} // namespace Fortran::common
}
#endif // FORTRAN_COMMON_CONSTEXPR_BITSET_H_
2 changes: 1 addition & 1 deletion lib/common/enum-set.h
Expand Up @@ -198,7 +198,7 @@ template<typename ENUM, std::size_t BITS> class EnumSet {
private:
bitsetType bitset_;
};
} // namespace Fortran::common
}

template<typename ENUM, std::size_t values>
struct std::hash<Fortran::common::EnumSet<ENUM, values>> {
Expand Down
3 changes: 1 addition & 2 deletions lib/common/fortran.h
Expand Up @@ -33,6 +33,5 @@ ENUM_CLASS(ImportKind, Default, Only, None, All)
ENUM_CLASS(TypeParamAttr, Kind, Len)

ENUM_CLASS(RelationalOperator, LT, LE, EQ, NE, GE, GT)

} // namespace Fortran::common
}
#endif // FORTRAN_COMMON_FORTRAN_H_
2 changes: 1 addition & 1 deletion lib/common/idioms.cc
Expand Up @@ -46,4 +46,4 @@ std::string EnumIndexToString(int index, const char *enumNames) {
}
return std::string(p, q - p);
}
} // namespace Fortran::common
}
5 changes: 2 additions & 3 deletions lib/common/idioms.h
Expand Up @@ -44,7 +44,7 @@ template<typename A>
struct is_trivially_copy_constructible<list<A>> : false_type {};
template<typename A>
struct is_trivially_copy_constructible<optional<list<A>>> : false_type {};
} // namespace std
}
#endif

// enable "this is a std::string"s with the 's' suffix
Expand Down Expand Up @@ -133,6 +133,5 @@ template<typename A> struct ListItemCount {
return Fortran::common::EnumIndexToString( \
static_cast<int>(e), #__VA_ARGS__); \
}

} // namespace Fortran::common
}
#endif // FORTRAN_COMMON_IDIOMS_H_
3 changes: 1 addition & 2 deletions lib/common/indirection.h
Expand Up @@ -152,6 +152,5 @@ template<typename A> class OwningPointer {
private:
A *p_{nullptr};
};

} // namespace Fortran::common
}
#endif // FORTRAN_COMMON_INDIRECTION_H_
3 changes: 1 addition & 2 deletions lib/common/interval.h
Expand Up @@ -107,6 +107,5 @@ template<typename A> class Interval {
A start_;
std::size_t size_{0};
};

} // namespace Fortran::common
}
#endif // FORTRAN_COMMON_INTERVAL_H_
3 changes: 1 addition & 2 deletions lib/common/reference-counted.h
Expand Up @@ -78,6 +78,5 @@ template<typename A> class CountedReference {

type *p_{nullptr};
};

} // namespace Fortran::common
}
#endif // FORTRAN_COMMON_REFERENCE_COUNTED_H_
3 changes: 1 addition & 2 deletions lib/common/template.h
Expand Up @@ -268,6 +268,5 @@ template<typename VISITOR>
typename VISITOR::Result SearchDynamicTypes(VISITOR &&visitor) {
return SearchDynamicTypesHelper<0, VISITOR>(std::move(visitor));
}

} // namespace Fortran::common
}
#endif // FORTRAN_COMMON_TEMPLATE_H_
3 changes: 1 addition & 2 deletions lib/evaluate/call.cc
Expand Up @@ -42,5 +42,4 @@ std::optional<int> ActualArgument::VectorSize() const {
}

FOR_EACH_SPECIFIC_TYPE(template struct FunctionRef)

} // namespace Fortran::evaluate
}
3 changes: 1 addition & 2 deletions lib/evaluate/call.h
Expand Up @@ -47,6 +47,5 @@ struct ActualArgument {
};

using Arguments = std::vector<ActualArgument>;

} // namespace Fortran::evaluate
}
#endif // FORTRAN_EVALUATE_CALL_H_
3 changes: 1 addition & 2 deletions lib/evaluate/common.cc
Expand Up @@ -33,5 +33,4 @@ void RealFlagWarnings(
context.messages.Say("underflow on %s"_en_US, operation);
}
}

} // namespace Fortran::evaluate
}
3 changes: 1 addition & 2 deletions lib/evaluate/common.h
Expand Up @@ -164,6 +164,5 @@ struct FoldingContext {
};

void RealFlagWarnings(FoldingContext &, const RealFlags &, const char *op);

} // namespace Fortran::evaluate
}
#endif // FORTRAN_EVALUATE_COMMON_H_
2 changes: 1 addition & 1 deletion lib/evaluate/complex.cc
Expand Up @@ -100,4 +100,4 @@ template class Complex<Real<Integer<32>, 24>>;
template class Complex<Real<Integer<64>, 53>>;
template class Complex<Real<Integer<80>, 64, false>>;
template class Complex<Real<Integer<128>, 112>>;
} // namespace Fortran::evaluate::value
}
3 changes: 1 addition & 2 deletions lib/evaluate/complex.h
Expand Up @@ -95,6 +95,5 @@ extern template class Complex<Real<Integer<32>, 24>>;
extern template class Complex<Real<Integer<64>, 53>>;
extern template class Complex<Real<Integer<80>, 64, false>>;
extern template class Complex<Real<Integer<128>, 112>>;

} // namespace Fortran::evaluate::value
}
#endif // FORTRAN_EVALUATE_COMPLEX_H_
5 changes: 2 additions & 3 deletions lib/evaluate/expression.cc
Expand Up @@ -588,8 +588,7 @@ FOR_EACH_CHARACTER_KIND(template struct Relational)
template struct Relational<SomeType>;
FOR_EACH_INTRINSIC_KIND(template struct ExpressionBase)
FOR_EACH_CATEGORY_TYPE(template struct ExpressionBase)

} // namespace Fortran::evaluate
}

// For reclamation of analyzed expressions to which owning pointers have
// been embedded in the parse tree. This destructor appears here, where
Expand All @@ -601,4 +600,4 @@ template<> OwningPointer<evaluate::GenericExprWrapper>::~OwningPointer() {
p_ = nullptr;
}
template class OwningPointer<evaluate::GenericExprWrapper>;
} // namespace Fortran::common
}
3 changes: 1 addition & 2 deletions lib/evaluate/expression.h
Expand Up @@ -711,6 +711,5 @@ template<> inline bool IsVariable(const Expr<SomeType> &expr) {

FOR_EACH_CATEGORY_TYPE(extern template class Expr)
FOR_EACH_TYPE_AND_KIND(extern template struct ExpressionBase)

} // namespace Fortran::evaluate
}
#endif // FORTRAN_EVALUATE_EXPRESSION_H_
3 changes: 1 addition & 2 deletions lib/evaluate/int-power.h
Expand Up @@ -55,6 +55,5 @@ ValueWithRealFlags<REAL> IntPower(
}
return result;
}

} // namespace Fortran::evaluate
}
#endif // FORTRAN_EVALUATE_INT_POWER_H_
3 changes: 1 addition & 2 deletions lib/evaluate/integer.cc
Expand Up @@ -34,5 +34,4 @@ static_assert(Integer<64>::partBits == 32);
static_assert(std::is_same_v<typename Integer<64>::Part, std::uint32_t>);
static_assert(Integer<128>::partBits == 32);
static_assert(std::is_same_v<typename Integer<128>::Part, std::uint32_t>);

} // namespace Fortran::evaluate::value
}
2 changes: 1 addition & 1 deletion lib/evaluate/integer.h
Expand Up @@ -1003,5 +1003,5 @@ extern template class Integer<32>;
extern template class Integer<64>;
extern template class Integer<80>;
extern template class Integer<128>;
} // namespace Fortran::evaluate::value
}
#endif // FORTRAN_EVALUATE_INTEGER_H_
3 changes: 1 addition & 2 deletions lib/evaluate/intrinsics.cc
Expand Up @@ -1275,5 +1275,4 @@ std::ostream &IntrinsicProcTable::Implementation::Dump(std::ostream &o) const {
std::ostream &IntrinsicProcTable::Dump(std::ostream &o) const {
return impl_->Dump(o);
}

} // namespace Fortran::evaluate
}
2 changes: 1 addition & 1 deletion lib/evaluate/intrinsics.h
Expand Up @@ -68,5 +68,5 @@ class IntrinsicProcTable {
private:
Implementation *impl_{nullptr}; // owning pointer
};
} // namespace Fortran::evaluate
}
#endif // FORTRAN_EVALUATE_INTRINSICS_H_
6 changes: 3 additions & 3 deletions lib/evaluate/leading-zero-bit-count.h
Expand Up @@ -46,7 +46,7 @@ static constexpr std::uint8_t mapping[64]{63, 0, 58, 1, 59, 47, 53, 2, 60, 39,
48, 27, 54, 33, 42, 3, 61, 51, 37, 40, 49, 18, 28, 20, 55, 30, 34, 11, 43,
14, 22, 4, 62, 57, 46, 52, 38, 26, 32, 41, 50, 36, 17, 19, 29, 10, 13, 21,
56, 45, 25, 31, 35, 16, 9, 12, 44, 24, 15, 8, 23, 7, 6, 5};
} // namespace
}

inline constexpr int LeadingZeroBitCount(std::uint64_t x) {
if (x == 0) {
Expand Down Expand Up @@ -89,10 +89,10 @@ static constexpr std::uint8_t eightBitLeadingZeroBitCount[256]{8, 7, 6, 6, 5, 5,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
} // namespace
}

inline constexpr int LeadingZeroBitCount(std::uint8_t x) {
return eightBitLeadingZeroBitCount[x];
}
} // namespace Fortran::evaluate
}
#endif // FORTRAN_EVALUATE_LEADING_ZERO_BIT_COUNT_H_
3 changes: 1 addition & 2 deletions lib/evaluate/logical.cc
Expand Up @@ -20,5 +20,4 @@ template class Logical<8>;
template class Logical<16>;
template class Logical<32>;
template class Logical<64>;

} // namespace Fortran::evaluate::value
}
2 changes: 1 addition & 1 deletion lib/evaluate/logical.h
Expand Up @@ -57,5 +57,5 @@ extern template class Logical<8>;
extern template class Logical<16>;
extern template class Logical<32>;
extern template class Logical<64>;
} // namespace Fortran::evaluate::value
}
#endif // FORTRAN_EVALUATE_LOGICAL_H_
2 changes: 1 addition & 1 deletion lib/evaluate/real.cc
Expand Up @@ -486,4 +486,4 @@ template class Real<Integer<32>, 24>;
template class Real<Integer<64>, 53>;
template class Real<Integer<80>, 64, false>;
template class Real<Integer<128>, 112>;
} // namespace Fortran::evaluate::value
}
3 changes: 1 addition & 2 deletions lib/evaluate/real.h
Expand Up @@ -339,6 +339,5 @@ extern template class Real<Integer<64>, 53>;
extern template class Real<Integer<80>, 64, false>; // 80387 extended precision
extern template class Real<Integer<128>, 112>;
// N.B. No "double-double" support.

} // namespace Fortran::evaluate::value
}
#endif // FORTRAN_EVALUATE_REAL_H_
2 changes: 1 addition & 1 deletion lib/evaluate/rounding-bits.h
Expand Up @@ -100,5 +100,5 @@ class RoundingBits {
bool round_{false}; // 0.25 * ulp
bool sticky_{false}; // true if any lesser-valued bit would be set
};
} // namespace Fortran::evaluate::value
}
#endif // FORTRAN_EVALUATE_ROUNDING_BITS_H_
3 changes: 1 addition & 2 deletions lib/evaluate/tools.cc
Expand Up @@ -492,5 +492,4 @@ Expr<SomeLogical> BinaryLogicalOperation(
},
AsSameKindExprs(std::move(x), std::move(y)));
}

} // namespace Fortran::evaluate
}
3 changes: 1 addition & 2 deletions lib/evaluate/tools.h
Expand Up @@ -447,6 +447,5 @@ struct TypeKindVisitor {
int kind;
VALUE value;
};

} // namespace Fortran::evaluate
}
#endif // FORTRAN_EVALUATE_TOOLS_H_
2 changes: 1 addition & 1 deletion lib/evaluate/type.cc
Expand Up @@ -91,4 +91,4 @@ DynamicType DynamicType::ResultTypeForMultiply(const DynamicType &that) const {
std::string SomeDerived::Dump() const {
return "TYPE("s + spec().name().ToString() + ')';
}
} // namespace Fortran::evaluate
}
5 changes: 2 additions & 3 deletions lib/evaluate/type.h
Expand Up @@ -38,7 +38,7 @@
namespace Fortran::semantics {
class DerivedTypeSpec;
class Symbol;
} // namespace Fortran::semantics
}

namespace Fortran::evaluate {

Expand Down Expand Up @@ -403,6 +403,5 @@ template<typename T> struct Constant {
std::ostream &Dump(std::ostream &) const;
Value value;
};

} // namespace Fortran::evaluate
}
#endif // FORTRAN_EVALUATE_TYPE_H_
3 changes: 1 addition & 2 deletions lib/evaluate/variable.cc
Expand Up @@ -502,5 +502,4 @@ std::optional<DynamicType> ProcedureDesignator::GetType() const {
}

FOR_EACH_CHARACTER_KIND(template class Designator)

} // namespace Fortran::evaluate
}
3 changes: 1 addition & 2 deletions lib/evaluate/variable.h
Expand Up @@ -380,6 +380,5 @@ class SubroutineCall {
ProcedureDesignator proc_;
Arguments arguments_;
};

} // namespace Fortran::evaluate
}
#endif // FORTRAN_EVALUATE_VARIABLE_H_
3 changes: 1 addition & 2 deletions lib/parser/basic-parsers.h
Expand Up @@ -1356,6 +1356,5 @@ template<typename PA> class SourcedParser {
template<typename PA> inline constexpr auto sourced(const PA &parser) {
return SourcedParser<PA>{parser};
}

} // namespace Fortran::parser
}
#endif // FORTRAN_PARSER_BASIC_PARSERS_H_
3 changes: 1 addition & 2 deletions lib/parser/char-block.h
Expand Up @@ -128,8 +128,7 @@ inline bool operator>=(const char *left, const CharBlock &right) {
inline bool operator>(const char *left, const CharBlock &right) {
return right < left;
}

} // namespace Fortran::parser
}

// Specializations to enable std::unordered_map<CharBlock, ...> &c.
template<> struct std::hash<Fortran::parser::CharBlock> {
Expand Down
3 changes: 1 addition & 2 deletions lib/parser/char-buffer.cc
Expand Up @@ -93,5 +93,4 @@ std::string CharBuffer::MarshalNormalized() const {
result.shrink_to_fit();
return result;
}

} // namespace Fortran::parser
}
3 changes: 1 addition & 2 deletions lib/parser/char-buffer.h
Expand Up @@ -79,6 +79,5 @@ class CharBuffer {
std::size_t bytes_{0};
bool lastBlockEmpty_{false};
};

} // namespace Fortran::parser
}
#endif // FORTRAN_PARSER_CHAR_BUFFER_H_
3 changes: 1 addition & 2 deletions lib/parser/char-set.cc
Expand Up @@ -27,5 +27,4 @@ std::string SetOfChars::ToString() const {
}
return result;
}

} // namespace Fortran::parser
}
3 changes: 1 addition & 2 deletions lib/parser/char-set.h
Expand Up @@ -82,6 +82,5 @@ struct SetOfChars {
constexpr SetOfChars(std::uint64_t b) : bits_{b} {}
std::uint64_t bits_{0};
};

} // namespace Fortran::parser
}
#endif // FORTRAN_PARSER_CHAR_SET_H_
2 changes: 1 addition & 1 deletion lib/parser/characters.cc
Expand Up @@ -92,4 +92,4 @@ std::string QuoteCharacterLiteral(
result += '"';
return result;
}
} // namespace Fortran::parser
}
3 changes: 1 addition & 2 deletions lib/parser/characters.h
Expand Up @@ -168,6 +168,5 @@ std::optional<int> UTF8CharacterBytes(const char *);
std::optional<int> EUC_JPCharacterBytes(const char *);
std::optional<std::size_t> CountCharacters(
const char *, std::size_t bytes, std::optional<int> (*)(const char *));

} // namespace Fortran::parser
}
#endif // FORTRAN_PARSER_CHARACTERS_H_
3 changes: 1 addition & 2 deletions lib/parser/debug-parser.cc
Expand Up @@ -31,5 +31,4 @@ std::optional<Success> DebugParser::Parse(ParseState &state) const {
}
return {Success{}};
}

} // namespace Fortran::parser
}

0 comments on commit aa7f55e

Please sign in to comment.