[cfe-commits] r42481 - /cfe/trunk/include/clang/Lex/IdentifierTable.h

Steve Naroff snaroff at apple.com
Mon Oct 1 09:59:00 PDT 2007


On Sep 30, 2007, at 1:32 AM, Chris Lattner wrote:

> Author: lattner
> Date: Sun Sep 30 03:32:27 2007
> New Revision: 42481
>
> URL: http://llvm.org/viewvc/llvm-project?rev=42481&view=rev
> Log:
> Add a new getLength() method to IdentifierInfo, which relies on a  
> newly added
> method to StringMapEntry.  Steve, please use this to remove the
> strlen calls in selector processing.
>

Absolutely. Thanks for adding this back...

snaroff

> Modified:
>     cfe/trunk/include/clang/Lex/IdentifierTable.h
>
> Modified: cfe/trunk/include/clang/Lex/IdentifierTable.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ 
> Lex/IdentifierTable.h?rev=42481&r1=42480&r2=42481&view=diff
>
> ====================================================================== 
> ========
> --- cfe/trunk/include/clang/Lex/IdentifierTable.h (original)
> +++ cfe/trunk/include/clang/Lex/IdentifierTable.h Sun Sep 30  
> 03:32:27 2007
> @@ -53,8 +53,17 @@
>    /// string is properly null terminated.
>    ///
>    const char *getName() const {
> -    // String data is stored immediately after the IdentifierInfo  
> object.
> -    return (const char*)(this+1);
> +    // We know that this is embedded into a StringMapEntry, and it  
> knows how to
> +    // efficiently find the string.
> +    return llvm::StringMapEntry<IdentifierInfo>::
> +                  GetStringMapEntryFromValue(*this).getKeyData();
> +  }
> +
> +  /// getLength - Efficiently return the length of this identifier  
> info.
> +  ///
> +  unsigned getLength() const {
> +    return llvm::StringMapEntry<IdentifierInfo>::
> +                    GetStringMapEntryFromValue(*this).getKeyLength();
>    }
>
>    /// getMacroInfo - Return macro information about this  
> identifier, or null if
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list