[cfe-commits] r161703 - in /cfe/trunk: include/clang/AST/Stmt.h lib/AST/Stmt.cpp
Chad Rosier
mcrosier at apple.com
Fri Aug 10 14:36:25 PDT 2012
Author: mcrosier
Date: Fri Aug 10 16:36:25 2012
New Revision: 161703
URL: http://llvm.org/viewvc/llvm-project?rev=161703&view=rev
Log:
[ms-inline asm] Avoid extra allocations by making this an array of StringRefs.
Modified:
cfe/trunk/include/clang/AST/Stmt.h
cfe/trunk/lib/AST/Stmt.cpp
Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=161703&r1=161702&r2=161703&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Fri Aug 10 16:36:25 2012
@@ -1633,7 +1633,7 @@
Token *AsmToks;
unsigned *LineEnds;
Stmt **Exprs;
- StringRef **Clobbers;
+ StringRef *Clobbers;
public:
MSAsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple,
@@ -1665,7 +1665,7 @@
//===--- 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);
Modified: cfe/trunk/lib/AST/Stmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Stmt.cpp?rev=161703&r1=161702&r2=161703&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Stmt.cpp (original)
+++ cfe/trunk/lib/AST/Stmt.cpp Fri Aug 10 16:36:25 2012
@@ -600,13 +600,13 @@
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);
}
}
More information about the cfe-commits
mailing list