Author: nico Date: Thu Apr 4 14:06:41 2019 New Revision: 357724 URL: http://llvm.org/viewvc/llvm-project?rev=357724&view=rev Log: Make SourceManager::createFileID(UnownedTag, ...) take a const llvm::MemoryBuffer*
Requires making the llvm::MemoryBuffer* stored by SourceManager const, which in turn requires making the accessors for that return const llvm::MemoryBuffer*s and updating all call sites. The original motivation for this was to use it and fix the TODO in CodeGenAction.cpp's ConvertBackendLocation() by using the UnownedTag version of createFileID, and since llvm::SourceMgr* hands out a const llvm::MemoryBuffer* this is required. I'm not sure if fixing the TODO this way actually works, but this seems like a good change on its own anyways. No intended behavior change. Differential Revision: https://reviews.llvm.org/D60247 Modified: clang-tools-extra/trunk/clang-tidy/bugprone/SuspiciousSemicolonCheck.cpp clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp Modified: clang-tools-extra/trunk/clang-tidy/bugprone/SuspiciousSemicolonCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/SuspiciousSemicolonCheck.cpp?rev=357724&r1=357723&r2=357724&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/SuspiciousSemicolonCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/bugprone/SuspiciousSemicolonCheck.cpp Thu Apr 4 14:06:41 2019 @@ -53,7 +53,7 @@ void SuspiciousSemicolonCheck::check(con SourceLocation LocEnd = Semicolon->getEndLoc(); FileID FID = SM.getFileID(LocEnd); - llvm::MemoryBuffer *Buffer = SM.getBuffer(FID, LocEnd); + const llvm::MemoryBuffer *Buffer = SM.getBuffer(FID, LocEnd); Lexer Lexer(SM.getLocForStartOfFile(FID), Ctxt.getLangOpts(), Buffer->getBufferStart(), SM.getCharacterData(LocEnd) + 1, Buffer->getBufferEnd()); Modified: clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp?rev=357724&r1=357723&r2=357724&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp Thu Apr 4 14:06:41 2019 @@ -145,7 +145,7 @@ SourceLocation StaticAssertCheck::getLas const LangOptions &Opts = ASTCtx->getLangOpts(); const SourceManager &SM = ASTCtx->getSourceManager(); - llvm::MemoryBuffer *Buffer = SM.getBuffer(SM.getFileID(AssertLoc)); + const llvm::MemoryBuffer *Buffer = SM.getBuffer(SM.getFileID(AssertLoc)); if (!Buffer) return SourceLocation(); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits