aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-08-10 21:36:25 +0000
committerChad Rosier <mcrosier@apple.com>2012-08-10 21:36:25 +0000
commit33c72e1c0bbb477cf36dd7becd933b860c42ed8c (patch)
tree7e4ab9ddd9e61c473bf923b89ce65600eac9d3e7
parent60e25804d14a52c173548f0f6c66d3d831cb901c (diff)
[ms-inline asm] Avoid extra allocations by making this an array of StringRefs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161703 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/Stmt.h4
-rw-r--r--lib/AST/Stmt.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h
index cb2eabbaed..79e1920159 100644
--- a/include/clang/AST/Stmt.h
+++ b/include/clang/AST/Stmt.h
@@ -1633,7 +1633,7 @@ class MSAsmStmt : public Stmt {
Token *AsmToks;
unsigned *LineEnds;
Stmt **Exprs;
- StringRef **Clobbers;
+ StringRef *Clobbers;
public:
MSAsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple,
@@ -1665,7 +1665,7 @@ public:
//===--- Other ---===//
unsigned getNumClobbers() const { return NumClobbers; }
- StringRef *getClobber(unsigned i) { return Clobbers[i]; }
+ StringRef getClobber(unsigned i) { return Clobbers[i]; }
SourceRange getSourceRange() const LLVM_READONLY {
return SourceRange(AsmLoc, EndLoc);
diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp
index c9cca556f4..d877c3fab7 100644
--- a/lib/AST/Stmt.cpp
+++ b/lib/AST/Stmt.cpp
@@ -600,13 +600,13 @@ MSAsmStmt::MSAsmStmt(ASTContext &C, SourceLocation asmloc,
for (unsigned i = 0, e = NumLineEnds; i != e; ++i)
LineEnds[i] = lineends[i];
- Clobbers = new (C) StringRef*[NumClobbers];
+ Clobbers = new (C) StringRef[NumClobbers];
for (unsigned i = 0, e = NumClobbers; i != e; ++i) {
// FIXME: Avoid the allocation/copy if at all possible.
size_t size = clobbers[i].size();
char *dest = new (C) char[size];
std::strncpy(dest, clobbers[i].data(), size);
- Clobbers[i] = new (C) StringRef(dest, size);
+ Clobbers[i] = StringRef(dest, size);
}
}