[cfe-commits] r162768 - in /cfe/trunk: include/clang/AST/Stmt.h lib/AST/Stmt.cpp
Chad Rosier
mcrosier at apple.com
Tue Aug 28 10:43:23 PDT 2012
Author: mcrosier
Date: Tue Aug 28 12:43:23 2012
New Revision: 162768
URL: http://llvm.org/viewvc/llvm-project?rev=162768&view=rev
Log:
[ms-inline asm] Make the AsmStmt class non-virtual.
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=162768&r1=162767&r2=162768&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Tue Aug 28 12:43:23 2012
@@ -1393,8 +1393,6 @@
explicit AsmStmt(StmtClass SC, EmptyShell Empty) :
Stmt(SC, Empty), Names(0), Exprs(0) { }
- virtual ~AsmStmt() { }
-
SourceLocation getAsmLoc() const { return AsmLoc; }
void setAsmLoc(SourceLocation L) { AsmLoc = L; }
@@ -1409,7 +1407,7 @@
//===--- Asm String Analysis ---===//
/// Assemble final IR asm string.
- virtual std::string generateAsmString(ASTContext &C) const = 0;
+ std::string generateAsmString(ASTContext &C) const;
//===--- Output operands ---===//
@@ -1429,7 +1427,7 @@
/// getOutputConstraint - Return the constraint string for the specified
/// output operand. All output constraints are known to be non-empty (either
/// '=' or '+').
- virtual StringRef getOutputConstraint(unsigned i) const = 0;
+ StringRef getOutputConstraint(unsigned i) const;
/// isOutputPlusConstraint - Return true if the specified output constraint
/// is a "+" constraint (which is both an input and an output) or false if it
@@ -1438,7 +1436,7 @@
return getOutputConstraint(i)[0] == '+';
}
- virtual const Expr *getOutputExpr(unsigned i) const = 0;
+ const Expr *getOutputExpr(unsigned i) const;
/// getNumPlusOperands - Return the number of output operands that have a "+"
/// constraint.
@@ -1461,14 +1459,14 @@
/// getInputConstraint - Return the specified input constraint. Unlike output
/// constraints, these can be empty.
- virtual StringRef getInputConstraint(unsigned i) const = 0;
-
- virtual const Expr *getInputExpr(unsigned i) const = 0;
+ StringRef getInputConstraint(unsigned i) const;
+
+ const Expr *getInputExpr(unsigned i) const;
//===--- Other ---===//
unsigned getNumClobbers() const { return NumClobbers; }
- virtual StringRef getClobber(unsigned i) const = 0;
+ StringRef getClobber(unsigned i) const;
static bool classof(const Stmt *T) {
return T->getStmtClass() == GCCAsmStmtClass ||
Modified: cfe/trunk/lib/AST/Stmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Stmt.cpp?rev=162768&r1=162767&r2=162768&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Stmt.cpp (original)
+++ cfe/trunk/lib/AST/Stmt.cpp Tue Aug 28 12:43:23 2012
@@ -321,6 +321,60 @@
}
}
+std::string AsmStmt::generateAsmString(ASTContext &C) const {
+ StmtClass stmtClass = getStmtClass();
+ if (stmtClass == Stmt::GCCAsmStmtClass)
+ return static_cast<const GCCAsmStmt*>(this)->generateAsmString(C);
+ if (stmtClass == Stmt::MSAsmStmtClass)
+ return static_cast<const MSAsmStmt*>(this)->generateAsmString(C);
+ llvm_unreachable("unknown asm statement kind!");
+}
+
+StringRef AsmStmt::getOutputConstraint(unsigned i) const {
+ StmtClass stmtClass = getStmtClass();
+ if (stmtClass == Stmt::GCCAsmStmtClass)
+ return static_cast<const GCCAsmStmt*>(this)->getOutputConstraint(i);
+ if (stmtClass == Stmt::MSAsmStmtClass)
+ return static_cast<const MSAsmStmt*>(this)->getOutputConstraint(i);
+ llvm_unreachable("unknown asm statement kind!");
+}
+
+const Expr *AsmStmt::getOutputExpr(unsigned i) const {
+ StmtClass stmtClass = getStmtClass();
+ if (stmtClass == Stmt::GCCAsmStmtClass)
+ return static_cast<const GCCAsmStmt*>(this)->getOutputExpr(i);
+ if (stmtClass == Stmt::MSAsmStmtClass)
+ return static_cast<const MSAsmStmt*>(this)->getOutputExpr(i);
+ llvm_unreachable("unknown asm statement kind!");
+}
+
+StringRef AsmStmt::getInputConstraint(unsigned i) const {
+ StmtClass stmtClass = getStmtClass();
+ if (stmtClass == Stmt::GCCAsmStmtClass)
+ return static_cast<const GCCAsmStmt*>(this)->getInputConstraint(i);
+ if (stmtClass == Stmt::MSAsmStmtClass)
+ return static_cast<const MSAsmStmt*>(this)->getInputConstraint(i);
+ llvm_unreachable("unknown asm statement kind!");
+}
+
+const Expr *AsmStmt::getInputExpr(unsigned i) const {
+ StmtClass stmtClass = getStmtClass();
+ if (stmtClass == Stmt::GCCAsmStmtClass)
+ return static_cast<const GCCAsmStmt*>(this)->getInputExpr(i);
+ if (stmtClass == Stmt::MSAsmStmtClass)
+ return static_cast<const MSAsmStmt*>(this)->getInputExpr(i);
+ llvm_unreachable("unknown asm statement kind!");
+}
+
+StringRef AsmStmt::getClobber(unsigned i) const {
+ StmtClass stmtClass = getStmtClass();
+ if (stmtClass == Stmt::GCCAsmStmtClass)
+ return static_cast<const GCCAsmStmt*>(this)->getClobber(i);
+ if (stmtClass == Stmt::MSAsmStmtClass)
+ return static_cast<const MSAsmStmt*>(this)->getClobber(i);
+ llvm_unreachable("unknown asm statement kind!");
+}
+
/// getNumPlusOperands - Return the number of output operands that have a "+"
/// constraint.
unsigned AsmStmt::getNumPlusOperands() const {
More information about the cfe-commits
mailing list