1 /*
2  * (C) Copyright 2003-2015 Diomidis Spinellis
3  *
4  * This file is part of CScout.
5  *
6  * CScout is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * CScout is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with CScout.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  *
20  * Function call graph information
21  *
22  */
23 
24 #ifndef FCALL_
25 #define FCALL_
26 
27 #include "call.h"
28 #include "type.h"
29 #include "tokid.h"
30 #include "token.h"
31 
32 /*
33  * Function call information is always associated with Id objects
34  * It is thus guaranteed to match the symbol table lookup operations
35  */
36 
37 // C function calling information
38 class FCall : public Call {
39 private:
40 	Tokid definition;		// Function's definition
41 	Type type;			// Function's type
42 	bool defined;			// True if the function has been defined
43 public:
44 	// Set the C function currently being parsed
45 	static void set_current_fun(const Type &t);
46 	static void set_current_fun(const Id *id);
47 
get_definition()48 	virtual Tokid get_definition() const { return definition; }
is_defined()49 	virtual bool is_defined() const { return defined; }
is_declared()50 	virtual bool is_declared() const { return true; }
is_file_scoped()51 	virtual bool is_file_scoped() const { return type.is_static(); }
is_cfun()52 	virtual bool is_cfun() const { return true; }
is_macro()53 	virtual bool is_macro() const { return false; }
entity_type_name()54 	virtual const string & entity_type_name() const {
55 		static string s("C function");
56 		return (s);
57 	}
58 	FCall(const Token& t, Type typ, const string &s);
59 
~FCall()60 	virtual ~FCall() {}
61 };
62 
63 #endif // FCALL_
64