[cfe-commits] r162696 - in /cfe/trunk: include/clang/AST/Stmt.h lib/AST/Stmt.cpp lib/CodeGen/CGStmt.cpp

Chad Rosier mcrosier at apple.com
Mon Aug 27 13:23:32 PDT 2012


Author: mcrosier
Date: Mon Aug 27 15:23:31 2012
New Revision: 162696

URL: http://llvm.org/viewvc/llvm-project?rev=162696&view=rev
Log:
[ms-inline asm] Rename GenerateAsmString to generateAsmString to conform with
coding standards.  Also, add stub for MSAsmStmt class as part of unifying 
codegen logic for AsmStmts.

Modified:
    cfe/trunk/include/clang/AST/Stmt.h
    cfe/trunk/lib/AST/Stmt.cpp
    cfe/trunk/lib/CodeGen/CGStmt.cpp

Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=162696&r1=162695&r2=162696&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Mon Aug 27 15:23:31 2012
@@ -1398,6 +1398,11 @@
 
   SourceRange getSourceRange() const LLVM_READONLY { return SourceRange(); }
 
+  //===--- Asm String Analysis ---===//
+
+  /// Assemble final IR asm string.
+  virtual std::string generateAsmString(ASTContext &C) const = 0;
+
   //===--- Output operands ---===//
 
   unsigned getNumOutputs() const { return NumOutputs; }
@@ -1517,8 +1522,8 @@
   unsigned AnalyzeAsmString(SmallVectorImpl<AsmStringPiece> &Pieces,
                             ASTContext &C, unsigned &DiagOffs) const;
 
-  /// GenerateAsmString - Assemble final asm string.
-  std::string GenerateAsmString(ASTContext &C) const;
+  /// Assemble final IR asm string.
+  std::string generateAsmString(ASTContext &C) const;
 
   //===--- Output operands ---===//
 
@@ -1685,6 +1690,9 @@
   std::string *getAsmString() { return &AsmStr; }
   void setAsmString(StringRef &E) { AsmStr = E.str(); }
 
+  /// Assemble final IR asm string.
+  std::string generateAsmString(ASTContext &C) const;
+
   //===--- Output operands ---===//
 
   Expr *getOutputExpr(unsigned i);

Modified: cfe/trunk/lib/AST/Stmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Stmt.cpp?rev=162696&r1=162695&r2=162696&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Stmt.cpp (original)
+++ cfe/trunk/lib/AST/Stmt.cpp Mon Aug 27 15:23:31 2012
@@ -548,8 +548,9 @@
     return diag::err_asm_invalid_escape;
   }
 }
-/// GenerateAsmString - Assemble final asm string.
-std::string GCCAsmStmt::GenerateAsmString(ASTContext &C) const {
+
+/// Assemble final IR asm string (GCC-style).
+std::string GCCAsmStmt::generateAsmString(ASTContext &C) const {
   // Analyze the asm string to decompose it into its pieces.  We know that Sema
   // has already done this, so it is guaranteed to be successful.
   SmallVector<GCCAsmStmt::AsmStringPiece, 4> Pieces;
@@ -569,6 +570,12 @@
   return AsmString;
 }
 
+/// Assemble final IR asm string (MS-style).
+std::string MSAsmStmt::generateAsmString(ASTContext &C) const {
+  // FIXME: This needs to be translated into the IR string representation.
+  return std::string();
+}
+
 Expr *MSAsmStmt::getOutputExpr(unsigned i) {
   return cast<Expr>(Exprs[i]);
 }

Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=162696&r1=162695&r2=162696&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Mon Aug 27 15:23:31 2012
@@ -1397,7 +1397,7 @@
 
 void CodeGenFunction::EmitGCCAsmStmt(const GCCAsmStmt &S) {
   // Assemble the final asm string.
-  std::string AsmString = S.GenerateAsmString(getContext());
+  std::string AsmString = S.generateAsmString(getContext());
 
   // Get all the output and input constraints together.
   SmallVector<TargetInfo::ConstraintInfo, 4> OutputConstraintInfos;





More information about the cfe-commits mailing list