summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenAction.cpp
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2014-06-27 06:02:00 +0000
committerAlp Toker <alp@nuanti.com>2014-06-27 06:02:00 +0000
commitaa0dd5a4097e817531454b78ed7d349289d1a82c (patch)
tree145a73bc6a3e76e7380b0bdb9c83050140b11ea8 /clang/lib/CodeGen/CodeGenAction.cpp
parentdada538bb4cf82ea1c3b2ed67687b1727fe7d85d (diff)
downloadbcm5719-llvm-aa0dd5a4097e817531454b78ed7d349289d1a82c.tar.gz
bcm5719-llvm-aa0dd5a4097e817531454b78ed7d349289d1a82c.zip
Add a FIXME for an unfortunate issue in ConvertBackendLocation()
This function is copying the entire file contents into memory repeatedly and allocating new file IDs *each time* a source location is processed. llvm-svn: 211874
Diffstat (limited to 'clang/lib/CodeGen/CodeGenAction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenAction.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp
index 2b7fab3beb9..1a092fcedb1 100644
--- a/clang/lib/CodeGen/CodeGenAction.cpp
+++ b/clang/lib/CodeGen/CodeGenAction.cpp
@@ -267,13 +267,15 @@ static FullSourceLoc ConvertBackendLocation(const llvm::SMDiagnostic &D,
LSM.getMemoryBuffer(LSM.FindBufferContainingLoc(D.getLoc()));
// Create the copy and transfer ownership to clang::SourceManager.
+ // TODO: Avoid copying files into memory.
llvm::MemoryBuffer *CBuf =
llvm::MemoryBuffer::getMemBufferCopy(LBuf->getBuffer(),
LBuf->getBufferIdentifier());
+ // FIXME: Keep a file ID map instead of creating new IDs for each location.
FileID FID = CSM.createFileID(CBuf);
// Translate the offset into the file.
- unsigned Offset = D.getLoc().getPointer() - LBuf->getBufferStart();
+ unsigned Offset = D.getLoc().getPointer() - LBuf->getBufferStart();
SourceLocation NewLoc =
CSM.getLocForStartOfFile(FID).getLocWithOffset(Offset);
return FullSourceLoc(NewLoc, CSM);
OpenPOWER on IntegriCloud