clang: lib/Frontend/FrontendAction.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

42#include "llvm/ADT/ScopeExit.h"

43#include "llvm/ADT/SmallPtrSet.h"

44#include "llvm/ADT/StringRef.h"

45#include "llvm/Support/BuryPointer.h"

46#include "llvm/Support/ErrorHandling.h"

47#include "llvm/Support/FileSystem.h"

48#include "llvm/Support/Path.h"

49#include "llvm/Support/Timer.h"

50#include "llvm/Support/raw_ostream.h"

51#include

52#include <system_error>

53using namespace clang;

54

56

57namespace {

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72class DeserializedDeclsSourceRangePrinter : public ASTConsumer,

74public:

75 explicit DeserializedDeclsSourceRangePrinter(

76 SourceManager &SM, std::unique_ptrllvm::raw\_fd\_ostream OS)

77 : ASTDeserializationListener(), SM(SM), OS(std::move(OS)) {}

78

79 ASTDeserializationListener *GetASTDeserializationListener() override {

80 return this;

81 }

82

83 void DeclRead(GlobalDeclID ID, const Decl *D) override {

84 if (!IsCollectingDecls)

85 return;

88

89

90 return;

91 }

93

94 return;

95 }

97 if (!DC || !shouldIncludeDeclsIn(DC))

98 return;

99

100 PendingDecls.push_back(D);

102 ProcessedDeclContexts.insert(DC).second;

103 DC = DC->getLexicalParent()) {

104

105

106

107

108 PendingDecls.push_back(cast(DC));

109 }

110 }

111

112 struct Position {

113 unsigned Line;

114 unsigned Column;

115

116 bool operator<(const Position &other) const {

117 return std::tie(Line, Column) < std::tie(other.Line, other.Column);

118 }

119

120 static Position GetBeginSpelling(const SourceManager &SM,

121 const CharSourceRange &R) {

122 SourceLocation Begin = R.getBegin();

123 return {SM.getSpellingLineNumber(Begin),

124 SM.getSpellingColumnNumber(Begin)};

125 }

126

127 static Position GetEndSpelling(const SourceManager &SM,

128 const CharSourceRange &Range,

129 const LangOptions &LangOpts) {

130

132 SourceLocation End = R.getEnd();

133

134

135 Token PossiblySemi;

137 if (PossiblySemi.is(tok::semi))

139

140 return {SM.getSpellingLineNumber(End), SM.getSpellingColumnNumber(End)};

141 }

142 };

143

144 struct RequiredRanges {

145 StringRef Filename;

146 std::vector<std::pair<Position, Position>> FromTo;

147 };

148 void HandleTranslationUnit(ASTContext &Context) override {

149 assert(IsCollectingDecls && "HandleTranslationUnit called twice?");

150 IsCollectingDecls = false;

151

152

153 struct FileData {

154 std::vector<std::pair<Position, Position>> FromTo;

156 };

157 llvm::DenseMap<const FileEntry *, FileData> FileToRanges;

158

159 for (const Decl *D : PendingDecls) {

160 for (CharSourceRange R : getRangesToMark(D)) {

162 continue;

163

164 auto *F = SM.getFileEntryForID(SM.getFileID(R.getBegin()));

165 if (F != SM.getFileEntryForID(SM.getFileID(R.getEnd()))) {

166

167 continue;

168 }

169

170 auto &Data = FileToRanges[F];

171 if (Data.Ref)

172 Data.Ref = SM.getFileEntryRefForID(SM.getFileID(R.getBegin()));

173 Data.FromTo.push_back(

174 {Position::GetBeginSpelling(SM, R),

175 Position::GetEndSpelling(SM, R, D->getLangOpts())});

176 }

177 }

178

179

180 std::vector Result;

181 for (auto &[F, Data] : FileToRanges) {

182 auto &FromTo = Data.FromTo;

183 assert(!FromTo.empty());

184

185 if (Data.Ref)

186 continue;

187

188 llvm::sort(FromTo);

189

190 std::vector<std::pair<Position, Position>> MergedRanges;

191 MergedRanges.push_back(FromTo.front());

192 for (auto It = FromTo.begin() + 1; It < FromTo.end(); ++It) {

193 if (MergedRanges.back().second < It->first) {

194 MergedRanges.push_back(*It);

195 continue;

196 }

197 if (MergedRanges.back().second < It->second)

198 MergedRanges.back().second = It->second;

199 }

200 Result.push_back({Data.Ref->getName(), std::move(MergedRanges)});

201 }

203 }

204

205private:

206 std::vector<const Decl *> PendingDecls;

207 llvm::SmallPtrSet<const DeclContext *, 0> ProcessedDeclContexts;

208 bool IsCollectingDecls = true;

209 const SourceManager &SM;

210 std::unique_ptrllvm::raw\_ostream OS;

211

212 static bool shouldIncludeDeclsIn(const DeclContext *DC) {

213 assert(DC && "DC is null");

214

215

216

217

220 return true;

222 continue;

223 return false;

224 }

225 llvm_unreachable("DeclContext chain must end with a translation unit");

226 }

227

228 llvm::SmallVector<CharSourceRange, 2> getRangesToMark(const Decl *D) {

229 if (auto *ED = dyn_cast(D)) {

230 if (!ED->hasBraces())

231 return {SM.getExpansionRange(ED->getExportLoc())};

232

233 return {SM.getExpansionRange(SourceRange(

234 ED->getExportLoc(),

235 lexForLBrace(ED->getExportLoc(), D->getLangOpts()))),

236 SM.getExpansionRange(ED->getRBraceLoc())};

237 }

238

239 auto *NS = dyn_cast(D);

240 if (!NS)

242

243 SourceLocation LBraceLoc;

244 if (NS->isAnonymousNamespace()) {

245 LBraceLoc = NS->getLocation();

246 } else {

247

248 SourceLocation TokenBeforeLBrace = NS->getLocation();

249 if (NS->hasAttrs()) {

250 for (auto *A : NS->getAttrs()) {

251

252 if (SM.isBeforeInTranslationUnit(TokenBeforeLBrace,

253 A->getRange().getEnd())) {

254

255

256 return {};

257 }

258 }

259 }

260 LBraceLoc = lexForLBrace(TokenBeforeLBrace, D->getLangOpts());

261 }

262 return {SM.getExpansionRange(SourceRange(NS->getBeginLoc(), LBraceLoc)),

263 SM.getExpansionRange(NS->getRBraceLoc())};

264 }

