Skip to content

Commit

Permalink
Adjust object-introspection to llvm-18 API changes (#506)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #506

LLVM-18 changed the `CompilerInvocation` APIs to return references instead of pointers...

Reviewed By: JakeHillion

Differential Revision: D61548431
  • Loading branch information
MatzeB authored and facebook-github-bot committed Aug 20, 2024
1 parent fe9b4b2 commit 40d3f39
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions oi/OICompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,22 +511,29 @@ bool OICompiler::compile(const std::string& code,
*/
auto compInv = std::make_shared<CompilerInvocation>();

compInv->getLangOpts()->CPlusPlus = true;
compInv->getLangOpts()->CPlusPlus11 = true;
compInv->getLangOpts()->CPlusPlus14 = true;
compInv->getLangOpts()->CPlusPlus17 = true;
compInv->getLangOpts()->CPlusPlus20 = true;
LangOptions& langOpts =
#if LLVM_VERSION_MAJOR < 18
*compInv->getLangOpts();
#else
compInv->getLangOpts();
#endif

langOpts.CPlusPlus = true;
langOpts.CPlusPlus11 = true;
langOpts.CPlusPlus14 = true;
langOpts.CPlusPlus17 = true;
langOpts.CPlusPlus20 = true;
// Required for various `__GCC_ATOMIC_*` macros to be defined
compInv->getLangOpts()->GNUCVersion = 11 * 100 * 100; // 11.0.0
compInv->getLangOpts()->Bool = true;
compInv->getLangOpts()->WChar = true;
compInv->getLangOpts()->Char8 = true;
compInv->getLangOpts()->CXXOperatorNames = true;
compInv->getLangOpts()->DoubleSquareBracketAttributes = true;
compInv->getLangOpts()->Exceptions = true;
compInv->getLangOpts()->CXXExceptions = true;
compInv->getLangOpts()->Coroutines = true;
compInv->getLangOpts()->AlignedAllocation = true;
langOpts.GNUCVersion = 11 * 100 * 100; // 11.0.0
langOpts.Bool = true;
langOpts.WChar = true;
langOpts.Char8 = true;
langOpts.CXXOperatorNames = true;
langOpts.DoubleSquareBracketAttributes = true;
langOpts.Exceptions = true;
langOpts.CXXExceptions = true;
langOpts.Coroutines = true;
langOpts.AlignedAllocation = true;

compInv->getPreprocessorOpts();
compInv->getPreprocessorOpts().addRemappedFile(
Expand Down

0 comments on commit 40d3f39

Please sign in to comment.