diff options
author | Chad Rosier <mcrosier@apple.com> | 2012-09-11 00:51:28 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2012-09-11 00:51:28 +0000 |
commit | 4de971651ba09009d4a7cc6d2fbc978dd7092263 (patch) | |
tree | ea761136e0bd69499d9db01779ba52a689e0ee60 /lib/Sema/SemaStmtAsm.cpp | |
parent | 116bb09882bc1c9281cd84dd07496201feb18d18 (diff) |
[ms-inline asm] Add $$ before numeric constants in the IR.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163581 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmtAsm.cpp')
-rw-r--r-- | lib/Sema/SemaStmtAsm.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/Sema/SemaStmtAsm.cpp b/lib/Sema/SemaStmtAsm.cpp index 5cab02d924..78e5531725 100644 --- a/lib/Sema/SemaStmtAsm.cpp +++ b/lib/Sema/SemaStmtAsm.cpp @@ -413,9 +413,9 @@ static void buildMSAsmPieces(std::vector<std::string> &AsmStrings, buildMSAsmPieces(AsmStrings[i], Pieces[i]); } -// Build the unmodified AsmString used by the IR. Also build the individual -// asm instruction(s) and place them in the AsmStrings vector; these are fed -// to the AsmParser. +// Build the AsmString used by the IR. Also build the individual asm +// instruction(s) and place them in the AsmStrings vector; these are fed to the +// AsmParser. static std::string buildMSAsmString(Sema &SemaRef, ArrayRef<Token> AsmToks, std::vector<std::string> &AsmStrings, std::vector<std::pair<unsigned,unsigned> > &AsmTokRanges) { @@ -433,9 +433,8 @@ static std::string buildMSAsmString(Sema &SemaRef, ArrayRef<Token> AsmToks, AsmStrings.push_back(Asm.str()); AsmTokRanges.push_back(std::make_pair(startTok, i-1)); startTok = i; - Res += Asm; Asm.clear(); - Res += '\n'; + Res += "\n\t"; } if (AsmToks[i].is(tok::kw_asm)) { i++; // Skip __asm @@ -443,14 +442,20 @@ static std::string buildMSAsmString(Sema &SemaRef, ArrayRef<Token> AsmToks, } } - if (i && AsmToks[i].hasLeadingSpace() && !isNewAsm) + if (i && AsmToks[i].hasLeadingSpace() && !isNewAsm) { Asm += ' '; + Res += ' '; + } + + if (AsmToks[i].is(tok::numeric_constant)) + Res += "$$"; - Asm += getSpelling(SemaRef, AsmToks[i]); + StringRef Spelling = getSpelling(SemaRef, AsmToks[i]); + Asm += Spelling; + Res += Spelling; } AsmStrings.push_back(Asm.str()); AsmTokRanges.push_back(std::make_pair(startTok, AsmToks.size()-1)); - Res += Asm; return Res.str(); } |