265

266 void printJson(llvm::ArrayRef Result) {

267 *OS << "{\n";

268 *OS << R"( "required_ranges": [)" << "\n";

269 for (size_t I = 0; I < Result.size(); ++I) {

270 auto &F = Result[I].Filename;

271 auto &MergedRanges = Result[I].FromTo;

272 *OS << R"( {)" << "\n";

273 *OS << R"( "file": ")" << F << "\"," << "\n";

274 *OS << R"( "range": [)" << "\n";

275 for (size_t J = 0; J < MergedRanges.size(); ++J) {

276 auto &From = MergedRanges[J].first;

277 auto &To = MergedRanges[J].second;

278 *OS << R"( {)" << "\n";

279 *OS << R"( "from": {)" << "\n";

280 *OS << R"( "line": )" << From.Line << ",\n";

281 *OS << R"( "column": )" << From.Column << "\n"

282 << R"( },)" << "\n";

283 *OS << R"( "to": {)" << "\n";

284 *OS << R"( "line": )" << To.Line << ",\n";

285 *OS << R"( "column": )" << To.Column << "\n"

286 << R"( })" << "\n";

287 *OS << R"( })";

288 if (J < MergedRanges.size() - 1) {

289 *OS << ",";

290 }

291 *OS << "\n";

292 }

293 *OS << " ]" << "\n" << " }";

294 if (I < Result.size() - 1)

295 *OS << ",";

296 *OS << "\n";

297 }

298 *OS << " ]\n";

299 *OS << "}\n";

300

301 OS->flush();

302 }

303

304 SourceLocation lexForLBrace(SourceLocation TokenBeforeLBrace,

305 const LangOptions &LangOpts) {

306

307 Token Tok;

311

312

313 return SourceLocation();

314 }

316 }

317};

318

319

321public:

322 explicit DeserializedDeclsDumper(ASTDeserializationListener *Previous,

323 bool DeletePrevious)

324 : DelegatingDeserializationListener(Previous, DeletePrevious) {}

325

326 void DeclRead(GlobalDeclID ID, const Decl *D) override {

328 if (const NamedDecl *ND = dyn_cast(D)) {

329 llvm::outs() << " - ";

330 ND->printQualifiedName(llvm::outs());

331 }

332 llvm::outs() << "\n";

333

335 }

336};

337

338

339

341 ASTContext &Ctx;

342 std::setstd::string NamesToCheck;

343

344public:

345 DeserializedDeclsChecker(ASTContext &Ctx,

346 const std::setstd::string &NamesToCheck,

347 ASTDeserializationListener *Previous,

348 bool DeletePrevious)

349 : DelegatingDeserializationListener(Previous, DeletePrevious), Ctx(Ctx),

350 NamesToCheck(NamesToCheck) {}

351

352 void DeclRead(GlobalDeclID ID, const Decl *D) override {

353 if (const NamedDecl *ND = dyn_cast(D))

354 if (NamesToCheck.find(ND->getNameAsString()) != NamesToCheck.end()) {

355 unsigned DiagID

357 "%0 was deserialized");

358 Ctx.getDiagnostics().Report(Ctx.getFullLoc(D->getLocation()), DiagID)

359 << ND;

360 }

361

363 }

364};

365

366}

367

369

371

373 std::unique_ptr AST) {

374 this->CurrentInput = CurrentInput;

375 CurrentASTUnit = std::move(AST);

376}

377

383

384std::unique_ptr

385FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI,

386 StringRef InFile) {

387 std::unique_ptr Consumer = CreateASTConsumer(CI, InFile);

388 if (!Consumer)

389 return nullptr;

390

391 std::vector<std::unique_ptr> Consumers;

392 llvm::StringRef DumpDeserializedDeclarationRangesPath =

394 if (!DumpDeserializedDeclarationRangesPath.empty()) {

395 std::error_code ErrorCode;

396 auto FileStream = std::make_uniquellvm::raw\_fd\_ostream(

397 DumpDeserializedDeclarationRangesPath, ErrorCode,

398 llvm::sys::fs::OF_TextWithCRLF);

399 if (!ErrorCode) {

400 Consumers.push_back(std::make_unique(

402 } else {

403 llvm::errs() << "Failed to create output file for "

404 "-dump-minimization-hints flag, file path: "

405 << DumpDeserializedDeclarationRangesPath

406 << ", error: " << ErrorCode.message() << "\n";

407 }

408 }

409

410

411 bool FoundAllPlugins = true;

413 bool Found = false;

414 for (const FrontendPluginRegistry::entry &Plugin :

415 FrontendPluginRegistry::entries()) {

416 if (Plugin.getName() == Arg)

418 }

421 FoundAllPlugins = false;

422 }

423 }

424 if (!FoundAllPlugins)

425 return nullptr;

426

427

429 return Consumer;

430

431

432

433 std::vector<std::unique_ptr> AfterConsumers;

434 for (const FrontendPluginRegistry::entry &Plugin :

435 FrontendPluginRegistry::entries()) {

436 std::unique_ptr P = Plugin.instantiate();

440

441

443 Plugin.getName())) {

446 else

448 }

449 }

452 P->ParseArgs(

453 CI,

455 std::unique_ptr PluginConsumer = P->CreateASTConsumer(CI, InFile);

457 Consumers.push_back(std::move(PluginConsumer));

458 } else {

459 AfterConsumers.push_back(std::move(PluginConsumer));

460 }

461 }

462 }

463

464

465 Consumers.push_back(std::move(Consumer));

466 if (!AfterConsumers.empty()) {

467

468

469

471 for (auto &C : AfterConsumers)

472 Consumers.push_back(std::move(C));

473 }

474

475 assert(Consumers.size() >= 1 && "should have added the main consumer");

476 if (Consumers.size() == 1)

477 return std::move(Consumers.front());

478 return std::make_unique(std::move(Consumers));

479}

480

481

482

483

484

485

486

487

488

489

491 std::string &InputFile,

492 bool IsModuleMap = false) {

495

496 auto MainFileBuf = SourceMgr.getBufferOrNone(MainFileID);

497 if (!MainFileBuf)

499

500 std::unique_ptr RawLexer(

501 new Lexer(MainFileID, *MainFileBuf, SourceMgr, CI.getLangOpts()));

502

503

504

505

506

507

509 if (RawLexer->LexFromRawLexer(T) || T.getKind() != tok::hash)

511 if (RawLexer->LexFromRawLexer(T) || T.isAtStartOfLine() ||

512 T.getKind() != tok::numeric_constant)

514

515 unsigned LineNo;

517 if (IsModuleMap) {

520 .getAsInteger(10, LineNo))

522 }

