/* Cleanup function for the ctf_dict_key data.  */
 ctf_fp_info::~ctf_fp_info ()
 {
-  if (!fp)
+  if (fp == nullptr)
     return;
 
   ctf_archive_t *arc = ctf_get_arc (fp);
 
   htab = (htab_t) ctf_tid_key.get (of);
   if (htab == NULL)
-    return NULL;
+    return nullptr;
 
   ids.tid = tid;
-  ids.type = NULL;
+  ids.type = nullptr;
   slot = (struct ctf_tid_and_type *) htab_find (htab, &ids);
   if (slot)
     return slot->type;
   else
-    return NULL;
+    return nullptr;
 }
 
 /* Return the size of storage in bits for INTEGER, FLOAT, or ENUM.  */
 {
   struct bound_minimal_symbol msym;
 
-  msym = lookup_minimal_symbol (name, NULL, of);
+  msym = lookup_minimal_symbol (name, nullptr, of);
   if (msym.minsym != NULL)
     {
       SET_SYMBOL_VALUE_ADDRESS (sym, BMSYMBOL_VALUE_ADDRESS (msym));
   struct type *type;
 
   format = gdbarch_floatformat_for_type (gdbarch, name_hint, bits);
-  if (format != NULL)
+  if (format != nullptr)
     type = init_float_type (objfile, bits, name, format);
   else
     type = init_type (objfile, TYPE_CODE_ERROR, bits, name);
 
   kind = ctf_type_kind (ccp->fp, tid);
   t = get_tid_type (ccp->of, tid);
-  if (t == NULL)
+  if (t == nullptr)
     {
       t = read_type_record (ccp, tid);
-      if (t == NULL)
+      if (t == nullptr)
        {
          complaint (_("ctf_add_member_cb: %s has NO type (%ld)"), name, tid);
          t = objfile_type (ccp->of)->builtin_error;
 
   fp = &new_field.field;
   FIELD_NAME (*fp) = name;
-  fp->set_type (NULL);
+  fp->set_type (nullptr);
   SET_FIELD_ENUMVAL (*fp, enum_value);
   FIELD_BITSIZE (*fp) = 0;
 
-  if (name != NULL)
+  if (name != nullptr)
     {
       struct symbol *sym = new (&ccp->of->objfile_obstack) symbol;
       OBJSTAT (ccp->of, n_syms++);
 {
   struct objfile *objfile = ccp->of;
   ctf_dict_t *fp = ccp->fp;
-  struct symbol *sym = NULL;
+  struct symbol *sym = nullptr;
 
   gdb::unique_xmalloc_ptr<char> name (ctf_type_aname_raw (fp, tid));
-  if (name != NULL)
+  if (name != nullptr)
     {
       sym = new (&objfile->objfile_obstack) symbol;
       OBJSTAT (objfile, n_syms++);
       SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
       SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT;
 
-      if (type != NULL)
+      if (type != nullptr)
        SYMBOL_TYPE (sym) = type;
 
       uint32_t kind = ctf_type_kind (fp, tid);
   struct objfile *of = ccp->of;
   ctf_dict_t *fp = ccp->fp;
   ctf_encoding_t cet;
-  struct type *type = NULL;
+  struct type *type = nullptr;
   char *name;
   uint32_t kind;
 
     {
       complaint (_("ctf_type_encoding read_base_type failed - %s"),
                 ctf_errmsg (ctf_errno (fp)));
-      return NULL;
+      return nullptr;
     }
 
   gdb::unique_xmalloc_ptr<char> copied_name (ctf_type_aname_raw (fp, tid));
-  if (copied_name == NULL || strlen (copied_name.get ()) == 0)
+  if (copied_name == nullptr || strlen (copied_name.get ()) == 0)
     {
       name = ctf_type_aname (fp, tid);
-      if (name == NULL)
+      if (name == nullptr)
        complaint (_("ctf_type_aname read_base_type failed - %s"),
                   ctf_errmsg (ctf_errno (fp)));
     }
       type = init_type (of, TYPE_CODE_ERROR, cet.cte_bits, name);
     }
 
-  if (name != NULL && strcmp (name, "char") == 0)
+  if (name != nullptr && strcmp (name, "char") == 0)
     type->set_has_no_signedness (true);
 
   return set_tid_type (of, tid, type);
   type = alloc_type (of);
 
   gdb::unique_xmalloc_ptr<char> name (ctf_type_aname_raw (fp, tid));
-  if (name != NULL && strlen (name.get() ) != 0)
+  if (name != nullptr && strlen (name.get ()) != 0)
     type->set_name (obstack_strdup (&of->objfile_obstack, name.get ()));
 
   kind = ctf_type_kind (fp, tid);
 {
   struct objfile *of = ccp->of;
   ctf_dict_t *fp = ccp->fp;
-  struct type *type, *rettype;
+  struct type *type, *rettype, *atype;
   ctf_funcinfo_t cfi;
+  uint32_t argc;
 
   type = alloc_type (of);
 
   gdb::unique_xmalloc_ptr<char> name (ctf_type_aname_raw (fp, tid));
-  if (name != NULL && strlen (name.get ()) != 0)
+  if (name != nullptr && strlen (name.get ()) != 0)
     type->set_name (obstack_strdup (&of->objfile_obstack, name.get ()));
 
   type->set_code (TYPE_CODE_FUNC);
   TYPE_TARGET_TYPE (type) = rettype;
   set_type_align (type, ctf_type_align (fp, tid));
 
+  /* Set up function's arguments.  */
+  argc = cfi.ctc_argc;
+  type->set_num_fields (argc);
+  if ((cfi.ctc_flags & CTF_FUNC_VARARG) != 0)
+    type->set_has_varargs (true);
+
+  if (argc != 0)
+    {
+      std::vector<ctf_id_t> argv (argc);
+      if (ctf_func_type_args (fp, tid, argc, argv.data ()) == CTF_ERR)
+       return nullptr;
+
+      type->set_fields
+       ((struct field *) TYPE_ZALLOC (type, argc * sizeof (struct field)));
+      struct type *void_type = objfile_type (of)->builtin_void;
+      /* If failed to find the argument type, fill it with void_type.  */
+      for (int iparam = 0; iparam < argc; iparam++)
+       {
+         atype = get_tid_type (of, argv[iparam]);
+         if (atype != nullptr)
+           type->field (iparam).set_type (atype);
+         else
+           type->field (iparam).set_type (void_type);
+       }
+    }
+
   return set_tid_type (of, tid, type);
 }
 
   type = alloc_type (of);
 
   gdb::unique_xmalloc_ptr<char> name (ctf_type_aname_raw (fp, tid));
-  if (name != NULL && strlen (name.get ()) != 0)
+  if (name != nullptr && strlen (name.get ()) != 0)
     type->set_name (obstack_strdup (&of->objfile_obstack, name.get ()));
 
   type->set_code (TYPE_CODE_ENUM);
   el_type = TYPE_TARGET_TYPE (inner_array);
   cnst |= TYPE_CONST (el_type);
   voltl |= TYPE_VOLATILE (el_type);
-  TYPE_TARGET_TYPE (inner_array) = make_cv_type (cnst, voltl, el_type, NULL);
+  TYPE_TARGET_TYPE (inner_array) = make_cv_type (cnst, voltl, el_type, nullptr);
 
   return set_tid_type (ccp->of, tid, base_type);
 }
     {
       complaint (_("ctf_array_info read_array_type failed - %s"),
                 ctf_errmsg (ctf_errno (fp)));
-      return NULL;
+      return nullptr;
     }
 
   element_type = get_tid_type (objfile, ar.ctr_contents);
-  if (element_type == NULL)
-    return NULL;
+  if (element_type == nullptr)
+    return nullptr;
 
   idx_type = get_tid_type (objfile, ar.ctr_index);
-  if (idx_type == NULL)
+  if (idx_type == nullptr)
     idx_type = objfile_type (objfile)->builtin_int;
 
   range_type = create_static_range_type (NULL, idx_type, 0, ar.ctr_nelems - 1);
   struct type *base_type, *cv_type;
 
   base_type = get_tid_type (objfile, btid);
-  if (base_type == NULL)
+  if (base_type == nullptr)
     {
       base_type = read_type_record (ccp, btid);
-      if (base_type == NULL)
+      if (base_type == nullptr)
        {
          complaint (_("read_const_type: NULL base type (%ld)"), btid);
          base_type = objfile_type (objfile)->builtin_error;
   struct type *base_type, *cv_type;
 
   base_type = get_tid_type (objfile, btid);
-  if (base_type == NULL)
+  if (base_type == nullptr)
     {
       base_type = read_type_record (ccp, btid);
-      if (base_type == NULL)
+      if (base_type == nullptr)
        {
          complaint (_("read_volatile_type: NULL base type (%ld)"), btid);
          base_type = objfile_type (objfile)->builtin_error;
   struct type *base_type, *cv_type;
 
   base_type = get_tid_type (objfile, btid);
-  if (base_type == NULL)
+  if (base_type == nullptr)
     {
       base_type = read_type_record (ccp, btid);
-      if (base_type == NULL)
+      if (base_type == nullptr)
        {
          complaint (_("read_restrict_type: NULL base type (%ld)"), btid);
          base_type = objfile_type (objfile)->builtin_error;
   if (target_type != this_type)
     TYPE_TARGET_TYPE (this_type) = target_type;
   else
-    TYPE_TARGET_TYPE (this_type) = NULL;
+    TYPE_TARGET_TYPE (this_type) = nullptr;
 
   this_type->set_target_is_stub (TYPE_TARGET_TYPE (this_type) != nullptr);
 
   struct type *target_type, *type;
 
   target_type = get_tid_type (of, btid);
-  if (target_type == NULL)
+  if (target_type == nullptr)
     {
       target_type = read_type_record (ccp, btid);
-      if (target_type == NULL)
+      if (target_type == nullptr)
        {
          complaint (_("read_pointer_type: NULL target type (%ld)"), btid);
          target_type = objfile_type (ccp->of)->builtin_error;
 {
   ctf_dict_t *fp = ccp->fp;
   uint32_t kind;
-  struct type *type = NULL;
+  struct type *type = nullptr;
   ctf_id_t btid;
 
   kind = ctf_type_kind (fp, tid);
 
   /* Check if tid's type has already been defined.  */
   type = get_tid_type (ccp->of, tid);
-  if (type != NULL)
+  if (type != nullptr)
     return 0;
 
   ctf_id_t btid = ctf_type_reference (ccp->fp, tid);
 ctf_add_var_cb (const char *name, ctf_id_t id, void *arg)
 {
   struct ctf_context *ccp = (struct ctf_context *) arg;
-  struct symbol *sym = NULL;
+  struct symbol *sym = nullptr;
   struct type *type;
   uint32_t kind;
 
   switch (kind)
     {
       case CTF_K_FUNCTION:
-       if (name && !strcmp(name, "main"))
+       if (name != nullptr && strcmp (name, "main") == 0)
          set_objfile_main_name (ccp->of, name, language_c);
        break;
       case CTF_K_INTEGER:
       case CTF_K_STRUCT:
       case CTF_K_UNION:
       case CTF_K_ENUM:
-       if (type == NULL)
+       if (type == nullptr)
        {
          complaint (_("ctf_add_var_cb: %s has NO type (%ld)"), name, id);
          type = objfile_type (ccp->of)->builtin_error;
        break;
     }
 
-  if (sym)
+  if (sym != nullptr)
     set_symbol_address (ccp->of, sym, name);
 
   return 0;
   ctf_id_t tid;
 
   if ((tid = ctf_lookup_by_symbol (ccp->fp, idx)) == CTF_ERR)
-    return NULL;
+    return nullptr;
 
   type = get_tid_type (ccp->of, tid);
-  if (type == NULL)
-    return NULL;
+  if (type == nullptr)
+    return nullptr;
 
   sym = new_symbol (ccp, type, tid);
 
   struct type *void_type = objfile_type (ccp->of)->builtin_void;
 
   if (ctf_func_info (ccp->fp, idx, &finfo) == CTF_ERR)
-    return NULL;
+    return nullptr;
 
   argc = finfo.ctc_argc;
   if (ctf_func_args (ccp->fp, idx, argc, argv) == CTF_ERR)
-    return NULL;
+    return nullptr;
 
   gdb::unique_xmalloc_ptr<char> name (ctf_type_aname_raw (ccp->fp, idx));
-  if (name == NULL)
-    return NULL;
+  if (name == nullptr)
+    return nullptr;
 
   tid = ctf_lookup_by_symbol (ccp->fp, idx);
   ftype = get_tid_type (ccp->of, tid);
-  if (finfo.ctc_flags & CTF_FUNC_VARARG)
+  if ((finfo.ctc_flags & CTF_FUNC_VARARG) != 0)
     ftype->set_has_varargs (true);
   ftype->set_num_fields (argc);
 
 
   sym = new_symbol (ccp, ftype, tid);
   rettyp = get_tid_type (ccp->of, finfo.ctc_return);
-  if (rettyp != NULL)
+  if (rettyp != nullptr)
     SYMBOL_TYPE (sym) = rettyp;
   else
     SYMBOL_TYPE (sym) = void_type;
 
   ccp = pst->context;
   ccp->builder = new buildsym_compunit
-                      (of, of->original_name, NULL,
+                      (of, of->original_name, nullptr,
                       language_c, text_offset);
   ccp->builder->record_debugformat ("ctf");
 }
   struct compunit_symtab *result
     = ccp->builder->end_symtab (end_addr, section);
   delete ccp->builder;
-  ccp->builder = NULL;
+  ccp->builder = nullptr;
   return result;
 }
 
   for (unsigned long i = 0; ; i++)
     {
       sym = add_stt_obj (ccp, i);
-      if (sym == NULL)
+      if (sym == nullptr)
        {
          if (ctf_errno (ccp->fp) == EINVAL
              || ctf_errno (ccp->fp) == ECTF_NOSYMTAB)
            break;
          sym = add_stt_func (ccp, i);
        }
-      if (sym == NULL)
+      if (sym == nullptr)
        continue;
 
       set_symbol_address (ccp->of, sym, sym->linkage_name ());
 
   ccp = (struct ctf_context *) arg;
   gdb::unique_xmalloc_ptr<char> name (ctf_type_aname_raw (ccp->fp, tid));
-  if (name == NULL || strlen (name.get ()) == 0)
+  if (name == nullptr || strlen (name.get ()) == 0)
     return 0;
 
   domain_enum domain = UNDEF_DOMAIN;
   int err;
 
   ctf_archive_t *arc = ctf_bfdopen (abfd, &err);
-  if (arc == NULL)
+  if (arc == nullptr)
     error (_("ctf_bfdopen failed on %s - %s"),
           bfd_get_filename (abfd), ctf_errmsg (err));
 
   ctf_dict_t *fp = ctf_dict_open (arc, NULL, &err);
-  if (fp == NULL)
+  if (fp == nullptr)
     error (_("ctf_dict_open failed on %s - %s"),
           bfd_get_filename (abfd), ctf_errmsg (err));
   ctf_dict_key.emplace (of, fp);