LCOV - code coverage report
Current view: top level - gcc/go/gofrontend - go-optimize.cc (source / functions) Hit Total Coverage
Test: gcc.info Lines: 4 14 28.6 %
Date: 2020-03-28 11:57:23 Functions: 1 3 33.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : // go-optimize.cc -- Go frontend optimizer flags.
       2                 :            : 
       3                 :            : // Copyright 2011 The Go Authors. All rights reserved.
       4                 :            : // Use of this source code is governed by a BSD-style
       5                 :            : // license that can be found in the LICENSE file.
       6                 :            : 
       7                 :            : #include "go-system.h"
       8                 :            : 
       9                 :            : #include "go-c.h"
      10                 :            : #include "go-optimize.h"
      11                 :            : 
      12                 :            : namespace {
      13                 :            : 
      14                 :            : // The list of optimizations.
      15                 :            : 
      16                 :            : Go_optimize* optimizations;
      17                 :            : 
      18                 :            : } // End empty namespace.
      19                 :            : 
      20                 :            : // Create a new optimization.
      21                 :            : 
      22                 :       3372 : Go_optimize::Go_optimize(const char* name, bool enabled)
      23                 :       3372 :   : next_(optimizations), name_(name), is_enabled_(enabled)
      24                 :            : {
      25                 :       3372 :   optimizations = this;
      26                 :       3372 : }
      27                 :            : 
      28                 :            : // Enable an optimization by name.
      29                 :            : 
      30                 :            : bool
      31                 :          0 : Go_optimize::enable_by_name(const char* name, bool value)
      32                 :            : {
      33                 :          0 :   bool is_all = strcmp(name, "all") == 0;
      34                 :          0 :   bool found = false;
      35                 :          0 :   for (Go_optimize* p = optimizations; p != NULL; p = p->next_)
      36                 :            :     {
      37                 :          0 :       if (is_all || strcmp(name, p->name_) == 0)
      38                 :            :         {
      39                 :          0 :           p->is_enabled_ = value;
      40                 :          0 :           found = true;
      41                 :            :         }
      42                 :            :     }
      43                 :          0 :   return found;
      44                 :            : }
      45                 :            : 
      46                 :            : // Enable/disable an optimization.  Return 1 if this is a real name, 0 if not.
      47                 :            : 
      48                 :            : GO_EXTERN_C
      49                 :            : int
      50                 :          0 : go_enable_optimize(const char* name, int value)
      51                 :            : {
      52                 :          0 :   return Go_optimize::enable_by_name(name, (bool)value) ? 1 : 0;
      53                 :            : }

Generated by: LCOV version 1.0

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto --enable-host-shared. GCC test suite is run with the built compiler.