aboutsummaryrefslogtreecommitdiff
path: root/include/clang/AST/Stmt.h
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-08-27 18:56:36 +0000
committerChad Rosier <mcrosier@apple.com>2012-08-27 18:56:36 +0000
commit728581e7702cafe32cc9e1b5b61a15f5042ce189 (patch)
tree4073793bb380155abba6870229e2e81d1177c59a /include/clang/AST/Stmt.h
parent95a58d2f6ef9149dd50d679a7ee70d0685c38d27 (diff)
downloadclang-728581e7702cafe32cc9e1b5b61a15f5042ce189.tar.gz
[ms-inline asm] Add a new base class, AsmStmt, for the GCCAsmStmt and MSAsmStmt
classes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162691 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/AST/Stmt.h')
-rw-r--r--include/clang/AST/Stmt.h54
1 files changed, 34 insertions, 20 deletions
diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h
index fa068bb8ff..dd26732ef9 100644
--- a/include/clang/AST/Stmt.h
+++ b/include/clang/AST/Stmt.h
@@ -1363,15 +1363,42 @@ public:
}
};
+/// AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
+///
+class AsmStmt : public Stmt {
+protected:
+ bool IsSimple;
+ bool IsVolatile;
+
+ AsmStmt(StmtClass SC, bool issimple, bool isvolatile) :
+ Stmt (SC), IsSimple(issimple), IsVolatile(isvolatile) { }
+
+public:
+ /// \brief Build an empty inline-assembly statement.
+ explicit AsmStmt(StmtClass SC, EmptyShell Empty) :
+ Stmt(SC, Empty) { }
+
+ bool isSimple() const { return IsSimple; }
+ void setSimple(bool V) { IsSimple = V; }
+
+ bool isVolatile() const { return IsVolatile; }
+ void setVolatile(bool V) { IsVolatile = V; }
+
+ SourceRange getSourceRange() const LLVM_READONLY { return SourceRange(); }
+
+ static bool classof(const Stmt *T) {
+ return T->getStmtClass() == GCCAsmStmtClass ||
+ T->getStmtClass() == MSAsmStmtClass;
+ }
+ static bool classof(const AsmStmt *) { return true; }
+};
+
/// This represents a GCC inline-assembly statement extension.
///
-class GCCAsmStmt : public Stmt {
+class GCCAsmStmt : public AsmStmt {
SourceLocation AsmLoc, RParenLoc;
StringLiteral *AsmStr;
- bool IsSimple;
- bool IsVolatile;
-
unsigned NumOutputs;
unsigned NumInputs;
unsigned NumClobbers;
@@ -1390,7 +1417,7 @@ public:
StringLiteral **clobbers, SourceLocation rparenloc);
/// \brief Build an empty inline-assembly statement.
- explicit GCCAsmStmt(EmptyShell Empty) : Stmt(GCCAsmStmtClass, Empty),
+ explicit GCCAsmStmt(EmptyShell Empty) : AsmStmt(GCCAsmStmtClass, Empty),
Names(0), Constraints(0), Exprs(0), Clobbers(0) { }
SourceLocation getAsmLoc() const { return AsmLoc; }
@@ -1398,11 +1425,6 @@ public:
SourceLocation getRParenLoc() const { return RParenLoc; }
void setRParenLoc(SourceLocation L) { RParenLoc = L; }
- bool isVolatile() const { return IsVolatile; }
- void setVolatile(bool V) { IsVolatile = V; }
- bool isSimple() const { return IsSimple; }
- void setSimple(bool V) { IsSimple = V; }
-
//===--- Asm String Analysis ---===//
const StringLiteral *getAsmString() const { return AsmStr; }
@@ -1614,13 +1636,10 @@ public:
/// This represents a Microsoft inline-assembly statement extension.
///
-class MSAsmStmt : public Stmt {
+class MSAsmStmt : public AsmStmt {
SourceLocation AsmLoc, LBraceLoc, EndLoc;
std::string AsmStr;
- bool IsSimple;
- bool IsVolatile;
-
unsigned NumAsmToks;
unsigned NumInputs;
unsigned NumOutputs;
@@ -1640,7 +1659,7 @@ public:
SourceLocation endloc);
/// \brief Build an empty MS-style inline-assembly statement.
- explicit MSAsmStmt(EmptyShell Empty) : Stmt(MSAsmStmtClass, Empty),
+ explicit MSAsmStmt(EmptyShell Empty) : AsmStmt(MSAsmStmtClass, Empty),
NumAsmToks(0), NumInputs(0), NumOutputs(0), NumClobbers(0), AsmToks(0),
Names(0), Exprs(0), Clobbers(0) { }
@@ -1656,11 +1675,6 @@ public:
unsigned getNumAsmToks() { return NumAsmToks; }
Token *getAsmToks() { return AsmToks; }
- bool isVolatile() const { return IsVolatile; }
- void setVolatile(bool V) { IsVolatile = V; }
- bool isSimple() const { return IsSimple; }
- void setSimple(bool V) { IsSimple = V; }
-
//===--- Asm String Analysis ---===//
const std::string *getAsmString() const { return &AsmStr; }