summaryrefslogtreecommitdiffstats
path: root/clang/lib/ARCMigrate/TransProperties.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-28 02:04:36 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-28 02:04:36 +0000
commiteca1f36a54dd9dcc5d44d324b79fab599edb3d18 (patch)
tree568031b60092c4aa5f5990b070553ce0d947f0b8 /clang/lib/ARCMigrate/TransProperties.cpp
parenta0d652e71ba9905d754f6037490f231aa4151935 (diff)
downloadbcm5719-llvm-eca1f36a54dd9dcc5d44d324b79fab599edb3d18.tar.gz
bcm5719-llvm-eca1f36a54dd9dcc5d44d324b79fab599edb3d18.zip
[arcmt] Integrate GC __weak into property attributes even when we don't have
the implementation. llvm-svn: 145224
Diffstat (limited to 'clang/lib/ARCMigrate/TransProperties.cpp')
-rw-r--r--clang/lib/ARCMigrate/TransProperties.cpp48
1 files changed, 2 insertions, 46 deletions
diff --git a/clang/lib/ARCMigrate/TransProperties.cpp b/clang/lib/ARCMigrate/TransProperties.cpp
index 8136b31d812..f8bc8a3c5fe 100644
--- a/clang/lib/ARCMigrate/TransProperties.cpp
+++ b/clang/lib/ARCMigrate/TransProperties.cpp
@@ -277,7 +277,7 @@ private:
}
bool removeAttribute(StringRef fromAttr, SourceLocation atLoc) const {
- return rewriteAttribute(fromAttr, StringRef(), atLoc);
+ return MigrateCtx.removePropertyAttribute(fromAttr, atLoc);
}
bool rewriteAttribute(StringRef fromAttr, StringRef toAttr,
@@ -286,51 +286,7 @@ private:
}
bool addAttribute(StringRef attr, SourceLocation atLoc) const {
- if (atLoc.isMacroID())
- return false;
-
- SourceManager &SM = Pass.Ctx.getSourceManager();
-
- // Break down the source location.
- std::pair<FileID, unsigned> locInfo = SM.getDecomposedLoc(atLoc);
-
- // Try to load the file buffer.
- bool invalidTemp = false;
- StringRef file = SM.getBufferData(locInfo.first, &invalidTemp);
- if (invalidTemp)
- return false;
-
- const char *tokenBegin = file.data() + locInfo.second;
-
- // Lex from the start of the given location.
- Lexer lexer(SM.getLocForStartOfFile(locInfo.first),
- Pass.Ctx.getLangOptions(),
- file.begin(), tokenBegin, file.end());
- Token tok;
- lexer.LexFromRawLexer(tok);
- if (tok.isNot(tok::at)) return false;
- lexer.LexFromRawLexer(tok);
- if (tok.isNot(tok::raw_identifier)) return false;
- if (StringRef(tok.getRawIdentifierData(), tok.getLength())
- != "property")
- return false;
- lexer.LexFromRawLexer(tok);
-
- if (tok.isNot(tok::l_paren)) {
- Pass.TA.insert(tok.getLocation(), std::string("(") + attr.str() + ") ");
- return true;
- }
-
- lexer.LexFromRawLexer(tok);
- if (tok.is(tok::r_paren)) {
- Pass.TA.insert(tok.getLocation(), attr);
- return true;
- }
-
- if (tok.isNot(tok::raw_identifier)) return false;
-
- Pass.TA.insert(tok.getLocation(), std::string(attr) + ", ");
- return true;
+ return MigrateCtx.addPropertyAttribute(attr, atLoc);
}
class PlusOneAssign : public RecursiveASTVisitor<PlusOneAssign> {
OpenPOWER on IntegriCloud