LLVM: include/llvm/Support/Path.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15#ifndef LLVM_SUPPORT_PATH_H

16#define LLVM_SUPPORT_PATH_H

17

22#include

23

24namespace llvm {

25namespace sys {

27

35

36

39 return true;

41 return false;

42#if defined(_WIN32)

43 return false;

44#else

45 return true;

46#endif

47}

48

49

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

76 const StringRef> {

77 StringRef Path;

78 StringRef Component;

79 size_t Position = 0;

81

82

85

86public:

90

91

93};

94

95

96

97

98

99

102 const StringRef> {

103 StringRef Path;

104 StringRef Component;

105 size_t Position = 0;

107

110

111public:

115

116

118};

119

120

121

122

125

126

127

128

130

131

132

133

136

137

138

139

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

160

161

162

163

164

165

166

167

168

169

170

171

172

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

202

203

204

205

206

209

210

211

212

213

214

215

217 bool remove_dot_dot = false,

219

220

221

222

223

224

225

226

227

228

229

230

231

233 const Twine &b = "", const Twine &c = "",

234 const Twine &d = "");

235

237 const Twine &b = "", const Twine &c = "",

238 const Twine &d = "");

239

240

241

242

243

244

245

246

247

248

249

250

253

254

255

256

257

258

259

260

261

262

263

266

267

268

269

270

271

273

274

275

276

277

284

285

286

287

288

289

290

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

310

311

312

313

314

315

316

317

318

319

320

321

324

325

326

327

328

329

330

333

334

335

336

337

338

339

340

341

342

343

346

347

348

349

350

351

352

353

354

355

356

359

360

361

362

363

364

365

366

367

368

369

370

371

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

393

394

395

396

397

398

399

400

401

402

403

404

405

406

407

410

411

412

413

414

416

417

418

419

421

422

423

424

425

426

427

428

429

430

433

434

435

436

437

439

440

441

442

443

444

446

447

448

449

450

451

453

454

455

456

457

458

459

461

462

463

464

465

466

467

470

471

472

473

474

475

476

478

479

480

481

482

483

484

486

487

488

489

490

491

492

494

495

496

497

498

499

500

502

503

504

505

506

507

508

510

511

512

513

514

515

516

518

519

520

521

522

523

524

525

526

527

528

529

530

531

532

533

534

535

537

538

539

540

541

542

543

544

545

546

547

548

549

550

551

552

553

554

555

556

557

558

559

560

562

563

564

565

566

568

569

570

571

572

573

574

575

576

577

580

581}

582}

583}

584

585#endif

#define LLVM_LIFETIME_BOUND

StringRef - Represent a constant reference to a string, i.e.

Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...

CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...

const StringRef & reference

Path iterator.

Definition Path.h:76

LLVM_ABI const_iterator & operator++()

LLVM_ABI friend const_iterator begin(StringRef path, Style style)

Get begin iterator over path.

LLVM_ABI friend const_iterator end(StringRef path)

Get end iterator over path.

LLVM_ABI bool operator==(const const_iterator &RHS) const

LLVM_ABI ptrdiff_t operator-(const const_iterator &RHS) const

Difference in bytes between this and RHS.

reference operator*() const

Definition Path.h:87

Reverse path iterator.

Definition Path.h:102

LLVM_ABI friend reverse_iterator rend(StringRef path)

Get reverse end iterator over path.

LLVM_ABI bool operator==(const reverse_iterator &RHS) const

LLVM_ABI ptrdiff_t operator-(const reverse_iterator &RHS) const

Difference in bytes between this and RHS.

LLVM_ABI reverse_iterator & operator++()

LLVM_ABI friend reverse_iterator rbegin(StringRef path, Style style)

Get reverse begin iterator over path.

reference operator*() const

Definition Path.h:112

LLVM_ABI StringRef get_separator(Style style=Style::native)

Return the preferred separator for this platform.

LLVM_ABI StringRef root_path(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)

Get root path.

LLVM_ABI void remove_filename(SmallVectorImpl< char > &path, Style style=Style::native)

Remove the last component from path unless it is the root dir.

LLVM_ABI bool has_relative_path(const Twine &path, Style style=Style::native)

Has relative path?

LLVM_ABI StringRef stem(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)

Get stem.

