On Aug 25, 2012, at 1:23 PM, Dmitri Gribenko <[email protected]> wrote:

> On Fri, Aug 24, 2012 at 6:33 PM, Jordan Rose <[email protected]> wrote:
>> On Aug 22, 2012, at 15:56 , Dmitri Gribenko <[email protected]> wrote:
>>> +bool isHTMLTagName(StringRef Name) {
>>> +  return llvm::StringSwitch<bool>(Name)
>>> +      .Cases("em", "strong", true)
>>> +      .Cases("tt", "i", "b", "big", "small", true)
>>> +      .Cases("strike", "s", "u", "font", true)
>>> +      .Case("a", true)
>>> +      .Case("hr", true)
>>> +      .Cases("div", "span", true)
>>> +      .Cases("h1", "h2", "h3", true)
>>> +      .Cases("h4", "h5", "h6", true)
>>> +      .Case("code", true)
>>> +      .Case("blockquote", true)
>>> +      .Cases("sub", "sup", true)
>>> +      .Case("img", true)
>>> +      .Case("p", true)
>>> +      .Case("br", true)
>>> +      .Case("pre", true)
>>> +      .Cases("ins", "del", true)
>>> +      .Cases("ul", "ol", "li", true)
>>> +      .Cases("dl", "dt", "dd", true)
>>> +      .Cases("table", "caption", true)
>>> +      .Cases("thead", "tfoot", "tbody", true)
>>> +      .Cases("colgroup", "col", true)
>>> +      .Cases("tr", "th", "td", true)
>>> +      .Default(false);
>>> +}
>> 
>> This is going to be very slow (StringSwitch just chains the string 
>> comparisons). Maybe we should use a StringMap instead?
> 
> It is a good idea, but it would require some refactoring since
> StringMap should be populated at runtime and we want to do that only
> once.

tblgen can build fast matchers for a fixed set of strings. 

> Dmitri
> 
> -- 
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <[email protected]>*/
> _______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to