diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-06-27 17:40:03 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-06-27 17:40:03 +0000 |
commit | 66cc07b4f72ca630846395dbbc60ebee7a5e0104 (patch) | |
tree | b02668e8a7183333470bc5e34ff591e347e54f5c /clang/lib/CodeGen/CodeGenAction.cpp | |
parent | 6c75b3a3c0a8350dd15181e9824d6d76e689ec3a (diff) | |
download | llvm-66cc07b4f72ca630846395dbbc60ebee7a5e0104.zip llvm-66cc07b4f72ca630846395dbbc60ebee7a5e0104.tar.gz llvm-66cc07b4f72ca630846395dbbc60ebee7a5e0104.tar.bz2 |
Remove 'const' from MemoryBuffers used through the SourceManager
This removes a const_cast added in r211884 that occurred due to an
inconsistency in how MemoryBuffers are handled between some parts of
clang and LLVM.
MemoryBuffers are immutable and the general convention in the LLVM
project is to omit const from immutable types as it's simply
redundant/verbose (see llvm::Type, for example). While this change
doesn't remove "const" from /every/ MemoryBuffer, it at least makes this
chain of ownership/usage consistent.
llvm-svn: 211915
Diffstat (limited to 'clang/lib/CodeGen/CodeGenAction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenAction.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp index 18fa0fa..3342aa1 100644 --- a/clang/lib/CodeGen/CodeGenAction.cpp +++ b/clang/lib/CodeGen/CodeGenAction.cpp @@ -641,14 +641,12 @@ void CodeGenAction::ExecuteAction() { bool Invalid; SourceManager &SM = CI.getSourceManager(); - const llvm::MemoryBuffer *MainFile = SM.getBuffer(SM.getMainFileID(), - &Invalid); + llvm::MemoryBuffer *MainFile = SM.getBuffer(SM.getMainFileID(), &Invalid); if (Invalid) return; llvm::SMDiagnostic Err; - TheModule.reset( - ParseIR(const_cast<MemoryBuffer *>(MainFile), Err, *VMContext)); + TheModule.reset(ParseIR(MainFile, Err, *VMContext)); if (!TheModule) { // Translate from the diagnostic info to the SourceManager location. SourceLocation Loc = SM.translateFileLineCol( |