523

524 RawLexer->LexFromRawLexer(T);

525 if (T.isAtStartOfLine() || T.getKind() != tok::string_literal)

527

529 if (Literal.hadError)

531 RawLexer->LexFromRawLexer(T);

532 if (T.isNot(tok::eof) && T.isAtStartOfLine())

534 InputFile = Literal.GetString().str();

535

536 if (IsModuleMap)

538 LineNoLoc, LineNo, SourceMgr.getLineTableFilenameID(InputFile), false,

540

541 return T.getLocation();

542}

543

546 Includes.append(RHS.begin(), RHS.end());

547 return Includes;

548}

549

553 bool IsExternC) {

554 if (IsExternC && LangOpts.CPlusPlus)

555 Includes += "extern \"C\" {\n";

556 if (LangOpts.ObjC)

557 Includes += "#import \"";

558 else

559 Includes += "#include \"";

560

561 Includes += HeaderName;

562

563 Includes += "\"\n";

564 if (IsExternC && LangOpts.CPlusPlus)

565 Includes += "}\n";

566}

567

568

569

570

571

572

573

574

578

580 return std::error_code();

581

582

584

585

586

587

588

589

592 Diag.Report(MissingHeader.FileNameLoc, diag::err_module_header_missing)

593 << MissingHeader.IsUmbrella << MissingHeader.FileName;

594 return std::error_code();

595 }

596

597

601

602

603

604

605 addHeaderInclude(H.PathRelativeToRootModuleDirectory, Includes, LangOpts,

607 }

608 }

609

610

611 if (std::optionalModule::Header UmbrellaHeader =

615

616 addHeaderInclude(UmbrellaHeader->PathRelativeToRootModuleDirectory,

618 } else if (std::optionalModule::DirectoryName UmbrellaDir =

620

621 std::error_code EC;

623 llvm::sys::path::native(UmbrellaDir->Entry.getName(), DirNative);

624

625 llvm::vfs::FileSystem &FS = FileMgr.getVirtualFileSystem();

627 for (llvm::vfs::recursive_directory_iterator Dir(FS, DirNative, EC), End;

628 Dir != End && !EC; Dir.increment(EC)) {

629

630

631 if (!llvm::StringSwitch(llvm::sys::path::extension(Dir->path()))

632 .Cases({".h", ".H", ".hh", ".hpp"}, true)

633 .Default(false))

634 continue;

635

636

638 auto PathIt = llvm::sys::path::rbegin(Dir->path());

639 for (int I = 0; I != Dir.level() + 1; ++I, ++PathIt)

640 Components.push_back(*PathIt);

642 UmbrellaDir->PathRelativeToRootModuleDirectory);

643 for (auto It = Components.rbegin(), End = Components.rend(); It != End;

644 ++It)

645 llvm::sys::path::append(RelativeHeader, *It);

646

647 HeaderPaths.push_back(

648 std::make_pair(Dir->path().str(), RelativeHeader.c_str()));

649 }

650

651 if (EC)

652 return EC;

653

654

655

656

657

658 llvm::sort(HeaderPaths, llvm::less_first());

659 for (auto &[Path, RelPath] : HeaderPaths) {

660 auto Header = FileMgr.getOptionalFileRef(Path);

661

662

663 if (!Header)

664 continue;

665

666

667

669 continue;

670

671

674 }

675 }

676

677

680 LangOpts, FileMgr, Diag, ModMap, Submodule, Includes))

681 return Err;

682

683 return std::error_code();

684}

685

687 bool IsPreprocessed,

688 std::string &PresumedModuleMapFile,

689 unsigned &Offset) {

692

693

696 assert(ModuleMap && "MainFileID without FileEntry");

697

698

699

700 Offset = 0;

701 if (IsPreprocessed) {

704 if (EndOfLineMarker.isValid())

706 }

707

708

710 PresumedModuleMapFile))

711 return true;

712

713 if (SrcMgr.getBufferOrFake(ModuleMapID).getBufferSize() == Offset)

714 Offset = 0;

715

716

719 llvm::sys::path::append(InferredFrameworkPath,

721 if (auto Dir =

723 (void)HS.getModuleMap().inferFrameworkModule(*Dir, IsSystem, nullptr);

724 }

725

726 return false;

727}

728

730 StringRef ModuleMapFilename) {

733

734

735

736

737

738 return nullptr;

739 }

740

741

744 true);

745 if (!M) {

748

749 return nullptr;

750 }

751

752

755 return nullptr;

756

757

758

760

761

762

763

764

766 if (!OriginalModuleMapName.empty()) {

767 auto OriginalModuleMap =

769 true);

770 if (!OriginalModuleMap) {

772 << OriginalModuleMapName;

773 return nullptr;

774 }

777 auto FileCharacter =

780 *OriginalModuleMap, FileCharacter);

785 }

786 }

787

788

789

790

792 if (SourceMgr.getModuleBuildStack().empty())

795 return M;

796}

797

798

799static std::unique_ptrllvm::MemoryBuffer

802

803

805 std::error_code Err = std::error_code();

806 if (std::optionalModule::Header UmbrellaHeader =

808 addHeaderInclude(UmbrellaHeader->PathRelativeToRootModuleDirectory,

813 HeaderContents);

814

815 if (Err) {

818 return nullptr;

819 }

820

821 return llvm::MemoryBuffer::getMemBufferCopy(

823}

824

828 assert(!Instance && "Already processing a source file!");

829 assert(!Input.isEmpty() && "Unexpected empty filename!");

832

833 bool HasBegunSourceFile = false;

836

837

838

839 auto FailureCleanup = llvm::make_scope_exit([&]() {

840 if (HasBegunSourceFile)

847 });

848

850 return false;

851

852

853

854 if (ReplayASTFile) {

856

857

858 auto ASTDiags = llvm::makeIntrusiveRefCnt(

859 Diags->getDiagnosticIDs(), Diags->getDiagnosticOptions());

860 ASTDiags->setClient(Diags->getClient(), false);

861

862

863 StringRef InputFile = Input.getFile();

864

869 if (!AST)

870 return false;

871

872

873

877

878

879

884

885

886

887

888 if (auto ASTReader = AST->getASTReader()) {

891

893 if (&MF != &PrimaryModule)

895

898 std::string(FE.getName()));

899 });

