[cfe-dev] Relative Paths in Compilation Database
Daniel Dilts
diltsman at gmail.com
Mon Mar 16 17:07:34 PDT 2015
I am calling runClangTidy using a JSONCompilationDatabase that I generate
from a string. Everything works perfectly until I have a relative path.
With the following database I use "D:\\CMakeTest\\bld\\..\\src\\main.cpp"
as the file to open:
[
{
"directory": "D:\\CMakeTest\\bld\\",
"command" : "D:/llvm/build/Debug/bin/clang.exe -I\"C:\\Program Files
(x86)\\Microsoft Visual Studio 12.0\\VC\\include\" -I\"C:\\Program Files
(x86)\\Microsoft Visual Studio 12.0\\VC\\atlmfc\\include\" -I\"C:\\Program
Files (x86)\\Windows Kits\\8.1\\Include\\um\" -I\"C:\\Program Files
(x86)\\Windows Kits\\8.1\\Include\\shared\" -I\"C:\\Program Files
(x86)\\Windows Kits\\8.1\\Include\\winrt\" -I\"C:\\Program Files
(x86)\\Microsoft Visual Studio 12.0\\VC\\include\" -I\"C:\\Program Files
(x86)\\Microsoft Visual Studio 12.0\\VC\\atlmfc\\include\" -I\"C:\\Program
Files (x86)\\Windows Kits\\8.1\\Include\\um\" -I\"C:\\Program Files
(x86)\\Windows Kits\\8.1\\Include\\shared\" -I\"C:\\Program Files
(x86)\\Windows Kits\\8.1\\Include\\winrt\" -DWIN32 -D_WINDOWS -D_DEBUG
-DCMAKE_INTDIR=\"Debug\" ..\\src\\main.cpp",
"file" : "..\\src\\main.cpp"
},
]
This gives me an output of "Error while processing
D:\\CMakeTest\\bld\\..\\src\\main.cpp."
When I use the following database with "D:\\CMakeTest\\src\\main.cpp" as
the file to open, everything works.
[
{
"directory": "D:\\CMakeTest\\src\\",
"command" : "D:/llvm/build/Debug/bin/clang.exe -I\"C:\\Program Files
(x86)\\Microsoft Visual Studio 12.0\\VC\\include\" -I\"C:\\Program Files
(x86)\\Microsoft Visual Studio 12.0\\VC\\atlmfc\\include\" -I\"C:\\Program
Files (x86)\\Windows Kits\\8.1\\Include\\um\" -I\"C:\\Program Files
(x86)\\Windows Kits\\8.1\\Include\\shared\" -I\"C:\\Program Files
(x86)\\Windows Kits\\8.1\\Include\\winrt\" -I\"C:\\Program Files
(x86)\\Microsoft Visual Studio 12.0\\VC\\include\" -I\"C:\\Program Files
(x86)\\Microsoft Visual Studio 12.0\\VC\\atlmfc\\include\" -I\"C:\\Program
Files (x86)\\Windows Kits\\8.1\\Include\\um\" -I\"C:\\Program Files
(x86)\\Windows Kits\\8.1\\Include\\shared\" -I\"C:\\Program Files
(x86)\\Windows Kits\\8.1\\Include\\winrt\" -DWIN32 -D_WINDOWS -D_DEBUG
-DCMAKE_INTDIR=\"Debug\" main.cpp",
"file" : "main.cpp"
},
]
Is there something that I am doing wrong? The only changes between the two
compilation databases are the directory and file entries. Both should
refer to the same absolute path.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150316/816bee2d/attachment.html>
More information about the cfe-dev
mailing list