Index: clang/lib/CrossTU/CrossTranslationUnit.cpp =================================================================== --- clang/lib/CrossTU/CrossTranslationUnit.cpp +++ clang/lib/CrossTU/CrossTranslationUnit.cpp @@ -668,8 +668,14 @@ if (InvocationList) return llvm::Error::success(); + SmallString<256> InvocationListFileAbsolutePath = CTUDir; + if (llvm::sys::path::is_absolute(InvocationListFilePath)) + InvocationListFileAbsolutePath = InvocationListFilePath; + else + llvm::sys::path::append(InvocationListFileAbsolutePath, + InvocationListFilePath); llvm::ErrorOr> FileContent = - llvm::MemoryBuffer::getFile(InvocationListFilePath); + llvm::MemoryBuffer::getFile(InvocationListFileAbsolutePath); if (!FileContent) return llvm::make_error( index_error_code::invocation_list_file_not_found); Index: clang/test/Analysis/ctu-on-demand-parsing.c =================================================================== --- clang/test/Analysis/ctu-on-demand-parsing.c +++ clang/test/Analysis/ctu-on-demand-parsing.c @@ -7,16 +7,16 @@ // compile_commands.json is only needed for extdef_mapping, not for the analysis itself. // RUN: echo '[{"directory":"%t","command":"gcc -std=c89 -Wno-visibility ctu-other.c","file":"ctu-other.c"}]' | sed -e 's/\\/\\\\/g' > %t/compile_commands.json // -// RUN: echo '"%t/ctu-other.c": ["gcc", "-std=c89", "-Wno-visibility", "ctu-other.c"]' | sed -e 's/\\/\\\\/g' > %t/invocations.yaml +// RUN: echo '"%t/ctu-other.c": ["gcc", "-std=c89", "-Wno-visibility", "%t/ctu-other.c"]' | sed -e 's/\\/\\\\/g' > %t/invocations.yaml // -// RUN: cd "%t" && %clang_extdef_map "%t/ctu-other.c" > externalDefMap.txt +// RUN: %clang_extdef_map -p %t "%t/ctu-other.c" > %t/externalDefMap.txt // -// RUN: cd "%t" && %clang_cc1 -fsyntax-only -std=c89 -analyze \ +// RUN: %clang_cc1 -fsyntax-only -std=c89 -analyze \ // RUN: -analyzer-checker=core,debug.ExprInspection \ // RUN: -analyzer-config experimental-enable-naive-ctu-analysis=true \ -// RUN: -analyzer-config ctu-dir=. \ +// RUN: -analyzer-config ctu-dir=%t \ // RUN: -analyzer-config ctu-invocation-list=invocations.yaml \ -// RUN: -verify ctu-on-demand-parsing.c +// RUN: -verify %t/ctu-on-demand-parsing.c // // FIXME: Path handling should work on all platforms. // REQUIRES: system-linux Index: clang/test/Analysis/ctu-on-demand-parsing.cpp =================================================================== --- clang/test/Analysis/ctu-on-demand-parsing.cpp +++ clang/test/Analysis/ctu-on-demand-parsing.cpp @@ -11,20 +11,20 @@ // // RUN: echo '{"%t/Inputs/ctu-chain.cpp": ["g++", "%t/Inputs/ctu-chain.cpp"], "%t/Inputs/ctu-other.cpp": ["g++", "%t/Inputs/ctu-other.cpp"]}' | sed -e 's/\\/\\\\/g' > %t/invocations.yaml // -// RUN: cd "%t" && %clang_extdef_map Inputs/ctu-chain.cpp Inputs/ctu-other.cpp > externalDefMap.txt +// RUN: %clang_extdef_map -p %t %t/Inputs/ctu-chain.cpp %t/Inputs/ctu-other.cpp > %t/externalDefMap.txt // -// RUN: cd "%t" && %clang_analyze_cc1 \ +// RUN: %clang_analyze_cc1 \ // RUN: -analyzer-checker=core,debug.ExprInspection \ // RUN: -analyzer-config experimental-enable-naive-ctu-analysis=true \ -// RUN: -analyzer-config ctu-dir=. \ +// RUN: -analyzer-config ctu-dir=%t \ // RUN: -analyzer-config ctu-invocation-list=invocations.yaml \ -// RUN: -verify ctu-on-demand-parsing.cpp -// RUN: cd "%t" && %clang_analyze_cc1 \ +// RUN: -verify %t/ctu-on-demand-parsing.cpp +// RUN: %clang_analyze_cc1 \ // RUN: -analyzer-checker=core,debug.ExprInspection \ // RUN: -analyzer-config experimental-enable-naive-ctu-analysis=true \ -// RUN: -analyzer-config ctu-dir=. \ +// RUN: -analyzer-config ctu-dir=%t \ // RUN: -analyzer-config ctu-invocation-list=invocations.yaml \ -// RUN: -analyzer-config display-ctu-progress=true ctu-on-demand-parsing.cpp 2>&1 | FileCheck %t/ctu-on-demand-parsing.cpp +// RUN: -analyzer-config display-ctu-progress=true %t/ctu-on-demand-parsing.cpp 2>&1 | FileCheck %t/ctu-on-demand-parsing.cpp // // CHECK: CTU loaded AST file: {{.*}}ctu-other.cpp // CHECK: CTU loaded AST file: {{.*}}ctu-chain.cpp