900 }

901

902

903 auto Kind = AST->getInputKind();

906 AST->getPreprocessor().getHeaderSearchInfo().lookupModule(

908 false);

909 assert(ASTModule && "module file does not define its own module");

911 } else {

912 auto &OldSM = AST->getSourceManager();

913 FileID ID = OldSM.getMainFileID();

914 if (auto File = OldSM.getFileEntryRefForID(ID))

916 else

918 }

920 }

921

922

923

927 "This action does not have AST file support!");

928

930

931

932 StringRef InputFile = Input.getFile();

933

938

939 if (!AST)

940 return false;

941

942

944 HasBegunSourceFile = true;

945

946

947

956

958

959

961 return false;

962

963

964 CI.setASTConsumer(CreateWrappedASTConsumer(CI, InputFile));

966 return false;

967

968 FailureCleanup.release();

969 return true;

970 }

971

972

982 std::make_unique(CI.getSourceManager()));

983 }

984 }

985

986

987

991 else

993 }

996

997

1002 return false;

1003 }

1004

1005

1007 HasBegunSourceFile = true;

1008

1009

1011 return false;

1012

1013

1015 return false;

1016

1017 FailureCleanup.release();

1018 return true;

1019 }

1020

1021

1022

1028 if (auto PCHDir = FileMgr.getOptionalDirectoryRef(PCHInclude)) {

1029 std::error_code EC;

1031 llvm::sys::path::native(PCHDir->getName(), DirNative);

1032 bool Found = false;

1033 llvm::vfs::FileSystem &FS = FileMgr.getVirtualFileSystem();

1034 for (llvm::vfs::directory_iterator Dir = FS.dir_begin(DirNative, EC),

1035 DirEnd;

1036 Dir != DirEnd && !EC; Dir.increment(EC)) {

1037

1043 true)) {

1046 break;

1047 }

1048 }

1049

1052 return false;

1053 }

1054 }

1055 }

1056

1057

1058

1061

1062

1065 HasBegunSourceFile = true;

1066

1067

1068

1069

1070

1077 "trying to build a header unit without a Pre-processor?");

1079

1082 CWD.push_back({std::nullopt, *Dir});

1087 nullptr, nullptr, CWD, nullptr, nullptr, nullptr,

1088 nullptr, nullptr, nullptr);

1089 if (!FE) {

1092 return false;

1093 }

1094

1096

1099 }

1100

1101

1105 }

1106

1108 return false;

1109

1112

1113

1114

1115

1118

1119

1123 }

1124

1125

1126

1129

1130 std::string PresumedModuleMapFile;

1131 unsigned OffsetToContents;

1134 PresumedModuleMapFile, OffsetToContents))

1135 return false;

1136

1138 if (!CurrentModule)

1139 return false;

1140

1141 CurrentModule->PresumedModuleMapFile = PresumedModuleMapFile;

1142

1143 if (OffsetToContents)

1144

1146 else {

1147

1149 if (!Buffer)

1150 return false;

1151

1152

1155 auto BufferID = SourceMgr.createFileID(std::move(Buffer), Kind);

1156 assert(BufferID.isValid() && "couldn't create module buffer ID");

1157 SourceMgr.setMainFileID(BufferID);

1158 }

1159 }

1160

1161

1163 return false;

1164

1165

1169 *File, false);

1170 else

1172 }

1173

1174

1176

1177

1178

1183

1184

1185

1187

1190

1191

1192

1196

1197 std::unique_ptr Consumer =

1198 CreateWrappedASTConsumer(CI, PresumedInputFile);

1199 if (!Consumer)

1200 return false;

1201

1202

1205

1207

1211 if (!source)

1212 return false;

1217

1218 assert(hasPCHSupport() && "This action does not have PCH support!");

1220 Consumer->GetASTDeserializationListener();

1221 bool DeleteDeserialListener = false;

1223 DeserialListener = new DeserializedDeclsDumper(DeserialListener,

1224 DeleteDeserialListener);

1225 DeleteDeserialListener = true;

1226 }

1228 DeserialListener = new DeserializedDeclsChecker(

1231 DeserialListener, DeleteDeserialListener);

1232 DeleteDeserialListener = true;

1233 }

1239 DeserialListener, DeleteDeserialListener);

1241 return false;

1242 }

1243

1244

1245

1249 CI.getASTReader()->setDeserializationListener(DeserialListener,

1250 DeleteDeserialListener);

1251 }

1252 }

1253

1256 return false;

1257 }

1258

1259

1260

1266 } else {

1267

1268

1270 "modules enabled but created an external source that "

1271 "doesn't support modules");

1272 }

1273

1274

1278 return false;

1279

1282 diag::warn_eagerly_load_for_standard_cplusplus_modules);

1283 }

1284

1285

1286

1289 auto Override = llvm::makeIntrusiveRefCnt(

1292 }

1293

1294

1296 auto HLSLSema = llvm::makeIntrusiveRefCnt();

1297 if (auto SemaSource = dyn_cast_if_present(

1299 auto MultiSema = llvm::makeIntrusiveRefCnt(

1300 std::move(SemaSource), std::move(HLSLSema));

1302 } else

1304 }

1305

1306 FailureCleanup.release();

1307 return true;

1308}

1309

1313

1314

1315

1318 StringRef Cache =

1320 if (Cache.empty()) {

1323

1324

1325

1326 consumeError(std::move(Err));

1327 }

1328 }

1329 }

1330

1331 return llvm::Error::success();

1332}

1333

1336

1337

1340

1341

1342

1343

1345

1346

1348

1349

1350

1351

1353 if (DisableFree) {

1357 } else {

1361 }

1362

1369 }

1372 }

1373 llvm::errs() << "\n";

1374 }

1375

1376

1377

1379

1380

1381

1382

1384 if (DisableFree) {

1388 llvm::BuryPointer(std::move(CurrentASTUnit));

1389 } else {

1393 }

1394 }

1395

1399}

1400

1404

1405

1406

1407

1408

1412 return;

1413

1414

1415

1417

1418

1419

1423

1424

1428

1431

1434}

1435

1436void PluginASTAction::anchor() { }

1437

1438std::unique_ptr

1440 StringRef InFile) {

1441 llvm_unreachable("Invalid CreateASTConsumer on preprocessor action!");

1442}

1443

1447std::unique_ptr

1449 StringRef InFile) {

1450 return WrappedAction->CreateASTConsumer(CI, InFile);

1451}

