Can't mix different kinds of loc in createM3FromCppFile
Clair version: 0.6.5 Rascal version: 0.28.3 OS: Ubuntu 22.10 aarch64 Java version: openjdk 17.0.6 2023-01-17
While playing with the createM3FromCppFile function, I and others have noticed that you cannot have different kinds of locations inside the functions: for example if I use a home loc for the source file path, I will not be able to use a file one for the standard library location.
This problem was obtained by running the function with the following arguments:
createM3FromCppFile(|home:///rps-cpp/main.cpp|,stdLib=standardLib, includeDirs=[|home:///rps-cpp|]);
Note that standardLib is a list of locS, that contains multiple file loc, defined as follows:
public list[loc] standardLib = [
|file:///usr/include/c++/12|,
|file:///usr/include/aarch64-linux-gnu/c++/12|,
|file:///usr/include/c++/12/backward|,
|file:///usr/lib/gcc/aarch64-linux-gnu/12/include|,
|file:///usr/local/include|,
|file:///usr/include|
];
By running the function as written I get this error output:
|lib://clair/src/lang/cpp/M3.rsc|(9212,225,<161,0>,<162,188>): Java("IllegalArgumentException","Will not convert non-file loc")
at lang.cpp.internal.CDTParser.locToPath(|unknown:///CDTParser.java|(0,0,<201,0>,<201,0>))
at lang.cpp.internal.CDTParser.lambda$new$1(|unknown:///CDTParser.java|(0,0,<148,0>,<148,0>))
at java.util.Iterator.forEachRemaining(|unknown:///Iterator.java|(0,0,<133,0>,<133,0>))
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(|unknown:///Spliterators.java|(0,0,<1845,0>,<1845,0>))
at java.util.stream.ReferencePipeline$Head.forEach(|unknown:///ReferencePipeline.java|(0,0,<762,0>,<762,0>))
at lang.cpp.internal.CDTParser.<init>(|unknown:///CDTParser.java|(0,0,<148,0>,<148,0>))
at lang.cpp.internal.Parser.parseCppToM3AndAst(|unknown:///Parser.java|(0,0,<411,0>,<411,0>))
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(|unknown:///NativeMethodAccessorImpl.java|(0,0,<0,0>,<0,0>))
at parseCppToM3AndAst(|lib://clair/src/lang/cpp/M3.rsc|(8284,13,<147,157>,<147,170>))
at $shell$(|prompt:///|(0,100,<1,0>,<1,100>)WARNING: ResourcesPlugin was null, can't get workspace; not overriding include files
ok
If I run the same command by using a file loc, both for the file argument and includeDir, this problem doesn't appear.