Fix C++ reflection so that -p works.
The C++ reflection code was missing support for the -p option, which allows
the developer to place the .cpp/.h files into a different directory than the
bitcode. It was also missing directory creation (and path separators) for that
option.
Change-Id: I5b16a6d109c6df8ca3e1542e0c5345691037bf85
diff --git a/llvm-rs-cc.cpp b/llvm-rs-cc.cpp
index e2c9599..1736c0b 100644
--- a/llvm-rs-cc.cpp
+++ b/llvm-rs-cc.cpp
@@ -291,10 +291,11 @@
if (Args->hasArg(OPT_reflect_cpp)) {
Opts.mBitcodeStorage = slang::BCST_CPP_CODE;
- // mJavaReflectionPathBase isn't set for C++ reflected builds
- // set it to mOutputDir so we can use the path sanely from
- // RSReflectionBase later on
- Opts.mJavaReflectionPathBase = Opts.mOutputDir;
+ // mJavaReflectionPathBase can be set for C++ reflected builds.
+ // Set it to the standard mOutputDir (via -o) by default.
+ if (Opts.mJavaReflectionPathBase.empty()) {
+ Opts.mJavaReflectionPathBase = Opts.mOutputDir;
+ }
}
Opts.mOutputDepDir =