1458 auto Ret = WrappedAction->BeginSourceFileAction(CI);

1459

1461 return Ret;

1462}

1473

1492

Defines the clang::ASTContext interface.

Defines enum values for all the target-independent builtin functions.

Defines interfaces for clang::FileEntry and clang::FileEntryRef.

FormatToken * Previous

The previous token in the unwrapped line.

static std::error_code collectModuleHeaderIncludes(const LangOptions &LangOpts, FileManager &FileMgr, DiagnosticsEngine &Diag, ModuleMap &ModMap, clang::Module *Module, SmallVectorImpl< char > &Includes)

Collect the set of header includes needed to construct the given module and update the TopHeaders fil...

Definition FrontendAction.cpp:575

static Module * prepareToBuildModule(CompilerInstance &CI, StringRef ModuleMapFilename)

Definition FrontendAction.cpp:729

static void addHeaderInclude(StringRef HeaderName, SmallVectorImpl< char > &Includes, const LangOptions &LangOpts, bool IsExternC)

Definition FrontendAction.cpp:550

static bool loadModuleMapForModuleBuild(CompilerInstance &CI, bool IsSystem, bool IsPreprocessed, std::string &PresumedModuleMapFile, unsigned &Offset)

Definition FrontendAction.cpp:686

static SourceLocation ReadOriginalFileName(CompilerInstance &CI, std::string &InputFile, bool IsModuleMap=false)

For preprocessed files, if the first line is the linemarker and specifies the original source file na...

Definition FrontendAction.cpp:490

static SmallVectorImpl< char > & operator+=(SmallVectorImpl< char > &Includes, StringRef RHS)

Definition FrontendAction.cpp:545

static std::unique_ptr< llvm::MemoryBuffer > getInputBufferForModule(CompilerInstance &CI, Module *M)

Compute the input buffer that should be used to build the specified module.

Definition FrontendAction.cpp:800

Defines the clang::FrontendAction interface and various convenience abstract classes (clang::ASTFront...

Defines the clang::LangOptions interface.

static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)

Produce a diagnostic highlighting some portion of a literal.

Defines the clang::Preprocessor interface.

Defines clang::SarifDocumentWriter, clang::SarifRule, clang::SarifResult.

Defines the clang::SourceLocation class and associated facilities.

Defines the SourceManager interface.

Defines utilities for dealing with stack allocation and stack space.

Defines the clang::TokenKind enum and support functions.

ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.

void setASTMutationListener(ASTMutationListener *Listener)

Attach an AST mutation listener to the AST context.

void setExternalSource(IntrusiveRefCntPtr< ExternalASTSource > Source)

Attach an external AST source to the AST context.

IntrusiveRefCntPtr< ExternalASTSource > getExternalSourcePtr() const

Retrieve a pointer to the external AST source associated with this AST context, if any.

ExternalASTSource * getExternalSource() const

Retrieve a pointer to the external AST source associated with this AST context, if any.

void ExecuteAction() override

Implement the ExecuteAction interface by running Sema on the already-initialized AST consumer.

Definition FrontendAction.cpp:1409

Reads an AST files chain containing the contents of a translation unit.

void visitTopLevelModuleMaps(serialization::ModuleFile &MF, llvm::function_ref< void(FileEntryRef)> Visitor)

Visit all the top-level module maps loaded when building the given module file.

ModuleManager & getModuleManager()

Retrieve the module manager.

static bool isAcceptableASTFile(StringRef Filename, FileManager &FileMgr, const ModuleCache &ModCache, const PCHContainerReader &PCHContainerRdr, const LangOptions &LangOpts, const CodeGenOptions &CGOpts, const TargetOptions &TargetOpts, const PreprocessorOptions &PPOpts, StringRef ExistingModuleCachePath, bool RequireStrictOptionMatches=false)

Determine whether the given AST file is acceptable to load into a translation unit with the given lan...

static std::unique_ptr< ASTUnit > LoadFromASTFile(StringRef Filename, const PCHContainerReader &PCHContainerRdr, WhatToLoad ToLoad, IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS, std::shared_ptr< DiagnosticOptions > DiagOpts, IntrusiveRefCntPtr< DiagnosticsEngine > Diags, const FileSystemOptions &FileSystemOpts, const HeaderSearchOptions &HSOpts, const LangOptions *LangOpts=nullptr, bool OnlyLocalDecls=false, CaptureDiagsKind CaptureDiagnostics=CaptureDiagsKind::None, bool AllowASTWithCompilerErrors=false, bool UserFilesAreVolatile=false)

Create a ASTUnit from an AST file.

@ LoadPreprocessorOnly

Load options and the preprocessor state.

@ LoadEverything

Load everything, including Sema.

void initializeBuiltins(IdentifierTable &Table, const LangOptions &LangOpts)

Mark the identifiers for all the builtins with their appropriate builtin ID # and mark any non-portab...

SourceLocation getEnd() const

SourceLocation getBegin() const

Abstract interface for a consumer of code-completion information.

CompilerInstance - Helper class for managing a single instance of the Clang compiler.

void createPCHExternalASTSource(StringRef Path, DisableValidationForModuleKind DisableValidation, bool AllowPCHWithCompilerErrors, void *DeserializationListener, bool OwnDeserializationListener)

Create an external AST source to read a PCH file and attach it to the AST context.

DiagnosticConsumer & getDiagnosticClient() const

void createPreprocessor(TranslationUnitKind TUKind)

Create the preprocessor, using the invocation, file, and source managers, and replace any existing on...

bool hasFileManager() const

const PCHContainerReader & getPCHContainerReader() const

Return the appropriate PCHContainerReader depending on the current CodeGenOptions.

DiagnosticsEngine & getDiagnostics() const

Get the current diagnostics engine.

FileSystemOptions & getFileSystemOpts()

bool InitializeSourceManager(const FrontendInputFile &Input)

InitializeSourceManager - Initialize the source manager to set InputFile as the main file.

void createFileManager()

Create the file manager and replace any existing one with it.

void setVirtualFileSystem(IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS)

Use the given file system.

FileManager & getFileManager() const

Return the current file manager to the caller.

IntrusiveRefCntPtr< DiagnosticsEngine > getDiagnosticsPtr() const

void resetAndLeakSourceManager()

void setASTConsumer(std::unique_ptr< ASTConsumer > Value)

setASTConsumer - Replace the current AST consumer; the compiler instance takes ownership of Value.

