[PATCH] [inline-asm] Fix scope of assembly macros
Reid Kleckner
rnk at google.com
Wed Dec 3 10:40:23 PST 2014
How will macros interact with diagnostics emitted in Clang? An SMLoc is just a `const char*` wrapper. Clang even assumes that this pointer points to the asm buffer. Adding macros that point to strings outside the main buffer seems like it could violate that assumption, right?
See this code in Clang:
SourceLocation translateLocation(const llvm::SourceMgr &LSM, llvm::SMLoc SMLoc) {
// Compute an offset into the inline asm buffer.
// FIXME: This isn't right if .macro is involved (but hopefully, no
// real-world code does that).
const llvm::MemoryBuffer *LBuf =
LSM.getMemoryBuffer(LSM.FindBufferContainingLoc(SMLoc));
unsigned Offset = SMLoc.getPointer() - LBuf->getBufferStart();
http://reviews.llvm.org/D6383
More information about the llvm-commits
mailing list