- Remove SubprogramDetails copy ctor
- Prevent copies in range based loops over symbols
- Remove unsued var
Original-commit: flang-compiler/f18@
16543d22f74e9421ecb4078818f4c1970bac0a5d
Reviewed-on: https://github.com/flang-compiler/f18/pull/972
class SubprogramDetails {
public:
- SubprogramDetails() {}
- SubprogramDetails(const SubprogramDetails &that)
- : dummyArgs_{that.dummyArgs_}, result_{that.result_} {}
-
bool isFunction() const { return result_ != nullptr; }
bool isInterface() const { return isInterface_; }
void set_isInterface(bool value = true) { isInterface_ = value; }
if (const DerivedTypeSpec * extends{typeSymbol.GetParentTypeSpec()}) {
DoSymbol(extends->name(), extends->typeSymbol());
}
- for (const auto pair : derived->parameters()) {
+ for (const auto &pair : derived->parameters()) {
DoParamValue(pair.second);
}
- for (const auto pair : *typeSymbol.scope()) {
+ for (const auto &pair : *typeSymbol.scope()) {
const Symbol &comp{*pair.second};
DoSymbol(comp);
}
if (HasScope(branchTarget.proxyForScope)) {
const auto &fromPosition{branch.parserCharBlock};
const auto &toPosition{branchTarget.parserCharBlock};
- for (const auto body : loopBodies) {
+ for (const auto &body : loopBodies) {
if (!InBody(fromPosition, body) && InBody(toPosition, body)) {
context.Say(fromPosition, "branch into loop body from outside"_en_US)
.Attach(body.first, "the loop branched into"_en_US);
// Check types of common block objects, now that they are known.
void DeclarationVisitor::CheckCommonBlocks() {
// check for empty common blocks
- for (const auto pair : currScope().commonBlocks()) {
+ for (const auto &pair : currScope().commonBlocks()) {
const auto &symbol{*pair.second};
if (symbol.get<CommonBlockDetails>().objects().empty() &&
symbol.attrs().test(Attr::BIND_C)) {
void Semantics::DumpSymbolsSources(std::ostream &os) const {
NameToSymbolMap symbols;
GetSymbolNames(context_.globalScope(), symbols);
- for (const auto pair : symbols) {
+ for (const auto &pair : symbols) {
const Symbol &symbol{pair.second};
if (auto sourceInfo{cooked_.GetSourcePositionRange(symbol.name())}) {
os << symbol.name().ToString() << ": " << sourceInfo->first.file.path()
} else {
// [cde........ab] -> [abcde........]
auto n{start_ + length_ - size_}; // 3 for cde
- auto gap{size_ - length_}; // 13 - 5 = 8
RUNTIME_CHECK(handler, length_ >= n);
std::memmove(buffer_ + n, buffer_ + start_, length_ - n); // cdeab
LeftShiftBufferCircularly(buffer_, length_, n); // abcde