This file is indexed.

/usr/include/Synopsis/SymbolLookup/Scopes.hh is in libsynopsis0.12-dev 0.12-10.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
//
// Copyright (C) 2004 Stefan Seefeld
// All rights reserved.
// Licensed to the public under the terms of the GNU LGPL (>= 2),
// see the file COPYING for details.
//
#ifndef Synopsis_SymbolLookup_Scopes_hh_
#define Synopsis_SymbolLookup_Scopes_hh_

#include <Synopsis/SymbolLookup/Scope.hh>
#include <string>
#include <vector>
#include <list>

namespace Synopsis
{
namespace SymbolLookup
{

class TemplateParameterScope;
class LocalScope;
class PrototypeScope;
class FunctionScope;
class Class;
class Namespace;

//. A Visitor for Scopes.
//. The default implementation does nothing, so
//. users only need to implement the ones they need.
class ScopeVisitor
{
public:
  virtual ~ScopeVisitor() {}

  virtual void visit(TemplateParameterScope *) {}
  virtual void visit(LocalScope *) {}
  virtual void visit(PrototypeScope *) {}
  virtual void visit(FunctionScope *) {}
  virtual void visit(Class *) {}
  virtual void visit(Namespace *) {}
};

class TemplateParameterScope : public Scope
{
public:
  TemplateParameterScope(PTree::List const *node, Scope const *outer)
    : my_node(node), my_outer(outer->ref()) {}

  virtual SymbolSet
  unqualified_lookup(PTree::Encoding const &, LookupContext) const;

  virtual Scope const *outer_scope() const { return my_outer;}
  virtual void accept(ScopeVisitor *v) { v->visit(this);}

protected:
  ~TemplateParameterScope() { my_outer->unref();}

private:
  PTree::List const *my_node;
  Scope       const *my_outer;
};

class LocalScope : public Scope
{
public:
  LocalScope(PTree::List const *node, Scope const *outer)
    : my_node(node), my_outer(outer->ref()) {}

  virtual Scope const *outer_scope() const { return my_outer;}

  virtual SymbolSet 
  unqualified_lookup(PTree::Encoding const &, LookupContext) const;

  virtual void accept(ScopeVisitor *v) { v->visit(this);}

protected:
  ~LocalScope() { my_outer->unref();}

private:
  PTree::List const *my_node;
  Scope       const *my_outer;
};

class FunctionScope : public Scope
{
public:
  FunctionScope(PTree::Declaration const *, PrototypeScope *, Scope const *);

  virtual void use(PTree::UsingDirective const *);
  virtual Scope const *outer_scope() const { return my_outer;}
  virtual SymbolSet 
  unqualified_lookup(PTree::Encoding const &, LookupContext) const;
  virtual SymbolSet 
  qualified_lookup(PTree::Encoding const &, LookupContext) const;

  // FIXME: what is 'name' ? (template parameters...)
  std::string name() const;

  virtual void accept(ScopeVisitor *v) { v->visit(this);}

protected:
  ~FunctionScope() { my_outer->unref();}

private:
  typedef std::set<Namespace const *> Using;

  PTree::Declaration const *    my_decl;
  Scope const *                 my_outer;
  Class const *                 my_class;
  TemplateParameterScope const *my_parameters;
  Using                         my_using;
};

class PrototypeScope : public Scope
{
  friend class FunctionScope;
public:
  PrototypeScope(PTree::Node const *decl, Scope const *outer,
		 TemplateParameterScope const *params)
    : my_decl(decl), my_outer(outer->ref()), my_parameters(params) {}

  virtual Scope const *outer_scope() const { return my_outer;}
  virtual SymbolSet 
  unqualified_lookup(PTree::Encoding const &, LookupContext) const;

  PTree::Node const *declaration() const { return my_decl;}
  TemplateParameterScope const *parameters() const { return my_parameters;}

  std::string name() const;

  virtual void accept(ScopeVisitor *v) { v->visit(this);}

protected:
  ~PrototypeScope() { my_outer->unref();}

private:
  PTree::Node const *           my_decl;
  Scope const *                 my_outer;
  TemplateParameterScope const *my_parameters;
};

class Class : public Scope
{
public:
  typedef std::vector<Class const *> Bases;

  Class(PTree::ClassSpec const *spec, Scope const *outer,
	Bases const &bases, TemplateParameterScope const *params)
    : my_spec(spec), my_outer(outer->ref()), my_bases(bases), my_parameters(params)
  {
  }

  virtual Scope const *outer_scope() const { return my_outer;}
  virtual SymbolSet 
  unqualified_lookup(PTree::Encoding const &, LookupContext) const;

  // FIXME: what is 'name' ? (template parameters...)
  std::string name() const;

  virtual void accept(ScopeVisitor *v) { v->visit(this);}

protected:
  ~Class() { my_outer->unref();}

private:
  PTree::ClassSpec       const *my_spec;
  Scope                  const *my_outer;
  Bases                         my_bases;
  TemplateParameterScope const *my_parameters;
};

class Namespace : public Scope
{
public:
  Namespace(PTree::NamespaceSpec const *spec, Namespace const *outer)
    : my_spec(spec),
      my_outer(outer ? static_cast<Namespace const *>(outer->ref()) : 0)
  {
  }
  //. Find a nested namespace.
  Namespace *find_namespace(PTree::NamespaceSpec const *name) const;

  virtual void use(PTree::UsingDirective const *);
  virtual Scope const *outer_scope() const { return my_outer;}
  virtual SymbolSet 
  unqualified_lookup(PTree::Encoding const &, LookupContext) const;
  virtual SymbolSet 
  qualified_lookup(PTree::Encoding const &, LookupContext) const;

  // FIXME: should that really be a string ? It may be better to be conform with
  // Class::name, which, if the class is a template, can't be a string (or can it ?)
  std::string name() const;

  virtual void accept(ScopeVisitor *v) { v->visit(this);}

protected:
  ~Namespace() { if (my_outer) my_outer->unref();}

private:
  typedef std::set<Namespace const *> Using;

  SymbolSet 
  unqualified_lookup(PTree::Encoding const &, LookupContext, Using &) const;
  SymbolSet 
  qualified_lookup(PTree::Encoding const &, LookupContext, Using &) const;

  PTree::NamespaceSpec const *my_spec;
  Namespace const *           my_outer;
  Using                       my_using;
};

}
}

#endif