summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaStmtAsm.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2016-11-28 20:52:19 +0000
committerReid Kleckner <rnk@google.com>2016-11-28 20:52:19 +0000
commit08ebbcebb984b115ad1feb5984306f46cacdc616 (patch)
tree4235190f7af45df3e553586de92c6b0ab6f2d62b /clang/lib/Sema/SemaStmtAsm.cpp
parent115efcd3d12e3617d0a2ee02499b379c67c2c5cb (diff)
downloadbcm5719-llvm-08ebbcebb984b115ad1feb5984306f46cacdc616.tar.gz
bcm5719-llvm-08ebbcebb984b115ad1feb5984306f46cacdc616.zip
[MS] Mangle a unique ID into all MS inline asm labels
This solves PR23715 in a way that is compatible with LTO. MSVC supports jumping to source-level labels and between inline asm blocks, but we don't. Also revert the old solution, r255201, which was to mark these calls as noduplicate. llvm-svn: 288059
Diffstat (limited to 'clang/lib/Sema/SemaStmtAsm.cpp')
-rw-r--r--clang/lib/Sema/SemaStmtAsm.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp
index b36abb46c4a..f11e7aaa34f 100644
--- a/clang/lib/Sema/SemaStmtAsm.cpp
+++ b/clang/lib/Sema/SemaStmtAsm.cpp
@@ -753,14 +753,12 @@ LabelDecl *Sema::GetOrCreateMSAsmLabel(StringRef ExternalLabelName,
// Create an internal name for the label. The name should not be a valid mangled
// name, and should be unique. We use a dot to make the name an invalid mangled
// name.
- OS << "__MSASMLABEL_." << MSAsmLabelNameCounter++ << "__";
- for (auto it = ExternalLabelName.begin(); it != ExternalLabelName.end();
- ++it) {
- OS << *it;
- if (*it == '$') {
- // We escape '$' in asm strings by replacing it with "$$"
+ OS << "__MSASMLABEL_.{:uid}__";
+ for (char C : ExternalLabelName) {
+ OS << C;
+ // We escape '$' in asm strings by replacing it with "$$"
+ if (C == '$')
OS << '$';
- }
}
Label->setMSAsmLabel(OS.str());
}
OpenPOWER on IntegriCloud