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 | bd7fdadb901d086ca3f612e7eaefcb9cbbbe5fc8 (patch) | |
tree | 2f9ff3ff953ac4dbfd7d1362b8e4c9bde0a14e21 /clang/lib/Sema/SemaStmtAsm.cpp | |
parent | 7a8e10042f340bceafa70b97f7b7ab6b78b5792c (diff) | |
download | bcm5719-llvm-bd7fdadb901d086ca3f612e7eaefcb9cbbbe5fc8.tar.gz bcm5719-llvm-bd7fdadb901d086ca3f612e7eaefcb9cbbbe5fc8.zip |
[ms-inline asm] Add $$ before numeric constants in the IR.
llvm-svn: 163581
Diffstat (limited to 'clang/lib/Sema/SemaStmtAsm.cpp')
-rw-r--r-- | clang/lib/Sema/SemaStmtAsm.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp index 5cab02d9248..78e55317251 100644 --- a/clang/lib/Sema/SemaStmtAsm.cpp +++ b/clang/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(); } |