ModuleCache & getModuleCache() const

IntrusiveRefCntPtr< ASTReader > getASTReader() const

void createASTContext()

Create the AST context.

bool hasASTContext() const

void resetAndLeakFileManager()

Preprocessor & getPreprocessor() const

Return the current preprocessor.

ASTContext & getASTContext() const

IntrusiveRefCntPtr< llvm::vfs::FileSystem > getVirtualFileSystemPtr() const

TargetOptions & getTargetOpts()

void createVirtualFileSystem(IntrusiveRefCntPtr< llvm::vfs::FileSystem > BaseFS=llvm::vfs::getRealFileSystem(), DiagnosticConsumer *DC=nullptr)

Create a virtual file system instance based on the invocation.

void setASTReader(IntrusiveRefCntPtr< ASTReader > Reader)

FrontendOptions & getFrontendOpts()

void setSema(Sema *S)

Replace the current Sema; the compiler instance takes ownership of S.

void setSourceManager(llvm::IntrusiveRefCntPtr< SourceManager > Value)

setSourceManager - Replace the current source manager.

void setASTContext(llvm::IntrusiveRefCntPtr< ASTContext > Value)

setASTContext - Replace the current AST context.

HeaderSearchOptions & getHeaderSearchOpts()

bool hasCodeCompletionConsumer() const

void resetAndLeakASTContext()

void createSourceManager()

Create the source manager and replace any existing one with it.

void resetAndLeakPreprocessor()

std::unique_ptr< ASTConsumer > takeASTConsumer()

takeASTConsumer - Remove the current AST consumer and give ownership to the caller.

PreprocessorOptions & getPreprocessorOpts()

std::string getSpecificModuleCachePath(StringRef ModuleHash)

void setFileManager(IntrusiveRefCntPtr< FileManager > Value)

Replace the current file manager.

TargetInfo & getTarget() const

void createCodeCompletionConsumer()

Create a code completion consumer using the invocation; note that this will cause the source manager ...

void clearOutputFiles(bool EraseFiles)

clearOutputFiles - Clear the output file list.

DiagnosticOptions & getDiagnosticOpts()

LangOptions & getLangOpts()

CodeGenOptions & getCodeGenOpts()

SourceManager & getSourceManager() const

Return the current source manager.

CodeCompleteConsumer & getCodeCompletionConsumer() const

bool shouldBuildGlobalModuleIndex() const

Indicates whether we should (re)build the global module index.

bool hasSourceManager() const

bool hasASTConsumer() const

bool loadModuleFile(StringRef FileName, serialization::ModuleFile *&LoadedModuleFile)

bool hasPreprocessor() const

void setPreprocessor(std::shared_ptr< Preprocessor > Value)

Replace the current preprocessor.

bool hasVirtualFileSystem() const

void createSema(TranslationUnitKind TUKind, CodeCompleteConsumer *CompletionConsumer)

Create the Sema object to be used for parsing.

bool isFileContext() const

DeclContext * getLexicalParent()

getLexicalParent - Returns the containing lexical DeclContext.

SourceLocation getLocation() const

const char * getDeclKindName() const

DeclContext * getLexicalDeclContext()

getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).

const LangOptions & getLangOpts() const LLVM_READONLY

Helper to get the language options from the ASTContext.

virtual SourceRange getSourceRange() const LLVM_READONLY

Source range that this declaration covers.

void DeclRead(GlobalDeclID ID, const Decl *D) override

A decl was deserialized from the AST file.

virtual void EndSourceFile()

Callback to inform the diagnostic client that processing of a source file has ended.

virtual void BeginSourceFile(const LangOptions &LangOpts, const Preprocessor *PP=nullptr)

Callback to inform the diagnostic client that processing of a source file is beginning.

Concrete class used by the front-end to report problems and issues.

DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)

Issue the message to the client.

bool hasErrorOccurred() const

A reference to a FileEntry that includes the name of the file as it was accessed by the FileManager's...

StringRef getName() const

The name of this FileEntry.

An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...

Implements support for file system lookup, file system caching, and directory search management.

OptionalFileEntryRef getOptionalFileRef(StringRef Filename, bool OpenFile=false, bool CacheFailure=true)

Get a FileEntryRef if it exists, without doing anything on error.

OptionalDirectoryEntryRef getOptionalDirectoryRef(StringRef DirName, bool CacheFailure=true)

Get a DirectoryEntryRef if it exists, without doing anything on error.

const FrontendInputFile & getCurrentInput() const

virtual void EndSourceFile()

Perform any per-file post processing, deallocate per-file objects, and run statistics and output file...

Definition FrontendAction.cpp:1334

virtual bool shouldEraseOutputFiles()

Callback at the end of processing a single input, to determine if the output files should be erased o...

Definition FrontendAction.cpp:1401

virtual bool hasIRSupport() const

Does this action support use with IR files?

virtual void EndSourceFileAction()

Callback at the end of processing a single input.

virtual std::unique_ptr< ASTConsumer > CreateASTConsumer(CompilerInstance &CI, StringRef InFile)=0

Create the AST consumer object for this action, if supported.

CompilerInstance & getCompilerInstance() const

llvm::Error Execute()

Set the source manager's main input file, and run the action.

Definition FrontendAction.cpp:1310

virtual bool hasASTFileSupport() const

Does this action support use with AST files?

Module * getCurrentModule() const

Definition FrontendAction.cpp:378

void setCurrentInput(const FrontendInputFile &CurrentInput, std::unique_ptr< ASTUnit > AST=nullptr)

Definition FrontendAction.cpp:372

virtual bool BeginSourceFileAction(CompilerInstance &CI)

Callback at the start of processing a single input.

virtual void ExecuteAction()=0

Callback to run the program action, using the initialized compiler instance.

void setCompilerInstance(CompilerInstance *Value)

virtual TranslationUnitKind getTranslationUnitKind()

For AST-based actions, the kind of translation unit we're handling.

FrontendAction()

Definition FrontendAction.cpp:368

virtual ~FrontendAction()

Definition FrontendAction.cpp:370

bool BeginSourceFile(CompilerInstance &CI, const FrontendInputFile &Input)

Prepare the action for processing the input file Input.

Definition FrontendAction.cpp:825

virtual bool hasCodeCompletionSupport() const

Does this action support use with code completion?

StringRef getCurrentFileOrBufferName() const

virtual bool isModelParsingAction() const

Is this action invoked on a model file?

