GoddamnIDontNeedAUse

Untitled

Sep 20th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. 1438 if (const Arg *A = Args.getLastArg(OPT_x)) {
  2. 1439 StringRef XValue = A->getValue();
  3. 1440
  4. 1441 // Parse suffixes: '<lang>(-header|[-module-map][-cpp-output])'.
  5. 1442 // FIXME: Supporting '<lang>-header-cpp-output' would be useful.
  6. 1443 bool Preprocessed = XValue.consume_back("-cpp-output");
  7. 1444 bool ModuleMap = XValue.consume_back("-module-map");
  8. 1445 IsHeaderFile =
  9. 1446 !Preprocessed && !ModuleMap && XValue.consume_back("-header");
  10. 1447
  11. 1448 // Principal languages.
  12. 1449 DashX = llvm::StringSwitch<InputKind>(XValue)
  13. 1450 .Case("c", InputKind::C)
  14. 1451 .Case("cl", InputKind::OpenCL)
  15. 1452 .Case("cuda", InputKind::CUDA)
  16. 1453 .Case("c++", InputKind::CXX)
  17. 1454 .Case("objective-c", InputKind::ObjC)
  18. 1455 .Case("objective-c++", InputKind::ObjCXX)
  19. 1456 .Case("renderscript", InputKind::RenderScript)
  20. 1457 .Default(InputKind::Unknown);
  21. 1458
  22. 1459 // "objc[++]-cpp-output" is an acceptable synonym for
  23. 1460 // "objective-c[++]-cpp-output".
  24. 1461 if (DashX.isUnknown() && Preprocessed && !IsHeaderFile && !ModuleMap)
  25. 1462 DashX = llvm::StringSwitch<InputKind>(XValue)
  26. 1463 .Case("objc", InputKind::ObjC)
  27. 1464 .Case("objc++", InputKind::ObjCXX)
  28. 1465 .Default(InputKind::Unknown);
  29. 1466
  30. 1467 // Some special cases cannot be combined with suffixes.
  31. 1468 if (DashX.isUnknown() && !Preprocessed && !ModuleMap && !IsHeaderFile)
  32. 1469 DashX = llvm::StringSwitch<InputKind>(XValue)
  33. 1470 .Case("cpp-output", InputKind(InputKind::C).getPreprocessed())
  34. 1471 .Case("assembler-with-cpp", InputKind::Asm)
  35. 1472 .Cases("ast", "pcm",
  36. 1473 InputKind(InputKind::Unknown, InputKind::Precompiled))
  37. 1474 .Case("ir", InputKind::LLVM_IR)
  38. 1475 .Default(InputKind::Unknown);
  39. 1476
  40. 1477 if (DashX.isUnknown())
  41. 1478 Diags.Report(diag::err_drv_invalid_value)
  42. 1479 << A->getAsString(Args) << A->getValue();
  43. 1480
  44. 1481 if (Preprocessed)
  45. 1482 DashX = DashX.getPreprocessed();
  46. 1483 if (ModuleMap)
  47. 1484 DashX = DashX.withFormat(InputKind::ModuleMap);
  48. 1485 }
Add Comment
Please, Sign In to add comment