diff -upr .pc/symdb_enhance_plugin/gcc/c-family/c-common.h
gcc/c-family/c-common.h
--- .pc/symdb_enhance_plugin/gcc/c-family/c-common.h2011-12-21
04:44:13.0 +0800
+++ gcc/c-family/c-common.h2012-05-25 14:56:56.776263281 +0800
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3.
#include "splay-tree.h"
#include "cpplib.h"
#include "ggc.h"
+#include "c-pragma.h"
/* In order for the format checking to accept the C frontend
diagnostic framework extensions, you must include this file before
@@ -1116,4 +1117,43 @@ struct GTY(()) tree_userdef_literal {
extern tree build_userdef_literal (tree suffix_id, tree value, tree
num_string);
+/* The following local token type is used. */
+
+/* A keyword. */
+#define CPP_KEYWORD ((enum cpp_ttype) (N_TTYPES + 1))
+
+/* More information about the type of a CPP_NAME token. */
+typedef enum c_id_kind {
+ /* An ordinary identifier. */
+ C_ID_ID,
+ /* An identifier declared as a typedef name. */
+ C_ID_TYPENAME,
+ /* An identifier declared as an Objective-C class name. */
+ C_ID_CLASSNAME,
+ /* An address space identifier. */
+ C_ID_ADDRSPACE,
+ /* Not an identifier. */
+ C_ID_NONE
+} c_id_kind;
+
+/* A single C token after string literal concatenation and conversion
+ of preprocessing tokens to tokens. */
+typedef struct GTY (()) c_token {
+ /* The kind of token. */
+ ENUM_BITFIELD (cpp_ttype) type : 8;
+ /* If this token is a CPP_NAME, this value indicates whether also
+ declared as some kind of type. Otherwise, it is C_ID_NONE. */
+ ENUM_BITFIELD (c_id_kind) id_kind : 8;
+ /* If this token is a keyword, this value indicates which keyword.
+ Otherwise, this value is RID_MAX. */
+ ENUM_BITFIELD (rid) keyword : 8;
+ /* If this token is a CPP_PRAGMA, this indicates the pragma that
+ was seen. Otherwise it is PRAGMA_NONE. */
+ ENUM_BITFIELD (pragma_kind) pragma_kind : 8;
+ /* The value associated with this token, if any. */
+ tree value;
+ /* The location at which this token was found. */
+ location_t location;
+} c_token;
+
#endif /* ! GCC_C_COMMON_H */
diff -upr .pc/symdb_enhance_plugin/gcc/c-family/c-lex.c gcc/c-family/c-lex.c
--- .pc/symdb_enhance_plugin/gcc/c-family/c-lex.c2011-10-27
03:31:16.0 +0800
+++ gcc/c-family/c-lex.c2012-05-25 14:56:56.767134882 +0800
@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3.
#include "splay-tree.h"
#include "debug.h"
#include "target.h"
+#include "plugin.h"
/* We may keep statistics about how long which files took to compile. */
static int header_time, body_time;
@@ -380,6 +381,7 @@ c_lex_with_flags (tree *value, location_
case CPP_STRING32:
case CPP_UTF8STRING:
type = lex_string (tok, value, true, true);
+ tok = NULL;
break;
case CPP_NAME:
@@ -481,6 +483,7 @@ c_lex_with_flags (tree *value, location_
{
type = lex_string (tok, value, false,
(lex_flags & C_LEX_STRING_NO_TRANSLATE) == 0);
+ tok = NULL;
break;
}
*value = build_string (tok->val.str.len, (const char *)
tok->val.str.text);
@@ -515,6 +518,7 @@ c_lex_with_flags (tree *value, location_
}
timevar_pop (TV_CPP);
+ invoke_plugin_callbacks (PLUGIN_CPP_TOKEN, (cpp_token*) tok);
return type;
}
diff -upr .pc/symdb_enhance_plugin/gcc/c-parser.c gcc/c-parser.c
--- .pc/symdb_enhance_plugin/gcc/c-parser.c2011-12-21
04:44:13.0 +0800
+++ gcc/c-parser.c2012-05-25 14:56:56.772261126 +0800
@@ -121,45 +121,6 @@ c_parse_init (void)
C++). It would then be possible to share more of the C and C++
lexer code, if desired. */
-/* The following local token type is used. */
-
-/* A keyword. */
-#define CPP_KEYWORD ((enum cpp_ttype) (N_TTYPES + 1))
-
-/* More information about the type of a CPP_NAME token. */
-typedef enum c_id_kind {
- /* An ordinary identifier. */
- C_ID_ID,
- /* An identifier declared as a typedef name. */
- C_ID_TYPENAME,
- /* An identifier declared as an Objective-C class name. */
- C_ID_CLASSNAME,
- /* An address space identifier. */
- C_ID_ADDRSPACE,
- /* Not an identifier. */
- C_ID_NONE
-} c_id_kind;
-
-/* A single C token after string literal concatenation and conversion
- of preprocessing tokens to tokens. */
-typedef struct GTY (()) c_token {
- /* The kind of token. */
- ENUM_BITFIELD (cpp_ttype) type : 8;
- /* If this token is a CPP_NAME, this value indicates whether also
- declared as some kind of type. Otherwise, it is C_ID_NONE. */
- ENUM_BITFIELD (c_id_kind) id_kind : 8;
- /* If this token is a keyword, this value indicates which keyword.
- Otherwise, this value is RID_MAX. */
- ENUM_BITFIELD (rid) keyword : 8;
- /* If this token is a CPP_PRAGMA, this indicates the pragma that
- was seen. Otherwise it is PRAGMA_NONE. */
- ENUM_BITFIELD (pragma_kind) pragma_kind : 8;
- /* The location at which this token was found. */
- location_t location;
- /* The value associated