bool isCurrentFileAST() const

virtual bool usesPreprocessorOnly() const =0

Does this action only use the preprocessor?

friend class WrapperFrontendAction

virtual bool BeginInvocation(CompilerInstance &CI)

Callback before starting processing a single input, giving the opportunity to modify the CompilerInvo...

virtual bool hasPCHSupport() const

Does this action support use with PCH?

An input file for the front end.

bool isPreprocessed() const

InputKind getKind() const

StringRef getFile() const

std::vector< std::string > ModuleFiles

The list of additional prebuilt module files to load before processing the input.

unsigned SkipFunctionBodies

Skip over function bodies to speed up parsing in cases you do not need them (e.g.

std::map< std::string, std::vector< std::string > > PluginArgs

Args to pass to the plugins.

unsigned ShowStats

Show frontend performance metrics and statistics.

ParsedSourceLocation CodeCompletionAt

If given, enable code completion at the provided location.

std::string OriginalModuleMap

When the input is a module map, the original module map file from which that map was inferred,...

std::vector< std::string > ModulesEmbedFiles

The list of files to embed into the compiled module file.

unsigned ModulesEmbedAllFiles

Whether we should embed all used files into the PCM file.

std::vector< std::string > AddPluginActions

The list of plugin actions to run in addition to the normal action.

std::string DumpMinimizationHintsPath

Output path to dump ranges of deserialized declarations to use as minimization hints.

unsigned DisableFree

Disable memory freeing on exit.

std::string OverrideRecordLayoutsFile

File name of the file that will provide record layouts (in the format produced by -fdump-record-layou...

std::vector< std::string > ModuleMapFiles

The list of module map files to load before processing the input.

A SourceLocation and its associated SourceManager.

static llvm::Error writeIndex(FileManager &FileMgr, const PCHContainerReader &PCHContainerRdr, llvm::StringRef Path)

Write a global index into the given.

void PrintStats() const

Print some statistics to stderr that indicate how well the hashing is doing.

The kind of a file that we've been handed as an input.

bool isPreprocessed() const

InputKind withHeaderUnit(HeaderUnitKind HU) const

bool isHeaderUnit() const

HeaderUnitKind getHeaderUnitKind() const

Language getLanguage() const

@ CMK_None

Not compiling a module interface at all.

@ CMK_ModuleMap

Compiling a module from a module map.

Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...

std::string ModuleName

The module currently being compiled as specified by -fmodule-name.

std::string CurrentModule

The name of the current module, of which the main source file is a part.

Lexer - This provides a simple interface that turns a text buffer into a stream of tokens.

static CharSourceRange getAsCharRange(SourceRange Range, const SourceManager &SM, const LangOptions &LangOpts)

Given a token range, produce a corresponding CharSourceRange that is not a token range.

static unsigned getSpelling(const Token &Tok, const char *&Buffer, const SourceManager &SourceMgr, const LangOptions &LangOpts, bool *Invalid=nullptr)

getSpelling - This method is used to get the spelling of a token into a preallocated buffer,...

static bool getRawToken(SourceLocation Loc, Token &Result, const SourceManager &SM, const LangOptions &LangOpts, bool IgnoreWhiteSpace=false)

Relex the token at the specified location.

void finishModuleDeclarationScope()

Creates a new declaration scope for module names, allowing previously defined modules to shadow defin...

bool canInferFrameworkModule(const DirectoryEntry *Dir) const

Check whether a framework module can be inferred in the given directory.

bool isHeaderUnavailableInModule(FileEntryRef Header, const Module *RequestingModule) const

Determine whether the given header is unavailable as part of the specified module.

void resolveHeaderDirectives(const FileEntry *File) const

Resolve all lazy header directives for the specified file.

void setInferredModuleAllowedBy(Module *M, FileID ModMapFID)

Describes a module or submodule.

SmallVector< UnresolvedHeaderDirective, 1 > MissingHeaders

Headers that are mentioned in the module map file but could not be found on the file system.

Module * Parent

The parent of this module.

unsigned IsSystem

Whether this is a "system" module (which assumes that all headers in it are system headers).

static StringRef getModuleInputBufferName()

llvm::iterator_range< submodule_iterator > submodules()

unsigned IsExternC

Whether this is an 'extern "C"' module (which implicitly puts all headers in it within an 'extern "C"...

std::optional< Header > getUmbrellaHeaderAsWritten() const

Retrieve the umbrella header as written.

OptionalDirectoryEntryRef Directory

The build directory of this module.

std::string PresumedModuleMapFile

The presumed file name for the module map defining this module.

ArrayRef< Header > getHeaders(HeaderKind HK) const

bool isAvailable() const

Determine whether this module is available for use within the current translation unit.

std::optional< DirectoryName > getUmbrellaDirAsWritten() const

Retrieve the umbrella directory as written.

std::string getFullModuleName(bool AllowStringLiterals=false) const

Retrieve the full name of this module, including the path from its top-level module.

void addTopHeader(FileEntryRef File)

Add a top-level header associated with this module.

@ AddAfterMainAction

Execute the action after the main action.

@ AddBeforeMainAction

Execute the action before the main action.

@ CmdlineBeforeMainAction

Execute the action before the main action if on the command line.

@ CmdlineAfterMainAction

Execute the action after the main action if on the command line.

std::unique_ptr< ASTConsumer > CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override

Provide a default implementation which returns aborts; this method should never be called by Frontend...

Definition FrontendAction.cpp:1439

PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...

std::set< std::string > DeserializedPCHDeclsToErrorOn

This is a set of names for decls that we do not want to be deserialized, and we emit an error if they...

std::vector< std::string > ChainedIncludes

Headers that will be converted to chained PCHs in memory.

std::string ImplicitPCHInclude

The implicit PCH included at the start of the translation unit, or empty.

DisableValidationForModuleKind DisablePCHOrModuleValidation

Whether to disable most of the normal validation performed on precompiled headers and module files.

bool DumpDeserializedPCHDecls

Dump declarations that are deserialized from PCH, for testing.

bool AllowPCHWithCompilerErrors

When true, a PCH with compiler errors will not be rejected.

Engages in a tight little dance with the lexer to efficiently preprocess tokens.

void setMainFileDir(DirectoryEntryRef Dir)

Set the directory in which the main file should be considered to have been found, if it is not a real...

static bool checkModuleIsAvailable(const LangOptions &LangOpts, const TargetInfo &TargetInfo, const Module &M, DiagnosticsEngine &Diags)

Check that the given module is available, producing a diagnostic if not.

Module * getCurrentModuleImplementation()

Retrieves the module whose implementation we're current compiling, if any.

HeaderSearch & getHeaderSearchInfo() const

IdentifierTable & getIdentifierTable()

Builtin::Context & getBuiltinInfo()

void setSkipMainFilePreamble(unsigned Bytes, bool StartOfLine)

Instruct the preprocessor to skip part of the main source file.

const LangOptions & getLangOpts() const

void EndSourceFile()

Inform the preprocessor callbacks that processing is complete.

void setSarifWriter(std::unique_ptr< SarifDocumentWriter > SarifWriter)

Encodes a location in the source.

bool isValid() const

Return true if this is a valid SourceLocation object.

SourceLocation getLocWithOffset(IntTy Offset) const

Return a source location with the specified offset from this SourceLocation.

This class handles loading and caching of source files into memory.

FileIDAndOffset getDecomposedLoc(SourceLocation Loc) const

Decompose the specified location into a raw FileID + Offset pair.

void setAllFilesAreTransient(bool Transient)

Specify that all files that are read during this compilation are transient.

void AddLineNote(SourceLocation Loc, unsigned LineNo, int FilenameID, bool IsFileEntry, bool IsFileExit, SrcMgr::CharacteristicKind FileKind)

Add a line note to the line table for the FileID and offset specified by Loc.

void setFileIsTransient(FileEntryRef SourceFile)

Specify that a file is transient.

OptionalFileEntryRef getFileEntryRefForID(FileID FID) const

Returns the FileEntryRef for the provided FileID.

FileID createFileID(FileEntryRef SourceFile, SourceLocation IncludePos, SrcMgr::CharacteristicKind FileCharacter, int LoadedID=0, SourceLocation::UIntTy LoadedOffset=0)

Create a new FileID that represents the specified file being #included from the specified IncludePosi...

void PrintStats() const

Print statistics to stderr.

FileID getMainFileID() const

Returns the FileID of the main source file.

void pushModuleBuildStack(StringRef moduleName, FullSourceLoc importLoc)

Push an entry to the module build stack.

void initializeForReplay(const SourceManager &Old)

Initialize this source manager suitably to replay the compilation described by Old.

FileID getOrCreateFileID(FileEntryRef SourceFile, SrcMgr::CharacteristicKind FileCharacter)

Get the FileID for SourceFile if it exists.

StringLiteralParser - This decodes string escape characters and performs wide string analysis and Tra...

Token - This structure provides full information about a lexed token.

SourceLocation getEndLoc() const

SourceLocation getLocation() const

Return a source location identifier for the specified offset in the current file.

bool is(tok::TokenKind K) const

is/isNot - Predicates to check if this token is a specific kind, as in "if (Tok.is(tok::l_brace)) {....

tok::TokenKind getKind() const

bool BeginSourceFileAction(CompilerInstance &CI) override

Callback at the start of processing a single input.

Definition FrontendAction.cpp:1455

bool hasIRSupport() const override

Does this action support use with IR files?

Definition FrontendAction.cpp:1486

bool PrepareToExecuteAction(CompilerInstance &CI) override

Prepare to execute the action on the given CompilerInstance.

Definition FrontendAction.cpp:1444

bool hasASTFileSupport() const override

Does this action support use with AST files?

Definition FrontendAction.cpp:1483

bool usesPreprocessorOnly() const override

Does this action only use the preprocessor?

Definition FrontendAction.cpp:1474

void ExecuteAction() override

Callback to run the program action, using the initialized compiler instance.

Definition FrontendAction.cpp:1463

bool hasCodeCompletionSupport() const override

Does this action support use with code completion?

Definition FrontendAction.cpp:1489

bool shouldEraseOutputFiles() override

Callback at the end of processing a single input, to determine if the output files should be erased o...

Definition FrontendAction.cpp:1470

TranslationUnitKind getTranslationUnitKind() override

For AST-based actions, the kind of translation unit we're handling.

Definition FrontendAction.cpp:1477

void EndSourceFileAction() override

Callback at the end of processing a single input.

Definition FrontendAction.cpp:1467

bool BeginInvocation(CompilerInstance &CI) override

Callback before starting processing a single input, giving the opportunity to modify the CompilerInvo...

Definition FrontendAction.cpp:1452

bool hasPCHSupport() const override

Does this action support use with PCH?

Definition FrontendAction.cpp:1480

std::unique_ptr< ASTConsumer > CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override

Create the AST consumer object for this action, if supported.

Definition FrontendAction.cpp:1448

std::unique_ptr< FrontendAction > WrappedAction

void EndSourceFile() override

Perform any per-file post processing, deallocate per-file objects, and run statistics and output file...

Definition FrontendAction.cpp:1466

Information about a module that has been loaded by the ASTReader.

bool StandardCXXModule

Whether this module file is a standard C++ module.

ModuleFile & getPrimaryModule()

Returns the primary module associated with the manager, that is, the first module loaded.

Public enums and private classes that are part of the SourceManager implementation.

The JSON file list parser is used to communicate input to InstallAPI.

bool isa(CodeGen::Address addr)

CustomizableOptional< FileEntryRef > OptionalFileEntryRef

void ParseAST(Preprocessor &pp, ASTConsumer *C, ASTContext &Ctx, bool PrintStats=false, TranslationUnitKind TUKind=TU_Complete, CodeCompleteConsumer *CompletionConsumer=nullptr, bool SkipFunctionBodies=false)

Parse the entire file specified, notifying the ASTConsumer as the file is parsed.

@ Override

Merge availability attributes for an override, which requires an exact match or a weakening of constr...

nullptr

This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...

bool operator<(DeclarationName LHS, DeclarationName RHS)

Ordering on two declaration names.

@ Result

The result type of a method or function.

const FunctionProtoType * T

IntrusiveRefCntPtr< ExternalSemaSource > createChainedIncludesSource(CompilerInstance &CI, IntrusiveRefCntPtr< ASTReader > &OutReader)

The ChainedIncludesSource class converts headers to chained PCHs in memory, mainly for testing.

llvm::Registry< PluginASTAction > FrontendPluginRegistry

The frontend plugin registry.

void noteBottomOfStack(bool ForceSet=false)

Call this once on each thread, as soon after starting the thread as feasible, to note the approximate...

TranslationUnitKind

Describes the kind of translation unit being processed.

U cast(CodeGen::Address addr)