@@ -362,6 +362,7 @@ ClangExpressionParser::ClangExpressionParser(ExecutionContextScope *exe_scope,
362
362
363
363
// 5. Set language options.
364
364
lldb::LanguageType language = expr.Language ();
365
+ LangOptions &lang_opts = m_compiler->getLangOpts ();
365
366
366
367
switch (language) {
367
368
case lldb::eLanguageTypeC:
@@ -373,85 +374,81 @@ ClangExpressionParser::ClangExpressionParser(ExecutionContextScope *exe_scope,
373
374
// For now, the expression parser must use C++ anytime the language is a C
374
375
// family language, because the expression parser uses features of C++ to
375
376
// capture values.
376
- m_compiler-> getLangOpts () .CPlusPlus = true ;
377
+ lang_opts .CPlusPlus = true ;
377
378
break ;
378
379
case lldb::eLanguageTypeObjC:
379
- m_compiler-> getLangOpts () .ObjC = true ;
380
+ lang_opts .ObjC = true ;
380
381
// FIXME: the following language option is a temporary workaround,
381
382
// to "ask for ObjC, get ObjC++" (see comment above).
382
- m_compiler-> getLangOpts () .CPlusPlus = true ;
383
+ lang_opts .CPlusPlus = true ;
383
384
384
385
// Clang now sets as default C++14 as the default standard (with
385
386
// GNU extensions), so we do the same here to avoid mismatches that
386
387
// cause compiler error when evaluating expressions (e.g. nullptr not found
387
388
// as it's a C++11 feature). Currently lldb evaluates C++14 as C++11 (see
388
389
// two lines below) so we decide to be consistent with that, but this could
389
390
// be re-evaluated in the future.
390
- m_compiler-> getLangOpts () .CPlusPlus11 = true ;
391
+ lang_opts .CPlusPlus11 = true ;
391
392
break ;
392
393
case lldb::eLanguageTypeC_plus_plus:
393
394
case lldb::eLanguageTypeC_plus_plus_11:
394
395
case lldb::eLanguageTypeC_plus_plus_14:
395
- m_compiler-> getLangOpts () .CPlusPlus11 = true ;
396
+ lang_opts .CPlusPlus11 = true ;
396
397
m_compiler->getHeaderSearchOpts ().UseLibcxx = true ;
397
398
LLVM_FALLTHROUGH;
398
399
case lldb::eLanguageTypeC_plus_plus_03:
399
- m_compiler-> getLangOpts () .CPlusPlus = true ;
400
+ lang_opts .CPlusPlus = true ;
400
401
if (process_sp)
401
- m_compiler-> getLangOpts () .ObjC =
402
+ lang_opts .ObjC =
402
403
process_sp->GetLanguageRuntime (lldb::eLanguageTypeObjC) != nullptr ;
403
404
break ;
404
405
case lldb::eLanguageTypeObjC_plus_plus:
405
406
case lldb::eLanguageTypeUnknown:
406
407
default :
407
- m_compiler-> getLangOpts () .ObjC = true ;
408
- m_compiler-> getLangOpts () .CPlusPlus = true ;
409
- m_compiler-> getLangOpts () .CPlusPlus11 = true ;
408
+ lang_opts .ObjC = true ;
409
+ lang_opts .CPlusPlus = true ;
410
+ lang_opts .CPlusPlus11 = true ;
410
411
m_compiler->getHeaderSearchOpts ().UseLibcxx = true ;
411
412
break ;
412
413
}
413
414
414
- m_compiler-> getLangOpts () .Bool = true ;
415
- m_compiler-> getLangOpts () .WChar = true ;
416
- m_compiler-> getLangOpts () .Blocks = true ;
417
- m_compiler-> getLangOpts () .DebuggerSupport =
415
+ lang_opts .Bool = true ;
416
+ lang_opts .WChar = true ;
417
+ lang_opts .Blocks = true ;
418
+ lang_opts .DebuggerSupport =
418
419
true ; // Features specifically for debugger clients
419
420
if (expr.DesiredResultType () == Expression::eResultTypeId)
420
- m_compiler-> getLangOpts () .DebuggerCastResultToId = true ;
421
+ lang_opts .DebuggerCastResultToId = true ;
421
422
422
- m_compiler->getLangOpts ().CharIsSigned =
423
- ArchSpec (m_compiler->getTargetOpts ().Triple .c_str ())
424
- .CharIsSignedByDefault ();
423
+ lang_opts.CharIsSigned = ArchSpec (m_compiler->getTargetOpts ().Triple .c_str ())
424
+ .CharIsSignedByDefault ();
425
425
426
426
// Spell checking is a nice feature, but it ends up completing a lot of types
427
427
// that we didn't strictly speaking need to complete. As a result, we spend a
428
428
// long time parsing and importing debug information.
429
- m_compiler-> getLangOpts () .SpellChecking = false ;
429
+ lang_opts .SpellChecking = false ;
430
430
431
- if (process_sp && m_compiler-> getLangOpts () .ObjC ) {
431
+ if (process_sp && lang_opts .ObjC ) {
432
432
if (process_sp->GetObjCLanguageRuntime ()) {
433
433
if (process_sp->GetObjCLanguageRuntime ()->GetRuntimeVersion () ==
434
434
ObjCLanguageRuntime::ObjCRuntimeVersions::eAppleObjC_V2)
435
- m_compiler->getLangOpts ().ObjCRuntime .set (ObjCRuntime::MacOSX,
436
- VersionTuple (10 , 7 ));
435
+ lang_opts.ObjCRuntime .set (ObjCRuntime::MacOSX, VersionTuple (10 , 7 ));
437
436
else
438
- m_compiler-> getLangOpts () .ObjCRuntime .set (ObjCRuntime::FragileMacOSX,
439
- VersionTuple (10 , 7 ));
437
+ lang_opts .ObjCRuntime .set (ObjCRuntime::FragileMacOSX,
438
+ VersionTuple (10 , 7 ));
440
439
441
440
if (process_sp->GetObjCLanguageRuntime ()->HasNewLiteralsAndIndexing ())
442
- m_compiler-> getLangOpts () .DebuggerObjCLiteral = true ;
441
+ lang_opts .DebuggerObjCLiteral = true ;
443
442
}
444
443
}
445
444
446
- m_compiler->getLangOpts ().ThreadsafeStatics = false ;
447
- m_compiler->getLangOpts ().AccessControl =
448
- false ; // Debuggers get universal access
449
- m_compiler->getLangOpts ().DollarIdents =
450
- true ; // $ indicates a persistent variable name
445
+ lang_opts.ThreadsafeStatics = false ;
446
+ lang_opts.AccessControl = false ; // Debuggers get universal access
447
+ lang_opts.DollarIdents = true ; // $ indicates a persistent variable name
451
448
// We enable all builtin functions beside the builtins from libc/libm (e.g.
452
449
// 'fopen'). Those libc functions are already correctly handled by LLDB, and
453
450
// additionally enabling them as expandable builtins is breaking Clang.
454
- m_compiler-> getLangOpts () .NoBuiltin = true ;
451
+ lang_opts .NoBuiltin = true ;
455
452
456
453
// Set CodeGen options
457
454
m_compiler->getCodeGenOpts ().EmitDeclMetadata = true ;
0 commit comments