summaryrefslogtreecommitdiff
path: root/gcc/stringpool.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2001-03-02 00:40:00 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2001-03-02 00:40:00 +0000
commite2df8b814aafe37e171cc5138766b2b5f7a16dfe (patch)
treeb9429823f84096cf8932b11e6e31c6dd708dab5d /gcc/stringpool.c
parentd76c69d6ff32d648543145cc819184dddb27b439 (diff)
downloadgcc-e2df8b814aafe37e171cc5138766b2b5f7a16dfe.tar.gz
* stringpool.c (set_identifier): New function.
* tree.h: Prototype it. * c-parse.in: Kill D_YES. If compiled for objc, call save_and_forget_protocol_qualifiers from init_reswords. * objc/objc-act.c (remember_protocol_qualifiers, forget_protocol_qualifiers): Don't diddle C_IS_RESERVED_WORD. Swap out the non-keyword IDENTIFIER_NODEs for keyword ones, or vice versa. (save_and_forget_protocol_qualifiers): New function. * c-lex.h: Prototype save_and_forget_protocol_qualifiers. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40170 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stringpool.c')
-rw-r--r--gcc/stringpool.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/stringpool.c b/gcc/stringpool.c
index ceb454d9221..f5e8968105a 100644
--- a/gcc/stringpool.c
+++ b/gcc/stringpool.c
@@ -340,6 +340,25 @@ maybe_get_identifier (text)
return NULL_TREE;
}
+/* Look up an identifier with the name TEXT, replace its identifier
+ node with NODE, and return the old identifier node. This is used
+ by languages which need to enable and disable keywords based on
+ context; e.g. see remember_protocol_qualifiers in objc/objc-act.c. */
+tree
+set_identifier (text, node)
+ const char *text;
+ tree node;
+{
+ struct str_header *str;
+ tree old;
+ size_t length = strlen (text);
+
+ str = alloc_string (text, length, INSERT);
+ old = str->data; /* might be null */
+ str->data = node;
+ return old;
+}
+
/* Report some basic statistics about the string pool. */
void