LLVM_ABI bool has_root_name(const Twine &path, Style style=Style::native)

Has root name?

LLVM_ABI void replace_extension(SmallVectorImpl< char > &path, const Twine &extension, Style style=Style::native)

Replace the file extension of path with extension.

LLVM_ABI bool cache_directory(SmallVectorImpl< char > &result)

Get the directory where installed packages should put their machine-local cache, e....

LLVM_ABI const_iterator begin(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)

Get begin iterator over path.

LLVM_ABI bool user_config_directory(SmallVectorImpl< char > &result)

Get the directory where packages should read user-specific configurations.

LLVM_ABI bool remove_dots(SmallVectorImpl< char > &path, bool remove_dot_dot=false, Style style=Style::native)

In-place remove any '.

LLVM_ABI bool has_root_path(const Twine &path, Style style=Style::native)

Has root path?

constexpr bool is_style_posix(Style S)

Check if S uses POSIX path rules.

Definition Path.h:37

LLVM_ABI StringRef parent_path(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)

Get parent path.

LLVM_ABI bool has_parent_path(const Twine &path, Style style=Style::native)

Has parent path?

Style

Definition Path.h:28

@ windows

Definition Path.h:33

@ windows_backslash

Definition Path.h:32

@ native

Definition Path.h:29

@ posix

Definition Path.h:30

@ windows_slash

Definition Path.h:31

void make_preferred(SmallVectorImpl< char > &path, Style style=Style::native)

For Windows path styles, convert path to use the preferred path separators.

Definition Path.h:278

LLVM_ABI bool is_relative(const Twine &path, Style style=Style::native)

Is path relative?

LLVM_ABI void system_temp_directory(bool erasedOnReboot, SmallVectorImpl< char > &result)

Get the typical temporary directory for the system, e.g., "/var/tmp" or "C:/TEMP".

LLVM_ABI bool has_extension(const Twine &path, Style style=Style::native)

Has extension?

LLVM_ABI void make_absolute(const Twine &current_directory, SmallVectorImpl< char > &path)

Make path an absolute path.

LLVM_ABI bool is_absolute_gnu(const Twine &path, Style style=Style::native)

Is path absolute using GNU rules?

LLVM_ABI StringRef filename(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)

Get filename.

LLVM_ABI StringRef remove_leading_dotslash(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)

Remove redundant leading "./" pieces and consecutive separators.

LLVM_ABI std::string convert_to_slash(StringRef path, Style style=Style::native)

Replaces backslashes with slashes if Windows.

LLVM_ABI void native(const Twine &path, SmallVectorImpl< char > &result, Style style=Style::native)

Convert path to the native form.

LLVM_ABI bool is_absolute(const Twine &path, Style style=Style::native)

Is path absolute?

LLVM_ABI bool has_stem(const Twine &path, Style style=Style::native)

Has stem?

constexpr bool is_style_windows(Style S)

Check if S uses Windows path rules.

Definition Path.h:50

LLVM_ABI StringRef root_name(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)

Get root name.

LLVM_ABI StringRef root_directory(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)

Get root directory.

LLVM_ABI bool replace_path_prefix(SmallVectorImpl< char > &Path, StringRef OldPrefix, StringRef NewPrefix, Style style=Style::native)

Replace matching path prefix with another path.

LLVM_ABI void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")

Append to path.

LLVM_ABI StringRef extension(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)

Get extension.

LLVM_ABI reverse_iterator rend(StringRef path LLVM_LIFETIME_BOUND)

Get reverse end iterator over path.

LLVM_ABI reverse_iterator rbegin(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)

Get reverse begin iterator over path.

LLVM_ABI bool has_filename(const Twine &path, Style style=Style::native)

Has filename?

LLVM_ABI const_iterator end(StringRef path LLVM_LIFETIME_BOUND)

Get end iterator over path.

LLVM_ABI bool home_directory(SmallVectorImpl< char > &result)

Get the user's home directory.

LLVM_ABI bool is_separator(char value, Style style=Style::native)

Check whether the given char is a path separator on the host OS.

LLVM_ABI StringRef relative_path(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)

Get relative path.

LLVM_ABI bool has_root_directory(const Twine &path, Style style=Style::native)

Has root directory?

This is an optimization pass for GlobalISel generic memory operations.