[LLVMbugs] [Bug 89] [C++] Catch blocks make unparsable labels
bugzilla-daemon at zion.cs.uiuc.edu
bugzilla-daemon at zion.cs.uiuc.edu
Tue Nov 4 21:51:45 PST 2003
http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=89
sabre at nondot.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
------- Additional Comments From sabre at nondot.org 2003-11-04 23:51 -------
Fixed like so:
$ diff -u llvm-representation.c~ llvm-representation.c
--- llvm-representation.c~ 2003-10-29 13:19:23.000000000 -0600
+++ llvm-representation.c 2003-11-04 23:46:44.000000000 -0600
@@ -720,8 +720,26 @@
llvm_basicblock *llvm_basicblock_new(const char *Name) {
llvm_basicblock *BB = (llvm_basicblock*)xcalloc(sizeof(llvm_basicblock), 1);
- llvm_value_construct(D2V(BB), LabelTy, Name, BasicBlock);
+ const char *NewName = xstrdup(Name), *R, *W;
+
+ /* We can't tolerate wierd characters in label names yet, so just strip them
+ * out mercilessly!
+ */
+ for (R = W = NewName; *R; ++R) {
+ char C = *R;
+ /* Only copy the char over if it is known good. */
+ if ((C >= 'a' && C <= 'z') ||
+ (C >= 'A' && C <= 'Z') ||
+ (C >= '0' && C <= '9') ||
+ C == '.' || C == '_') {
+ *W++ = C;
+ }
+ }
+ *W = *R; /* Copy the null terminator */
+
+ llvm_value_construct(D2V(BB), LabelTy, NewName, BasicBlock);
llvm_ilist_construct(llvm_instruction, BB->Instructions);
+ free(NewName);
return BB;
}
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the llvm-bugs
mailing list