[llvm-bugs] [Bug 50862] New: CommonOptionsParser doesn't reset completely

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 25 03:21:07 PDT 2021


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

            Bug ID: 50862
           Summary: CommonOptionsParser doesn't reset completely
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Tooling
          Assignee: unassignedclangbugs at nondot.org
          Reporter: lozanbt47 at gmail.com
                CC: llvm-bugs at lists.llvm.org

If we create CommonOptionsParser multiple times in the program by providing
argc, argv, etc., the internal state of the CommonOptionsParser won't be reset
properly and positional arguments will be left.

Having multiple CommonOptionsParsers in the same program is not a good idea
because of internal static objects. However, in our use case we need to
initialize CommonOptionsParser with generated argc and argv, do some processing
and then repeat the same process by providing another set of argc and argv.

The issue is with the static cl::opt<T>'s in CommonOptionsParser::init, which
are never reset.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210625/02ce31fc/attachment.html>


More information about the llvm-bugs mailing list