From c77e69d5007744bc5bcdf4df3e4c3faadf6cce83 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Fri, 27 Jun 2014 17:40:03 +0000 Subject: 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211915 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenAction.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/CodeGen/CodeGenAction.cpp') diff --git a/lib/CodeGen/CodeGenAction.cpp b/lib/CodeGen/CodeGenAction.cpp index 18fa0fad92..3342aa12c8 100644 --- a/lib/CodeGen/CodeGenAction.cpp +++ b/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(MainFile), Err, *VMContext)); + TheModule.reset(ParseIR(MainFile, Err, *VMContext)); if (!TheModule) { // Translate from the diagnostic info to the SourceManager location. SourceLocation Loc = SM.translateFileLineCol( -- cgit v1.2.3