Skip to content

Commit 40d3f39

Browse files
MatzeBfacebook-github-bot
authored andcommitted
Adjust object-introspection to llvm-18 API changes (#506)
Summary: Pull Request resolved: #506 LLVM-18 changed the `CompilerInvocation` APIs to return references instead of pointers... Reviewed By: JakeHillion Differential Revision: D61548431
1 parent fe9b4b2 commit 40d3f39

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

oi/OICompiler.cpp

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -511,22 +511,29 @@ bool OICompiler::compile(const std::string& code,
511511
*/
512512
auto compInv = std::make_shared<CompilerInvocation>();
513513

514-
compInv->getLangOpts()->CPlusPlus = true;
515-
compInv->getLangOpts()->CPlusPlus11 = true;
516-
compInv->getLangOpts()->CPlusPlus14 = true;
517-
compInv->getLangOpts()->CPlusPlus17 = true;
518-
compInv->getLangOpts()->CPlusPlus20 = true;
514+
LangOptions& langOpts =
515+
#if LLVM_VERSION_MAJOR < 18
516+
*compInv->getLangOpts();
517+
#else
518+
compInv->getLangOpts();
519+
#endif
520+
521+
langOpts.CPlusPlus = true;
522+
langOpts.CPlusPlus11 = true;
523+
langOpts.CPlusPlus14 = true;
524+
langOpts.CPlusPlus17 = true;
525+
langOpts.CPlusPlus20 = true;
519526
// Required for various `__GCC_ATOMIC_*` macros to be defined
520-
compInv->getLangOpts()->GNUCVersion = 11 * 100 * 100; // 11.0.0
521-
compInv->getLangOpts()->Bool = true;
522-
compInv->getLangOpts()->WChar = true;
523-
compInv->getLangOpts()->Char8 = true;
524-
compInv->getLangOpts()->CXXOperatorNames = true;
525-
compInv->getLangOpts()->DoubleSquareBracketAttributes = true;
526-
compInv->getLangOpts()->Exceptions = true;
527-
compInv->getLangOpts()->CXXExceptions = true;
528-
compInv->getLangOpts()->Coroutines = true;
529-
compInv->getLangOpts()->AlignedAllocation = true;
527+
langOpts.GNUCVersion = 11 * 100 * 100; // 11.0.0
528+
langOpts.Bool = true;
529+
langOpts.WChar = true;
530+
langOpts.Char8 = true;
531+
langOpts.CXXOperatorNames = true;
532+
langOpts.DoubleSquareBracketAttributes = true;
533+
langOpts.Exceptions = true;
534+
langOpts.CXXExceptions = true;
535+
langOpts.Coroutines = true;
536+
langOpts.AlignedAllocation = true;
530537

531538
compInv->getPreprocessorOpts();
532539
compInv->getPreprocessorOpts().addRemappedFile(

0 commit comments

Comments
 (0)