[cfe-commits] r125718 - /cfe/trunk/lib/Sema/SemaCodeComplete.cpp
Douglas Gregor
dgregor at apple.com
Wed Feb 16 19:19:26 PST 2011
Author: dgregor
Date: Wed Feb 16 21:19:26 2011
New Revision: 125718
URL: http://llvm.org/viewvc/llvm-project?rev=125718&view=rev
Log:
I will not hold on to temporary StringRefs.
I will not hold on to temporary StringRefs.
I will not hold on to temporary StringRefs.
I will not hold on to temporary StringRefs.
I will not hold on to temporary StringRefs.
I will not hold on to temporary StringRefs.
I will not hold on to temporary StringRefs.
I will not hold on to temporary StringRefs.
I will not hold on to temporary StringRefs.
I will not hold on to temporary StringRefs.
I will not hold on to temporary StringRefs.
Modified:
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=125718&r1=125717&r2=125718&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Wed Feb 16 21:19:26 2011
@@ -5521,8 +5521,8 @@
(ReturnType.isNull() &&
(Property->getType()->isIntegerType() ||
Property->getType()->isBooleanType())))) {
- llvm::Twine SelectorName = llvm::Twine("is") + UpperKey;
- IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName.str());
+ std::string SelectorName = (llvm::Twine("is") + UpperKey).str();
+ IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName);
if (!KnownMethods.count(Selectors.getNullarySelector(SelectorId))) {
if (ReturnType.isNull()) {
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
@@ -5540,8 +5540,8 @@
// Add the normal mutator.
if (IsInstanceMethod && ReturnTypeMatchesVoid &&
!Property->getSetterMethodDecl()) {
- llvm::Twine SelectorName = llvm::Twine("set") + UpperKey;
- IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName.str());
+ std::string SelectorName = (llvm::Twine("set") + UpperKey).str();
+ IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName);
if (!KnownMethods.count(Selectors.getUnarySelector(SelectorId))) {
if (ReturnType.isNull()) {
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
@@ -5591,8 +5591,8 @@
// Add -(NSUInteger)countOf<key>
if (IsInstanceMethod &&
(ReturnType.isNull() || ReturnType->isIntegerType())) {
- llvm::Twine SelectorName = llvm::Twine("countOf") + UpperKey;
- IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName.str());
+ std::string SelectorName = (llvm::Twine("countOf") + UpperKey).str();
+ IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName);
if (!KnownMethods.count(Selectors.getNullarySelector(SelectorId))) {
if (ReturnType.isNull()) {
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
@@ -5613,9 +5613,9 @@
// Add -(id)objectInKeyAtIndex:(NSUInteger)index
if (IsInstanceMethod &&
(ReturnType.isNull() || ReturnType->isObjCObjectPointerType())) {
- llvm::Twine SelectorName
- = llvm::Twine("objectIn") + UpperKey + "AtIndex";
- IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName.str());
+ std::string SelectorName
+ = (llvm::Twine("objectIn") + UpperKey + "AtIndex").str();
+ IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName);
if (!KnownMethods.count(Selectors.getUnarySelector(SelectorId))) {
if (ReturnType.isNull()) {
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
@@ -5640,9 +5640,9 @@
ReturnType->getAs<ObjCObjectPointerType>()->getInterfaceDecl() &&
ReturnType->getAs<ObjCObjectPointerType>()->getInterfaceDecl()
->getName() == "NSArray"))) {
- llvm::Twine SelectorName
- = llvm::Twine(Property->getName()) + "AtIndexes";
- IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName.str());
+ std::string SelectorName
+ = (llvm::Twine(Property->getName()) + "AtIndexes").str();
+ IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName);
if (!KnownMethods.count(Selectors.getUnarySelector(SelectorId))) {
if (ReturnType.isNull()) {
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
@@ -5662,9 +5662,9 @@
// Add -(void)getKey:(type **)buffer range:(NSRange)inRange
if (IsInstanceMethod && ReturnTypeMatchesVoid) {
- llvm::Twine SelectorName = llvm::Twine("get") + UpperKey;
+ std::string SelectorName = (llvm::Twine("get") + UpperKey).str();
IdentifierInfo *SelectorIds[2] = {
- &Context.Idents.get(SelectorName.str()),
+ &Context.Idents.get(SelectorName),
&Context.Idents.get("range")
};
@@ -5696,10 +5696,10 @@
// - (void)insertObject:(type *)object inKeyAtIndex:(NSUInteger)index
if (IsInstanceMethod && ReturnTypeMatchesVoid) {
- llvm::Twine SelectorName = llvm::Twine("in") + UpperKey + "AtIndex";
+ std::string SelectorName = (llvm::Twine("in") + UpperKey + "AtIndex").str();
IdentifierInfo *SelectorIds[2] = {
&Context.Idents.get("insertObject"),
- &Context.Idents.get(SelectorName.str())
+ &Context.Idents.get(SelectorName)
};
if (!KnownMethods.count(Selectors.getSelector(2, SelectorIds))) {
@@ -5728,9 +5728,9 @@
// - (void)insertKey:(NSArray *)array atIndexes:(NSIndexSet *)indexes
if (IsInstanceMethod && ReturnTypeMatchesVoid) {
- llvm::Twine SelectorName = llvm::Twine("insert") + UpperKey;
+ std::string SelectorName = (llvm::Twine("insert") + UpperKey).str();
IdentifierInfo *SelectorIds[2] = {
- &Context.Idents.get(SelectorName.str()),
+ &Context.Idents.get(SelectorName),
&Context.Idents.get("atIndexes")
};
@@ -5759,9 +5759,9 @@
// -(void)removeObjectFromKeyAtIndex:(NSUInteger)index
if (IsInstanceMethod && ReturnTypeMatchesVoid) {
- llvm::Twine SelectorName
- = llvm::Twine("removeObjectFrom") + UpperKey + "AtIndex";
- IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName.str());
+ std::string SelectorName
+ = (llvm::Twine("removeObjectFrom") + UpperKey + "AtIndex").str();
+ IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName);
if (!KnownMethods.count(Selectors.getUnarySelector(SelectorId))) {
if (ReturnType.isNull()) {
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
@@ -5781,9 +5781,9 @@
// -(void)removeKeyAtIndexes:(NSIndexSet *)indexes
if (IsInstanceMethod && ReturnTypeMatchesVoid) {
- llvm::Twine SelectorName
- = llvm::Twine("remove") + UpperKey + "AtIndexes";
- IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName.str());
+ std::string SelectorName
+ = (llvm::Twine("remove") + UpperKey + "AtIndexes").str();
+ IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName);
if (!KnownMethods.count(Selectors.getUnarySelector(SelectorId))) {
if (ReturnType.isNull()) {
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
@@ -5803,10 +5803,10 @@
// - (void)replaceObjectInKeyAtIndex:(NSUInteger)index withObject:(id)object
if (IsInstanceMethod && ReturnTypeMatchesVoid) {
- llvm::Twine SelectorName
- = llvm::Twine("replaceObjectIn") + UpperKey + "AtIndex";
+ std::string SelectorName
+ = (llvm::Twine("replaceObjectIn") + UpperKey + "AtIndex").str();
IdentifierInfo *SelectorIds[2] = {
- &Context.Idents.get(SelectorName.str()),
+ &Context.Idents.get(SelectorName),
&Context.Idents.get("withObject")
};
@@ -5835,11 +5835,12 @@
// - (void)replaceKeyAtIndexes:(NSIndexSet *)indexes withKey:(NSArray *)array
if (IsInstanceMethod && ReturnTypeMatchesVoid) {
- llvm::Twine SelectorName1 = llvm::Twine("replace") + UpperKey + "AtIndexes";
- llvm::Twine SelectorName2 = llvm::Twine("with") + UpperKey;
+ std::string SelectorName1
+ = (llvm::Twine("replace") + UpperKey + "AtIndexes").str();
+ std::string SelectorName2 = (llvm::Twine("with") + UpperKey).str();
IdentifierInfo *SelectorIds[2] = {
- &Context.Idents.get(SelectorName1.str()),
- &Context.Idents.get(SelectorName2.str())
+ &Context.Idents.get(SelectorName1),
+ &Context.Idents.get(SelectorName2)
};
if (!KnownMethods.count(Selectors.getSelector(2, SelectorIds))) {
@@ -5873,8 +5874,8 @@
ReturnType->getAs<ObjCObjectPointerType>()->getInterfaceDecl() &&
ReturnType->getAs<ObjCObjectPointerType>()->getInterfaceDecl()
->getName() == "NSEnumerator"))) {
- llvm::Twine SelectorName = llvm::Twine("enumeratorOf") + UpperKey;
- IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName.str());
+ std::string SelectorName = (llvm::Twine("enumeratorOf") + UpperKey).str();
+ IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName);
if (!KnownMethods.count(Selectors.getNullarySelector(SelectorId))) {
if (ReturnType.isNull()) {
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
@@ -5891,8 +5892,8 @@
// - (type *)memberOfKey:(type *)object
if (IsInstanceMethod &&
(ReturnType.isNull() || ReturnType->isObjCObjectPointerType())) {
- llvm::Twine SelectorName = llvm::Twine("memberOf") + UpperKey;
- IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName.str());
+ std::string SelectorName = (llvm::Twine("memberOf") + UpperKey).str();
+ IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName);
if (!KnownMethods.count(Selectors.getUnarySelector(SelectorId))) {
if (ReturnType.isNull()) {
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
@@ -5920,9 +5921,9 @@
// Mutable unordered accessors
// - (void)addKeyObject:(type *)object
if (IsInstanceMethod && ReturnTypeMatchesVoid) {
- llvm::Twine SelectorName
- = llvm::Twine("add") + UpperKey + llvm::Twine("Object");
- IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName.str());
+ std::string SelectorName
+ = (llvm::Twine("add") + UpperKey + llvm::Twine("Object")).str();
+ IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName);
if (!KnownMethods.count(Selectors.getUnarySelector(SelectorId))) {
if (ReturnType.isNull()) {
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
@@ -5943,8 +5944,8 @@
// - (void)addKey:(NSSet *)objects
if (IsInstanceMethod && ReturnTypeMatchesVoid) {
- llvm::Twine SelectorName = llvm::Twine("add") + UpperKey;
- IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName.str());
+ std::string SelectorName = (llvm::Twine("add") + UpperKey).str();
+ IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName);
if (!KnownMethods.count(Selectors.getUnarySelector(SelectorId))) {
if (ReturnType.isNull()) {
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
@@ -5964,9 +5965,9 @@
// - (void)removeKeyObject:(type *)object
if (IsInstanceMethod && ReturnTypeMatchesVoid) {
- llvm::Twine SelectorName
- = llvm::Twine("remove") + UpperKey + llvm::Twine("Object");
- IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName.str());
+ std::string SelectorName
+ = (llvm::Twine("remove") + UpperKey + llvm::Twine("Object")).str();
+ IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName);
if (!KnownMethods.count(Selectors.getUnarySelector(SelectorId))) {
if (ReturnType.isNull()) {
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
@@ -5987,8 +5988,8 @@
// - (void)removeKey:(NSSet *)objects
if (IsInstanceMethod && ReturnTypeMatchesVoid) {
- llvm::Twine SelectorName = llvm::Twine("remove") + UpperKey;
- IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName.str());
+ std::string SelectorName = (llvm::Twine("remove") + UpperKey).str();
+ IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName);
if (!KnownMethods.count(Selectors.getUnarySelector(SelectorId))) {
if (ReturnType.isNull()) {
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
@@ -6008,8 +6009,8 @@
// - (void)intersectKey:(NSSet *)objects
if (IsInstanceMethod && ReturnTypeMatchesVoid) {
- llvm::Twine SelectorName = llvm::Twine("intersect") + UpperKey;
- IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName.str());
+ std::string SelectorName = (llvm::Twine("intersect") + UpperKey).str();
+ IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName);
if (!KnownMethods.count(Selectors.getUnarySelector(SelectorId))) {
if (ReturnType.isNull()) {
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
@@ -6035,9 +6036,9 @@
ReturnType->getAs<ObjCObjectPointerType>()->getInterfaceDecl() &&
ReturnType->getAs<ObjCObjectPointerType>()->getInterfaceDecl()
->getName() == "NSSet"))) {
- llvm::Twine SelectorName
- = llvm::Twine("keyPathsForValuesAffecting") + UpperKey;
- IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName.str());
+ std::string SelectorName
+ = (llvm::Twine("keyPathsForValuesAffecting") + UpperKey).str();
+ IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName);
if (!KnownMethods.count(Selectors.getNullarySelector(SelectorId))) {
if (ReturnType.isNull()) {
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
More information about the cfe-commits
mailing list