r257286 - Make test work on windows by turning \ in paths back into /.
Author: d0k Date: Sun Jan 10 04:36:59 2016 New Revision: 257286 URL: http://llvm.org/viewvc/llvm-project?rev=257286&view=rev Log: Make test work on windows by turning \ in paths back into /. Modified: cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp Modified: cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp?rev=257286&r1=257285&r2=257286&view=diff == --- cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp (original) +++ cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp Sun Jan 10 04:36:59 2016 @@ -658,11 +658,17 @@ TEST_F(InMemoryFileSystemTest, WorkingDi Stat = FS.status("c"); ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString(); + auto ReplaceBackslashes = [](std::string S) { +std::replace(S.begin(), S.end(), '\\', '/'); +return S; + }; NormalizedFS.setCurrentWorkingDirectory("/b/c"); NormalizedFS.setCurrentWorkingDirectory("."); - ASSERT_EQ("/b/c", NormalizedFS.getCurrentWorkingDirectory().get()); + ASSERT_EQ("/b/c", ReplaceBackslashes( +NormalizedFS.getCurrentWorkingDirectory().get())); NormalizedFS.setCurrentWorkingDirectory(".."); - ASSERT_EQ("/b", NormalizedFS.getCurrentWorkingDirectory().get()); + ASSERT_EQ("/b", ReplaceBackslashes( + NormalizedFS.getCurrentWorkingDirectory().get())); } // NOTE: in the tests below, we use '//root/' as our root directory, since it is ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r257287 - Simplify test code with initializer lists.
Author: d0k Date: Sun Jan 10 04:45:19 2016 New Revision: 257287 URL: http://llvm.org/viewvc/llvm-project?rev=257287&view=rev Log: Simplify test code with initializer lists. No functional change intended. Modified: cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp Modified: cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp?rev=257287&r1=257286&r2=257287&view=diff == --- cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp (original) +++ cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp Sun Jan 10 04:45:19 2016 @@ -370,14 +370,6 @@ TEST(VirtualFileSystemTest, BasicRealFSR EXPECT_EQ(1, Counts[3]); // d } -template -std::vector makeStringRefVector(const T (&Arr)[N]) { - std::vector Vec; - for (size_t i = 0; i != N; ++i) -Vec.push_back(Arr[i]); - return Vec; -} - template static void checkContents(DirIter I, ArrayRef Expected) { std::error_code EC; @@ -405,20 +397,14 @@ TEST(VirtualFileSystemTest, OverlayItera checkContents(O->dir_begin("/", EC), ArrayRef("/file1")); Upper->addRegularFile("/file2"); - { -const char *Contents[] = {"/file2", "/file1"}; -checkContents(O->dir_begin("/", EC), makeStringRefVector(Contents)); - } + checkContents(O->dir_begin("/", EC), {"/file2", "/file1"}); Lower->addDirectory("/dir1"); Lower->addRegularFile("/dir1/foo"); Upper->addDirectory("/dir2"); Upper->addRegularFile("/dir2/foo"); checkContents(O->dir_begin("/dir2", EC), ArrayRef("/dir2/foo")); - { -const char *Contents[] = {"/dir2", "/file2", "/dir1", "/file1"}; -checkContents(O->dir_begin("/", EC), makeStringRefVector(Contents)); - } + checkContents(O->dir_begin("/", EC), {"/dir2", "/file2", "/dir1", "/file1"}); } TEST(VirtualFileSystemTest, OverlayRecursiveIteration) { @@ -440,11 +426,8 @@ TEST(VirtualFileSystemTest, OverlayRecur Upper->addDirectory("/dir"); Upper->addRegularFile("/dir/file2"); - { -const char *Contents[] = {"/dir", "/dir/file2", "/file1"}; -checkContents(vfs::recursive_directory_iterator(*O, "/", EC), - makeStringRefVector(Contents)); - } + checkContents(vfs::recursive_directory_iterator(*O, "/", EC), +{"/dir", "/dir/file2", "/file1"}); Lower->addDirectory("/dir1"); Lower->addRegularFile("/dir1/foo"); @@ -460,13 +443,10 @@ TEST(VirtualFileSystemTest, OverlayRecur Upper->addRegularFile("/hiddenByUp"); checkContents(vfs::recursive_directory_iterator(*O, "/dir2", EC), ArrayRef("/dir2/foo")); - { -const char *Contents[] = { "/dir", "/dir/file2", "/dir2", "/dir2/foo", -"/hiddenByUp", "/a", "/a/b", "/a/b/c", "/a/b/c/d", "/dir1", "/dir1/a", -"/dir1/a/b", "/dir1/foo", "/file1" }; -checkContents(vfs::recursive_directory_iterator(*O, "/", EC), - makeStringRefVector(Contents)); - } + checkContents(vfs::recursive_directory_iterator(*O, "/", EC), +{"/dir", "/dir/file2", "/dir2", "/dir2/foo", "/hiddenByUp", + "/a", "/a/b", "/a/b/c", "/a/b/c/d", "/dir1", "/dir1/a", + "/dir1/a/b", "/dir1/foo", "/file1"}); } TEST(VirtualFileSystemTest, ThreeLevelIteration) { @@ -486,10 +466,7 @@ TEST(VirtualFileSystemTest, ThreeLevelIt Lower->addRegularFile("/file1"); Upper->addRegularFile("/file3"); - { -const char *Contents[] = {"/file3", "/file2", "/file1"}; -checkContents(O->dir_begin("/", EC), makeStringRefVector(Contents)); - } + checkContents(O->dir_begin("/", EC), {"/file3", "/file2", "/file1"}); } TEST(VirtualFileSystemTest, HiddenInIteration) { @@ -510,11 +487,9 @@ TEST(VirtualFileSystemTest, HiddenInIter Middle->addRegularFile("/hiddenByUp", sys::fs::owner_write); Upper->addRegularFile("/onlyInUp", sys::fs::owner_all); Upper->addRegularFile("/hiddenByUp", sys::fs::owner_all); - { -const char *Contents[] = {"/hiddenByUp", "/onlyInUp", "/hiddenByMid", - "/onlyInMid", "/onlyInLow"}; -checkContents(O->dir_begin("/", EC), makeStringRefVector(Contents)); - } + checkContents( + O->dir_begin("/", EC), + {"/hiddenByUp", "/onlyInUp", "/hiddenByMid", "/onlyInMid", "/onlyInLow"}); // Make sure we get the top-most entry { @@ -1079,15 +1054,9 @@ TEST_F(VFSFromYAMLTest, DirectoryIterati O->pushOverlay(FS); std::error_code EC; - { -const char *Contents[] = {"//root/file1", "//root/file2", "//root/file3", - "//root/foo"}; -checkContents(O->dir_begin("//root/", EC), makeStringRefVector(Contents)); - } + checkContents(O->dir_begin("//root/", EC), +{"//root/file1", "//root/file2", "//root/file3", "//root/foo"}); - { -const char *Contents[] = {"//root/foo/bar/a", "//root/foo/bar/b"}; -checkContents(O->dir_begin("//root/foo/bar", EC), - makeString
Re: [PATCH] D15686: PR25910: clang allows two var definitions with the same mangled name
andreybokhanko updated the summary for this revision. andreybokhanko updated this revision to Diff 44425. andreybokhanko marked 7 inline comments as done. andreybokhanko added a comment. Fixed tra's notes. All the fixes are local, logic of the patch is not changed. http://reviews.llvm.org/D15686 Files: lib/CodeGen/CodeGenModule.cpp lib/CodeGen/CodeGenModule.h test/CodeGenCXX/duplicate-mangled-name.cpp Index: lib/CodeGen/CodeGenModule.cpp === --- lib/CodeGen/CodeGenModule.cpp +++ lib/CodeGen/CodeGenModule.cpp @@ -1226,27 +1226,31 @@ for (DeferredGlobal &G : CurDeclsToEmit) { GlobalDecl D = G.GD; -llvm::GlobalValue *GV = G.GV; G.GV = nullptr; // We should call GetAddrOfGlobal with IsForDefinition set to true in order // to get GlobalValue with exactly the type we need, not something that // might had been created for another decl with the same mangled name but // different type. -// FIXME: Support for variables is not implemented yet. -if (isa(D.getDecl())) - GV = cast(GetAddrOfGlobal(D, /*IsForDefinition=*/true)); -else - if (!GV) -GV = GetGlobalValue(getMangledName(D)); +llvm::GlobalValue *GV = dyn_cast( +GetAddrOfGlobal(D, /*IsForDefinition=*/true)); + +// In case of different address spaces, we may still get a cast, even with +// IsForDefinition equal to true. Query mangled names table to get +// GlobalValue. +if (!GV) + GV = GetGlobalValue(getMangledName(D)); + +// Make sure GetGlobalValue returned non-null. +assert(GV); // Check to see if we've already emitted this. This is necessary // for a couple of reasons: first, decls can end up in the // deferred-decls queue multiple times, and second, decls can end // up with definitions in unusual ways (e.g. by an extern inline // function acquiring a strong function redefinition). Just // ignore these cases. -if (GV && !GV->isDeclaration()) +if (!GV->isDeclaration()) continue; // Otherwise, emit the definition and move on to the next one. @@ -1707,7 +1711,7 @@ } if (const auto *VD = dyn_cast(D)) -return EmitGlobalVarDefinition(VD); +return EmitGlobalVarDefinition(VD, !VD->hasDefinition()); llvm_unreachable("Invalid argument to EmitGlobalDefinition()"); } @@ -1748,8 +1752,8 @@ // error. if (IsForDefinition && !Entry->isDeclaration()) { GlobalDecl OtherGD; - // Check that GD is not yet in ExplicitDefinitions is required to make - // sure that we issue an error only once. + // Check that GD is not yet in DiagnosedConflictingDefinitions is required + // to make sure that we issue an error only once. if (lookupRepresentativeDecl(MangledName, OtherGD) && (GD.getCanonicalDecl().getDecl() != OtherGD.getCanonicalDecl().getDecl()) && @@ -1959,10 +1963,15 @@ /// /// If D is non-null, it specifies a decl that correspond to this. This is used /// to set the attributes on the global when it is first created. +/// +/// If IsForDefinition is true, it is guranteed that an actual global with +/// type Ty will be returned, not conversion of a variable with the same +/// mangled name but some other type. llvm::Constant * CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName, llvm::PointerType *Ty, - const VarDecl *D) { + const VarDecl *D, + bool IsForDefinition) { // Lookup the entry, lazily creating it if necessary. llvm::GlobalValue *Entry = GetGlobalValue(MangledName); if (Entry) { @@ -1978,19 +1987,56 @@ if (Entry->getType() == Ty) return Entry; +// If there are two attempts to define the same mangled name, issue an +// error. +if (IsForDefinition && !Entry->isDeclaration()) { + GlobalDecl OtherGD; + const VarDecl *OtherD; + + // Check that D is not yet in DiagnosedConflictingDefinitions is required + // to make sure that we issue an error only once. + if (lookupRepresentativeDecl(MangledName, OtherGD) && + (D->getCanonicalDecl() != OtherGD.getCanonicalDecl().getDecl()) && + (OtherD = dyn_cast(OtherGD.getDecl())) && + OtherD->hasInit() && + DiagnosedConflictingDefinitions.insert(D).second) { +getDiags().Report(D->getLocation(), + diag::err_duplicate_mangled_name); +getDiags().Report(OtherGD.getDecl()->getLocation(), + diag::note_previous_definition); + } +} + // Make sure the result is of the correct type. if (Entry->getType()->getAddressSpace() != Ty->getAddressSpace()) return llvm::ConstantExpr::getAddrSpaceCast(Entry, Ty); -return llvm::ConstantExpr::getBitCast(Entry, Ty); +// (If global is reque
Re: [PATCH] D15686: PR25910: clang allows two var definitions with the same mangled name
andreybokhanko added a comment. In http://reviews.llvm.org/D15686#319725, @tra wrote: > A better description of the problem would help. PR itself is somewhat short > on details. Sorry for being not clear. I expected my main reviewer to be @rjmccall, who knows exactly what the problem is. > If I understand it correctly, the problem is that if we create multiple > definitions with the same mangled name, clang does not always report it as an > error and only emits one of those instances. Yes, exactly. Patch updated; please re-review. Yours, Andrey Comment at: lib/CodeGen/CodeGenModule.h:1140 @@ -1139,1 +1139,3 @@ +const VarDecl *D, +bool IsForDefinition = false); tra wrote: > Ditto here. Done (in *.cpp file). Comment at: lib/CodeGen/CodeGenModule.h:1151 @@ -1148,3 +1150,3 @@ void EmitGlobalFunctionDefinition(GlobalDecl GD, llvm::GlobalValue *GV); - void EmitGlobalVarDefinition(const VarDecl *D); + void EmitGlobalVarDefinition(const VarDecl *D, bool IsTentative = false); void EmitAliasDefinition(GlobalDecl GD); tra wrote: > And for IsTentative, too. > Done (in*.cpp file). http://reviews.llvm.org/D15686 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r257260 - [vfs] Normalize working directory if requested.
Fixed in r257286, sorry for the breakage. On Sun, Jan 10, 2016 at 7:59 AM, Ismail Donmez wrote: > Hi, > >> + NormalizedFS.setCurrentWorkingDirectory("/b/c"); >> + NormalizedFS.setCurrentWorkingDirectory("."); >> + ASSERT_EQ("/b/c", NormalizedFS.getCurrentWorkingDirectory().get()); >> + NormalizedFS.setCurrentWorkingDirectory(".."); >> + ASSERT_EQ("/b", NormalizedFS.getCurrentWorkingDirectory().get()); >> } > > This test fails on Windows (MSVC 2015 x64): > > TEST 'Clang-Unit :: > Basic/BasicTests.exe/InMemoryFileSystemTest.WorkingDirectory' FAILED > > > Note: Google Test filter = InMemoryFileSystemTest.WorkingDirectory > [==] Running 1 test from 1 test case. > [--] Global test environment set-up. > [--] 1 test from InMemoryFileSystemTest > [ RUN ] InMemoryFileSystemTest.WorkingDirectory > ..\tools\clang\unittests\Basic\VirtualFileSystemTest.cpp(663): error: > Value of: NormalizedFS.getCurrentWorkingDirectory().get( > ) > Actual: "/b\\c" > Expected: "/b/c" > [ FAILED ] InMemoryFileSystemTest.WorkingDirectory (0 ms) > [--] 1 test from InMemoryFileSystemTest (0 ms total) > > [--] Global test environment tear-down > [==] 1 test from 1 test case ran. (0 ms total) > [ PASSED ] 0 tests. > [ FAILED ] 1 test, listed below: > [ FAILED ] InMemoryFileSystemTest.WorkingDirectory > > 1 FAILED TEST > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D16040: [OpenCL] Refine OpenCLImageAccessAttr to OpenCLAccessAttr
pxli168 created this revision. pxli168 added reviewers: Anastasia, pekka.jaaskelainen. pxli168 added a subscriber: cfe-commits. OpenCL access qualifiers are now not only used for image types, refine it to avoid misleading, Add semacheck for OpenCL access qualifier as well as test caees. http://reviews.llvm.org/D16040 Files: include/clang/Basic/Attr.td include/clang/Basic/DiagnosticSemaKinds.td lib/CodeGen/CodeGenFunction.cpp lib/Sema/SemaChecking.cpp lib/Sema/SemaDeclAttr.cpp lib/Sema/SemaType.cpp test/Parser/opencl-image-access.cl test/SemaOpenCL/invalid-access-qualifier.cl test/SemaOpenCL/invalid-kernel-attrs.cl Index: test/SemaOpenCL/invalid-kernel-attrs.cl === --- test/SemaOpenCL/invalid-kernel-attrs.cl +++ test/SemaOpenCL/invalid-kernel-attrs.cl @@ -28,8 +28,8 @@ void f_kernel_image2d_t( kernel image2d_t image ) { // expected-error {{'kernel' attribute only applies to functions}} int __kernel x; // expected-error {{'__kernel' attribute only applies to functions}} - read_only int i; // expected-error {{'read_only' attribute only applies to parameters}} - __write_only int j; // expected-error {{'__write_only' attribute only applies to parameters}} + read_only image1d_t i; // expected-error {{'read_only' attribute only applies to parameters}} + __write_only image2d_t j; // expected-error {{'__write_only' attribute only applies to parameters}} } kernel __attribute__((reqd_work_group_size(1,2,0))) void kernel11(){} // expected-error {{'reqd_work_group_size' attribute must be greater than 0}} Index: test/SemaOpenCL/invalid-access-qualifier.cl === --- /dev/null +++ test/SemaOpenCL/invalid-access-qualifier.cl @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -verify %s +// RUN: %clang_cc1 -verify -cl-std=CL2.0 -DCL20 %s + +void test1(read_only int i){} // expected-error{{access qualifier can only be used for pipe and image type}} + +void test2(read_only write_only image1d_t i){} // expected-error{{multiple access qualifiers}} + +void test3(read_only read_only image1d_t i){} // expected-error{{multiple access qualifiers}} + +#ifdef CL20 +void test4(read_write image1d_t i){} + +void test5(read_write pipe int i){} // expected-error{{access qualifier read_write can not be used for 'pipe'}} +#else +void test4(read_write image1d_t i){} // expected-error{{access qualifier read_write can not be used for 'image1d_t' before CL2.0}} +#endif Index: test/Parser/opencl-image-access.cl === --- test/Parser/opencl-image-access.cl +++ test/Parser/opencl-image-access.cl @@ -1,14 +1,18 @@ // RUN: %clang_cc1 %s -fsyntax-only +// RUN: %clang_cc1 %s -fsyntax-only -cl-std=CL2.0 -DCL20 __kernel void f__ro(__read_only image2d_t a) { } __kernel void f__wo(__write_only image2d_t a) { } +#if CL20 __kernel void f__rw(__read_write image2d_t a) { } - +#endif __kernel void fro(read_only image2d_t a) { } __kernel void fwo(write_only image2d_t a) { } +#if CL20 __kernel void frw(read_write image2d_t a) { } +#endif Index: lib/Sema/SemaType.cpp === --- lib/Sema/SemaType.cpp +++ lib/Sema/SemaType.cpp @@ -6217,6 +6217,17 @@ CurType = S.Context.getVectorType(CurType, numElts, VecKind); } +/// Handle OpenCL Access Qualifier Attribute +static void HandleOpenCLAccessAttr(QualType &CurType, const AttributeList &Attr, + Sema &S) { + // OpenCL v2.0 s6.6 -- Access Qualifier can used only for image and pipe type + if (!(CurType->isImageType() || CurType->isPipeType())) { +S.Diag(Attr.getLoc(), diag::err_opencl_invalid_access_qualifier); +Attr.setInvalid(); +return; + } +} + static void processTypeAttrs(TypeProcessingState &state, QualType &type, TypeAttrLocation TAL, AttributeList *attrs) { // Scan through and apply attributes to this type where it makes sense. Some @@ -6312,9 +6323,8 @@ VectorType::NeonPolyVector); attr.setUsedAsTypeAttr(); break; -case AttributeList::AT_OpenCLImageAccess: - // FIXME: there should be some type checking happening here, I would - // imagine, but the original handler's checking was entirely superfluous. +case AttributeList::AT_OpenCLAccess: + HandleOpenCLAccessAttr(type, attr, state.getSema()); attr.setUsedAsTypeAttr(); break; Index: lib/Sema/SemaDeclAttr.cpp === --- lib/Sema/SemaDeclAttr.cpp +++ lib/Sema/SemaDeclAttr.cpp @@ -4906,6 +4906,45 @@ return false; } +static void handleOpenCLAccessAttr(Sema &S, Decl *D, + const AttributeList &Attr) { + if (D->isInvalidDecl()) +return; + + // Check if there only one access qualifier + if (D->hasAttr()) { +
r257291 - Accidentally removed part of the file header. Restoring it back.
Author: kromanova Date: Sun Jan 10 10:18:09 2016 New Revision: 257291 URL: http://llvm.org/viewvc/llvm-project?rev=257291&view=rev Log: Accidentally removed part of the file header. Restoring it back. Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=257291&r1=257290&r2=257291&view=diff == --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Sun Jan 10 10:18:09 2016 @@ -1,4 +1,4 @@ -//===--- +//===--- CompilerInvocation.cpp ---===// // // The LLVM Compiler Infrastructure // ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Add BeforeWhileInDoWhile BraceWrapping option
Code like this: do { // Some code } while (1); becomes: do { // Some code } while (1); I couldn't think of a better name for the option than BeforeWhileInDoWhile. I'm open to suggestions! Also, this is my first attempt at submitting a patch for this project. If I've done anything wrong, please let me know. Thanks! -- Thanks, Eric Baker BreakBeforeWhileInDoWhile.patch Description: Binary data ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D16041: Change vfs::FileSystem to be managed with std::shared_ptr
resistor created this revision. resistor added reviewers: chandlerc, bkramer, klimek. resistor added a subscriber: cfe-commits. resistor set the repository for this revision to rL LLVM. Herald added a subscriber: klimek. Managing it with IntrusiveRefCntPtr caused the virtual destructor not to be called properly. Repository: rL LLVM http://reviews.llvm.org/D16041 Files: include/clang/Basic/FileManager.h include/clang/Basic/VirtualFileSystem.h include/clang/Driver/Driver.h include/clang/Frontend/CompilerInstance.h include/clang/Frontend/CompilerInvocation.h include/clang/Tooling/Tooling.h lib/Basic/FileManager.cpp lib/Basic/VirtualFileSystem.cpp lib/Driver/Driver.cpp lib/Format/Format.cpp lib/Frontend/ASTUnit.cpp lib/Frontend/CompilerInstance.cpp lib/Frontend/CompilerInvocation.cpp lib/Frontend/FrontendAction.cpp lib/Index/SimpleFormatContext.h lib/StaticAnalyzer/Frontend/ModelInjector.cpp lib/Tooling/Core/Replacement.cpp lib/Tooling/Tooling.cpp tools/clang-format/ClangFormat.cpp unittests/Basic/VirtualFileSystemTest.cpp unittests/Driver/ToolChainTest.cpp unittests/Lex/PPCallbacksTest.cpp unittests/Tooling/RewriterTestContext.h unittests/Tooling/ToolingTest.cpp Index: unittests/Tooling/ToolingTest.cpp === --- unittests/Tooling/ToolingTest.cpp +++ unittests/Tooling/ToolingTest.cpp @@ -149,9 +149,9 @@ } TEST(ToolInvocation, TestMapVirtualFile) { - llvm::IntrusiveRefCntPtr OverlayFileSystem( + std::shared_ptr OverlayFileSystem( new vfs::OverlayFileSystem(vfs::getRealFileSystem())); - llvm::IntrusiveRefCntPtr InMemoryFileSystem( + std::shared_ptr InMemoryFileSystem( new vfs::InMemoryFileSystem); OverlayFileSystem->pushOverlay(InMemoryFileSystem); llvm::IntrusiveRefCntPtr Files( @@ -175,9 +175,9 @@ // mapped module.map is found on the include path. In the future, expand this // test to run a full modules enabled compilation, so we make sure we can // rerun modules compilations with a virtual file system. - llvm::IntrusiveRefCntPtr OverlayFileSystem( + std::shared_ptr OverlayFileSystem( new vfs::OverlayFileSystem(vfs::getRealFileSystem())); - llvm::IntrusiveRefCntPtr InMemoryFileSystem( + std::shared_ptr InMemoryFileSystem( new vfs::InMemoryFileSystem); OverlayFileSystem->pushOverlay(InMemoryFileSystem); llvm::IntrusiveRefCntPtr Files( Index: unittests/Tooling/RewriterTestContext.h === --- unittests/Tooling/RewriterTestContext.h +++ unittests/Tooling/RewriterTestContext.h @@ -114,8 +114,8 @@ IntrusiveRefCntPtr DiagOpts; DiagnosticsEngine Diagnostics; TextDiagnosticPrinter DiagnosticPrinter; - IntrusiveRefCntPtr InMemoryFileSystem; - IntrusiveRefCntPtr OverlayFileSystem; + std::shared_ptr InMemoryFileSystem; + std::shared_ptr OverlayFileSystem; FileManager Files; SourceManager Sources; LangOptions Options; Index: unittests/Lex/PPCallbacksTest.cpp === --- unittests/Lex/PPCallbacksTest.cpp +++ unittests/Lex/PPCallbacksTest.cpp @@ -119,7 +119,7 @@ Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts); } - IntrusiveRefCntPtr InMemoryFileSystem; + std::shared_ptr InMemoryFileSystem; FileManager FileMgr; IntrusiveRefCntPtr DiagID; IntrusiveRefCntPtr DiagOpts; Index: unittests/Driver/ToolChainTest.cpp === --- unittests/Driver/ToolChainTest.cpp +++ unittests/Driver/ToolChainTest.cpp @@ -31,7 +31,7 @@ IntrusiveRefCntPtr DiagID(new DiagnosticIDs()); struct TestDiagnosticConsumer : public DiagnosticConsumer {}; DiagnosticsEngine Diags(DiagID, &*DiagOpts, new TestDiagnosticConsumer); - IntrusiveRefCntPtr InMemoryFileSystem( + std::shared_ptr InMemoryFileSystem( new vfs::InMemoryFileSystem); Driver TheDriver("/bin/clang", "arm-linux-gnueabihf", Diags, InMemoryFileSystem); @@ -84,7 +84,7 @@ IntrusiveRefCntPtr DiagID(new DiagnosticIDs()); struct TestDiagnosticConsumer : public DiagnosticConsumer {}; DiagnosticsEngine Diags(DiagID, &*DiagOpts, new TestDiagnosticConsumer); - IntrusiveRefCntPtr InMemoryFileSystem( + std::shared_ptr InMemoryFileSystem( new vfs::InMemoryFileSystem); Driver TheDriver("/home/test/bin/clang", "arm-linux-gnueabi", Diags, InMemoryFileSystem); Index: unittests/Basic/VirtualFileSystemTest.cpp === --- unittests/Basic/VirtualFileSystemTest.cpp +++ unittests/Basic/VirtualFileSystemTest.cpp @@ -134,7 +134,7 @@ } // end anonymous namespace TEST(VirtualFileSystemTest, StatusQueries) { - IntrusiveRefCntPtr D(new DummyFileSystem()); + std::shared_ptr D(new DummyFileSystem()); ErrorOr Status((std::error_code())); D->addRegularFile("/foo"); @@ -174,1