@@ -511,22 +511,29 @@ bool OICompiler::compile(const std::string& code,
511
511
*/
512
512
auto compInv = std::make_shared<CompilerInvocation>();
513
513
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 ;
519
526
// 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 ;
530
537
531
538
compInv->getPreprocessorOpts ();
532
539
compInv->getPreprocessorOpts ().addRemappedFile (
0 commit comments