Run InitializePreprocessor() to ensure that all macros are set up properly.
Without this, we don't end up defining things like __LP64__ for 64-bit
compilation targets.
Change-Id: I11e11bde3498089056e7a70903c8d47d1030e01a
diff --git a/slang.cpp b/slang.cpp
index 218efd1..dcb0aad 100644
--- a/slang.cpp
+++ b/slang.cpp
@@ -36,6 +36,7 @@
#include "clang/Frontend/CodeGenOptions.h"
#include "clang/Frontend/DependencyOutputOptions.h"
#include "clang/Frontend/FrontendDiagnostic.h"
+#include "clang/Frontend/FrontendOptions.h"
#include "clang/Frontend/TextDiagnosticPrinter.h"
#include "clang/Frontend/Utils.h"
@@ -223,6 +224,9 @@
/* OwnsHeaderSearch = */true));
// Initialize the preprocessor
mPP->Initialize(getTargetInfo());
+ clang::FrontendOptions FEOpts;
+ clang::InitializePreprocessor(*mPP, *PPOpts, *HSOpts, FEOpts);
+
mPragmas.clear();
mPP->AddPragmaHandler(new PragmaRecorder(&mPragmas));
diff --git a/slang_rs.cpp b/slang_rs.cpp
index 5a30de3..277516d 100644
--- a/slang_rs.cpp
+++ b/slang_rs.cpp
@@ -210,6 +210,7 @@
clang::Preprocessor &PP = getPreprocessor();
std::stringstream RSH;
+ RSH << PP.getPredefines();
RSH << "#define RS_VERSION " << mTargetAPI << "\n";
RSH << "#include \"rs_core." RS_HEADER_SUFFIX "\"\n";
PP.setPredefines(RSH.str());