gdb: remove COMPUNIT_LOCATIONS_VALID macro, add getter/setter

Add a getter and a setter for a compunit_symtab's locations valid flag.
Remove the corresponding macro and adjust all callers.

Change-Id: I3e3cfba926ce62993d5b61814331bb3244afad01
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 0d78c24..a14ac22 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -9493,7 +9493,7 @@ process_full_comp_unit (dwarf2_cu *cu, enum language pretend_language)
 	 options - this waits on GCC PR other/32998 (-frecord-gcc-switches).
 	 */
       if (cu->has_loclist && gcc_4_minor >= 5)
-	cust->locations_valid = 1;
+	cust->set_locations_valid (true);
 
       if (gcc_4_minor >= 5)
 	cust->epilogue_unwind_valid = 1;
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 70a9f10..5ad5cdb 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3709,7 +3709,7 @@ find_function_start_sal_1 (CORE_ADDR func_addr, obj_section *section,
   symtab_and_line sal = find_pc_sect_line (func_addr, section, 0);
 
   if (funfirstline && sal.symtab != NULL
-      && (COMPUNIT_LOCATIONS_VALID (SYMTAB_COMPUNIT (sal.symtab))
+      && (SYMTAB_COMPUNIT (sal.symtab)->locations_valid ()
 	  || SYMTAB_LANGUAGE (sal.symtab) == language_asm))
     {
       struct gdbarch *gdbarch = SYMTAB_OBJFILE (sal.symtab)->arch ();
@@ -3885,7 +3885,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
      have proven the CU (Compilation Unit) supports it.  sal->SYMTAB does not
      have to be set by the caller so we use SYM instead.  */
   if (sym != NULL
-      && COMPUNIT_LOCATIONS_VALID (SYMTAB_COMPUNIT (symbol_symtab (sym))))
+      && SYMTAB_COMPUNIT (symbol_symtab (sym))->locations_valid ())
     force_skip = 0;
 
   saved_pc = pc;
diff --git a/gdb/symtab.h b/gdb/symtab.h
index c59e3c3..a612e1a 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1531,6 +1531,16 @@ struct compunit_symtab
     m_block_line_section = block_line_section;
   }
 
+  bool locations_valid () const
+  {
+    return m_locations_valid;
+  }
+
+  void set_locations_valid (bool locations_valid)
+  {
+    m_locations_valid = locations_valid;
+  }
+
   /* Make PRIMARY_FILETAB the primary filetab of this compunit symtab.
 
      PRIMARY_FILETAB must already be a filetab of this compunit symtab.  */
@@ -1593,7 +1603,7 @@ struct compunit_symtab
   /* Symtab has been compiled with both optimizations and debug info so that
      GDB may stop skipping prologues as variables locations are valid already
      at function entry points.  */
-  unsigned int locations_valid : 1;
+  unsigned int m_locations_valid : 1;
 
   /* DWARF unwinder for this CU is valid even for epilogues (PC at the return
      instruction).  This is supported by GCC since 4.5.0.  */
@@ -1626,7 +1636,6 @@ struct compunit_symtab
 
 using compunit_symtab_range = next_range<compunit_symtab>;
 
-#define COMPUNIT_LOCATIONS_VALID(cust) ((cust)->locations_valid)
 #define COMPUNIT_EPILOGUE_UNWIND_VALID(cust) ((cust)->epilogue_unwind_valid)
 #define COMPUNIT_MACRO_TABLE(cust) ((cust)->macro_table)