Skip to content

Commit 09e6941

Browse files
jeanPeriermemfrob
authored andcommitted
[flang] Fix issues comming from clang-10 warnings
- Remove SubprogramDetails copy ctor - Prevent copies in range based loops over symbols - Remove unsued var Original-commit: flang-compiler/f18@16543d2 Reviewed-on: flang-compiler/f18#972
1 parent 7430e5c commit 09e6941

File tree

6 files changed

+5
-10
lines changed

6 files changed

+5
-10
lines changed

flang/include/flang/semantics/symbol.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ class MainProgramDetails {
5252

5353
class SubprogramDetails {
5454
public:
55-
SubprogramDetails() {}
56-
SubprogramDetails(const SubprogramDetails &that)
57-
: dummyArgs_{that.dummyArgs_}, result_{that.result_} {}
58-
5955
bool isFunction() const { return result_ != nullptr; }
6056
bool isInterface() const { return isInterface_; }
6157
void set_isInterface(bool value = true) { isInterface_ = value; }

flang/lib/semantics/mod-file.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -915,10 +915,10 @@ void SubprogramSymbolCollector::DoType(const DeclTypeSpec *type) {
915915
if (const DerivedTypeSpec * extends{typeSymbol.GetParentTypeSpec()}) {
916916
DoSymbol(extends->name(), extends->typeSymbol());
917917
}
918-
for (const auto pair : derived->parameters()) {
918+
for (const auto &pair : derived->parameters()) {
919919
DoParamValue(pair.second);
920920
}
921-
for (const auto pair : *typeSymbol.scope()) {
921+
for (const auto &pair : *typeSymbol.scope()) {
922922
const Symbol &comp{*pair.second};
923923
DoSymbol(comp);
924924
}

flang/lib/semantics/resolve-labels.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ void CheckBranchesIntoDoBody(const SourceStmtList &branches,
824824
if (HasScope(branchTarget.proxyForScope)) {
825825
const auto &fromPosition{branch.parserCharBlock};
826826
const auto &toPosition{branchTarget.parserCharBlock};
827-
for (const auto body : loopBodies) {
827+
for (const auto &body : loopBodies) {
828828
if (!InBody(fromPosition, body) && InBody(toPosition, body)) {
829829
context.Say(fromPosition, "branch into loop body from outside"_en_US)
830830
.Attach(body.first, "the loop branched into"_en_US);

flang/lib/semantics/resolve-names.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4099,7 +4099,7 @@ void DeclarationVisitor::SetSaveAttr(Symbol &symbol) {
40994099
// Check types of common block objects, now that they are known.
41004100
void DeclarationVisitor::CheckCommonBlocks() {
41014101
// check for empty common blocks
4102-
for (const auto pair : currScope().commonBlocks()) {
4102+
for (const auto &pair : currScope().commonBlocks()) {
41034103
const auto &symbol{*pair.second};
41044104
if (symbol.get<CommonBlockDetails>().objects().empty() &&
41054105
symbol.attrs().test(Attr::BIND_C)) {

flang/lib/semantics/semantics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ void Semantics::DumpSymbols(std::ostream &os) {
294294
void Semantics::DumpSymbolsSources(std::ostream &os) const {
295295
NameToSymbolMap symbols;
296296
GetSymbolNames(context_.globalScope(), symbols);
297-
for (const auto pair : symbols) {
297+
for (const auto &pair : symbols) {
298298
const Symbol &symbol{pair.second};
299299
if (auto sourceInfo{cooked_.GetSourcePositionRange(symbol.name())}) {
300300
os << symbol.name().ToString() << ": " << sourceInfo->first.file.path()

flang/runtime/buffer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ template<typename STORE> class FileFrame {
6666
} else {
6767
// [cde........ab] -> [abcde........]
6868
auto n{start_ + length_ - size_}; // 3 for cde
69-
auto gap{size_ - length_}; // 13 - 5 = 8
7069
RUNTIME_CHECK(handler, length_ >= n);
7170
std::memmove(buffer_ + n, buffer_ + start_, length_ - n); // cdeab
7271
LeftShiftBufferCircularly(buffer_, length_, n); // abcde

0 commit comments

Comments
 (0)