https://bugs.llvm.org/show_bug.cgi?id=32720

            Bug ID: 32720
           Summary: -Wconsumed emits a false warning on a state change
                    following a loop
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kreme...@apple.com
          Reporter: mail+l...@tzik.jp
                CC: llvm-bugs@lists.llvm.org

Here is a repro case. The consumed annotation analysis is affected by an
unrelated simple loop.

$ clang++ --version
clang version 5.0.0
$ cat >foo.cc <<EOF
struct __attribute__((consumable(unconsumed))) Foo {
  void consume() __attribute__((set_typestate(consumed))) {}
};

void bar(Foo foo) {
  for (int i = 0; i < 1; ++i) {}
  foo.consume();
}
EOF
$ clang++ -Wconsumed -c foo.cc
foo.cc:7:26: warning: state of variable 'foo' must match at the entry and exit
of loop [-Wconsumed]

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to