A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://clang.llvm.org/doxygen/Basic_2Diagnostic_8cpp_source.html below:

clang: lib/Basic/Diagnostic.cpp Source File

26#include "llvm/ADT/IntrusiveRefCntPtr.h" 27#include "llvm/ADT/SmallString.h" 28#include "llvm/ADT/SmallVector.h" 29#include "llvm/ADT/StringExtras.h" 30#include "llvm/ADT/StringMap.h" 31#include "llvm/ADT/StringRef.h" 32#include "llvm/Support/ConvertUTF.h" 33#include "llvm/Support/CrashRecoveryContext.h" 34#include "llvm/Support/Error.h" 35#include "llvm/Support/MemoryBuffer.h" 36#include "llvm/Support/SpecialCaseList.h" 37#include "llvm/Support/Unicode.h" 38#include "llvm/Support/VirtualFileSystem.h" 39#include "llvm/Support/raw_ostream.h" 51using namespace clang

;

71

StringRef Modifier, StringRef Argument,

76

StringRef Str =

"<can't format argument>"

;

77

Output.append(Str.begin(), Str.end());

84

: Diags(

std

::move(diags)), DiagOpts(

std

::move(DiagOpts)) {

98

DiagStatesByLoc.dump(*SourceMgr);

102

DiagStatesByLoc.dump(*SourceMgr, DiagName);

106 bool

ShouldOwnClient) {

107

Owner.reset(ShouldOwnClient ? client :

nullptr

);

112

DiagStateOnPushStack.push_back(GetCurDiagState());

116 if

(DiagStateOnPushStack.empty())

119 if

(DiagStateOnPushStack.back() != GetCurDiagState()) {

121

PushDiagStatePoint(DiagStateOnPushStack.back(),

Loc

);

123

DiagStateOnPushStack.pop_back();

128

ErrorOccurred =

false

;

129

UncompilableErrorOccurred =

false

;

130

FatalErrorOccurred =

false

;

131

UnrecoverableErrorOccurred =

false

;

135

TrapNumErrorsOccurred = 0;

136

TrapNumUnrecoverableErrorsOccurred = 0;

143

DiagStatesByLoc.clear();

144

DiagStateOnPushStack.clear();

148

DiagStates.emplace_back(*Diags);

149

DiagStatesByLoc.appendFirst(&DiagStates.back());

154

DiagnosticsEngine::DiagState::getOrAddMapping(

diag::kind Diag

) {

155

std::pair<iterator, bool>

Result

=

160 Result

.first->second = DiagIDs.getDefaultMapping(

Diag

);

162

DiagIDs.initCustomDiagMapping(

Result

.first->second,

Diag

);

165 return Result

.first->second;

168void

DiagnosticsEngine::DiagStateMap::appendFirst(DiagState *State) {

169

assert(Files.empty() &&

"not first"

);

170

FirstDiagState = CurDiagState = State;

174void

DiagnosticsEngine::DiagStateMap::append(

SourceManager

&SrcMgr,

177

CurDiagState = State;

178

CurDiagStateLoc =

Loc

;

181 unsigned

Offset = Decomp.second;

182 for

(

File

*F = getFile(SrcMgr, Decomp.first); F;

183

Offset = F->ParentOffset, F = F->Parent) {

184

F->HasLocalTransitions =

true

;

185 auto

&

Last

= F->StateTransitions.back();

186

assert(

Last

.Offset <= Offset &&

"state transitions added out of order"

);

188 if

(

Last

.Offset == Offset) {

189 if

(

Last

.State == State)

195

F->StateTransitions.push_back({State, Offset});

199

DiagnosticsEngine::DiagState *

200

DiagnosticsEngine::DiagStateMap::lookup(

SourceManager

&SrcMgr,

204 return

FirstDiagState;

207 const File

*F = getFile(SrcMgr, Decomp.first);

208 return

F->lookup(Decomp.second);

211

DiagnosticsEngine::DiagState *

212

DiagnosticsEngine::DiagStateMap::File::lookup(

unsigned

Offset)

const

{

214

llvm::partition_point(StateTransitions, [=](

const

DiagStatePoint &

P

) {

215 return P

.Offset <= Offset;

217

assert(OnePastIt != StateTransitions.begin() &&

"missing initial state"

);

218 return

OnePastIt[-1].State;

221

DiagnosticsEngine::DiagStateMap::File *

222

DiagnosticsEngine::DiagStateMap::getFile(

SourceManager

&SrcMgr,

225 auto Range

= Files.equal_range(ID);

227 return

&

Range

.first->second;

228 auto

&F = Files.insert(

Range

.first, std::make_pair(ID,

File

()))->second;

232 if

(

ID

.isValid()) {

234

F.Parent = getFile(SrcMgr, Decomp.first);

235

F.ParentOffset = Decomp.second;

236

F.StateTransitions.push_back({F.Parent->lookup(Decomp.second), 0});

245

F.StateTransitions.push_back({FirstDiagState, 0});

250void

DiagnosticsEngine::DiagStateMap::dump(

SourceManager

&SrcMgr,

251

StringRef DiagName)

const

{

252

llvm::errs() <<

"diagnostic state at "

;

253

CurDiagStateLoc.print(llvm::errs(), SrcMgr);

254

llvm::errs() <<

": "

<< CurDiagState <<

"\n"

;

256 for

(

auto

&F : Files) {

260 bool

PrintedOuterHeading =

false

;

261 auto

PrintOuterHeading = [&] {

262 if

(PrintedOuterHeading)

return

;

263

PrintedOuterHeading =

true

;

265

llvm::errs() <<

"File "

<< &

File

<<

" <FileID "

<<

ID

.getHashValue()

268 if

(F.second.Parent) {

269

std::pair<FileID, unsigned> Decomp =

271

assert(

File

.ParentOffset == Decomp.second);

272

llvm::errs() <<

" parent "

<<

File

.Parent <<

" <FileID " 273

<< Decomp.first.getHashValue() <<

"> "

;

276

.

print

(llvm::errs(), SrcMgr);

278 if

(

File

.HasLocalTransitions)

279

llvm::errs() <<

" has_local_transitions"

;

280

llvm::errs() <<

"\n"

;

283 if

(DiagName.empty())

286 for

(DiagStatePoint &Transition :

File

.StateTransitions) {

287 bool

PrintedInnerHeading =

false

;

288 auto

PrintInnerHeading = [&] {

289 if

(PrintedInnerHeading)

return

;

290

PrintedInnerHeading =

true

;

293

llvm::errs() <<

" "

;

296

.

print

(llvm::errs(), SrcMgr);

297

llvm::errs() <<

": state "

<< Transition.State <<

":\n"

;

300 if

(DiagName.empty())

303 for

(

auto

&Mapping : *Transition.State) {

307 if

(!DiagName.empty() && DiagName != Option)

311

llvm::errs() <<

" "

;

313

llvm::errs() <<

"<unknown "

<< Mapping.first <<

">"

;

315

llvm::errs() << Option;

316

llvm::errs() <<

": "

;

318 switch

(Mapping.second.getSeverity()) {

326 if

(!Mapping.second.isUser())

327

llvm::errs() <<

" default"

;

328 if

(Mapping.second.isPragma())

329

llvm::errs() <<

" pragma"

;

330 if

(Mapping.second.hasNoWarningAsError())

331

llvm::errs() <<

" no-error"

;

332 if

(Mapping.second.hasNoErrorAsFatal())

333

llvm::errs() <<

" no-fatal"

;

334 if

(Mapping.second.wasUpgradedFromWarning())

335

llvm::errs() <<

" overruled"

;

336

llvm::errs() <<

"\n"

;

342void

DiagnosticsEngine::PushDiagStatePoint(DiagState *State,

344

assert(

Loc

.

isValid

() &&

"Adding invalid loc point"

);

345

DiagStatesByLoc.append(*SourceMgr,

Loc

, State);

350

assert((Diags->isWarningOrExtension(

Diag

) ||

352 "Cannot map errors into warnings!"

);

353

assert((L.

isInvalid

() || SourceMgr) &&

"No SourceMgr for valid location"

);

357 bool

WasUpgradedFromWarning =

false

;

363

WasUpgradedFromWarning =

true

;

376 if

((L.

isInvalid

() || L == DiagStatesByLoc.getCurDiagStateLoc()) &&

377

DiagStatesByLoc.getCurDiagState()) {

382

DiagStatesByLoc.getCurDiagState()->setMapping(

Diag

, Mapping);

389

DiagStates.push_back(*GetCurDiagState());

390

DiagStates.back().setMapping(

Diag

, Mapping);

391

PushDiagStatePoint(&DiagStates.back(), L);

399 if

(Diags->getDiagnosticsInGroup(Flavor, Group, GroupDiags))

402

Diags->setGroupSeverity(Group, Map);

486

std::vector<diag::kind> AllDiags;

491 if

(Diags->isWarningOrExtension(

Diag

))

498class

WarningsSpecialCaseList :

public

llvm::SpecialCaseList {

500 static

std::unique_ptr<WarningsSpecialCaseList>

501

create(

const

llvm::MemoryBuffer &Input, std::string &Err);

516 bool

globsMatches(

const

llvm::StringMap<Matcher> &CategoriesToMatchers,

517

StringRef FilePath)

const

;

519

llvm::DenseMap<diag::kind, const Section *> DiagToSection;

523

std::unique_ptr<WarningsSpecialCaseList>

524

WarningsSpecialCaseList::create(

const

llvm::MemoryBuffer &Input,

526 auto

WarningSuppressionList = std::make_unique<WarningsSpecialCaseList>();

527 if

(!WarningSuppressionList->createInternal(&Input, Err))

529 return

WarningSuppressionList;

536

Sections.erase(

"*"

);

538

std::vector<std::pair<unsigned, const llvm::StringMapEntry<Section> *>>

540

LineAndSectionEntry.reserve(Sections.size());

541 for

(

const auto

&Entry : Sections) {

542

StringRef DiagName = Entry.getKey();

545 const auto

&DiagSectionMatcher = Entry.getValue().SectionMatcher;

546 unsigned

DiagLine = DiagSectionMatcher->Globs.at(DiagName).second;

547

LineAndSectionEntry.emplace_back(DiagLine, &Entry);

549

llvm::sort(LineAndSectionEntry);

551 for

(

const auto

&[_, SectionEntry] : LineAndSectionEntry) {

553

StringRef DiagGroup = SectionEntry->getKey();

555

WarningFlavor, DiagGroup, GroupDiags)) {

556

StringRef Suggestion =

558

Diags.

Report

(diag::warn_unknown_diag_option)

559

<<

static_cast<unsigned>

(WarningFlavor) << DiagGroup

560

<< !Suggestion.empty() << Suggestion;

566

DiagToSection[

Diag

] = &SectionEntry->getValue();

572 auto

WarningSuppressionList = WarningsSpecialCaseList::create(Input,

Error

);

573 if

(!WarningSuppressionList) {

576 Report

(diag::err_drv_malformed_warning_suppression_mapping)

577

<< Input.getBufferIdentifier() <<

Error

;

580

WarningSuppressionList->processSections(*

this

);

581

DiagSuppressionMapping =

582

[WarningSuppressionList(std::move(WarningSuppressionList))](

584 return

WarningSuppressionList->isDiagSuppressed(DiagId, DiagLoc,

SM

);

588bool

WarningsSpecialCaseList::isDiagSuppressed(

diag::kind

DiagId,

591 const

Section *DiagSection = DiagToSection.lookup(DiagId);

594 const

SectionEntries &EntityTypeToCategories = DiagSection->Entries;

595 auto

SrcEntriesIt = EntityTypeToCategories.find(

"src"

);

596 if

(SrcEntriesIt == EntityTypeToCategories.end())

598 const

llvm::StringMap<llvm::SpecialCaseList::Matcher> &CategoriesToMatchers =

599

SrcEntriesIt->getValue();

602 if

(

PresumedLoc

PLoc =

SM

.getPresumedLoc(DiagLoc); PLoc.isValid())

604

CategoriesToMatchers,

605

llvm::sys::path::remove_leading_dotslash(PLoc.getFilename()));

609bool

WarningsSpecialCaseList::globsMatches(

610 const

llvm::StringMap<Matcher> &CategoriesToMatchers,

611

StringRef FilePath)

const

{

612

StringRef LongestMatch;

613 bool

LongestIsPositive =

false

;

614 for

(

const auto

&Entry : CategoriesToMatchers) {

615

StringRef

Category

= Entry.getKey();

616 const

llvm::SpecialCaseList::Matcher &Matcher = Entry.getValue();

617 bool

IsPositive =

Category

!=

"emit"

;

618 for

(

const auto

&[Pattern, Glob] : Matcher.Globs) {

619 if

(Pattern.size() < LongestMatch.size())

621 if

(!Glob.first.match(FilePath))

623

LongestMatch = Pattern;

624

LongestIsPositive = IsPositive;

627 return

LongestIsPositive;

645

assert(Client &&

"DiagnosticConsumer not set!"

);

658

assert(

getClient

() &&

"DiagnosticClient not set!"

);

671

Diags->EmitDiag(*

this

, DB, DiagLevel);

676

Emitted = ProcessDiag(DB);

685

DiagLoc(DiagLoc), DiagID(DiagID), IsActive(

true

) {

686

assert(DiagObj &&

"DiagnosticBuilder requires a valid DiagnosticsEngine!"

);

691

DiagLoc =

D

.DiagLoc;

693

FlagValue =

D

.FlagValue;

694

DiagObj =

D

.DiagObj;

696 D

.DiagStorage =

nullptr

;

698

IsActive =

D

.IsActive;

699

IsForceEmit =

D

.IsForceEmit;

705

: DiagObj(DO), DiagLoc(DiagBuilder.DiagLoc), DiagID(DiagBuilder.DiagID),

706

FlagValue(DiagBuilder.FlagValue), DiagStorage(*DiagBuilder.

getStorage

()) {

711

StringRef StoredDiagMessage)

712

: DiagObj(DO), DiagLoc(DiagLoc), DiagID(DiagID), DiagStorage(DiagStorage),

713

StoredDiagMessage(StoredDiagMessage) {}

729template

<std::

size_t

StrLen>

730static bool ModifierIs

(

const char

*Modifier,

unsigned

ModifierLen,

731 const char

(&Str)[StrLen]) {

732 return

StrLen-1 == ModifierLen && memcmp(Modifier, Str, StrLen-1) == 0;

740 for

( ; I !=

E

; ++I) {

741 if

(Depth == 0 && *I ==

Target

)

return

I;

742 if

(Depth != 0 && *I ==

'}'

) Depth--;

752 for

(I++; I !=

E

&& !

isDigit

(*I) && *I !=

'{'

; I++) ;

768 const char

*Argument,

unsigned

ArgumentLen,

770 const char

*ArgumentEnd = Argument+ArgumentLen;

774 const char

*NextVal =

ScanFormat

(Argument, ArgumentEnd,

'|'

);

775

assert(NextVal != ArgumentEnd &&

"Value for integer select modifier was" 776 " larger than the number of options in the diagnostic string!"

);

777

Argument = NextVal+1;

782 const char

*EndPtr =

ScanFormat

(Argument, ArgumentEnd,

'|'

);

794

OutStr.push_back(

's'

);

803

assert(ValNo != 0 &&

"ValNo must be strictly positive!"

);

805

llvm::raw_svector_ostream Out(OutStr);

809

Out << ValNo << llvm::getOrdinalSuffix(ValNo);

820 static constexpr

std::array<std::pair<int64_t, char>, 4> Units = {

821

{{1'000'000'000'000L,

'T'

},

822

{1'000'000'000L,

'G'

},

826

llvm::raw_svector_ostream Out(OutStr);

831 for

(

const auto

&[UnitSize, UnitSign] : Units) {

832 if

(ValNo >= UnitSize) {

833

Out << llvm::format(

"%0.2f%c"

, ValNo /

static_cast<double>

(UnitSize),

845 while

(Start != End && *Start >=

'0'

&& *Start <=

'9'

) {

847

Val += *Start -

'0'

;

855 if

(*Start !=

'['

) {

862

assert(*Start ==

','

&&

"Bad plural expression syntax: expected ,"

);

865

assert(*Start ==

']'

&&

"Bad plural expression syntax: expected )"

);

867 return

Low <= Val && Val <= High;

871static bool EvalPluralExpr

(

unsigned

ValNo,

const char

*Start,

const char

*End) {

882

assert(*Start ==

'='

&&

"Bad plural expression syntax: expected ="

);

884 unsigned

ValMod = ValNo % Arg;

888

assert((

C

==

'['

|| (

C

>=

'0'

&&

C

<=

'9'

)) &&

889 "Bad plural expression syntax: unexpected character"

);

896

Start = std::find(Start, End,

','

);

938 const char

*Argument,

unsigned

ArgumentLen,

940 const char

*ArgumentEnd = Argument + ArgumentLen;

942

assert(Argument < ArgumentEnd &&

"Plural expression didn't match."

);

943 const char

*ExprEnd = Argument;

944 while

(*ExprEnd !=

':'

) {

945

assert(ExprEnd != ArgumentEnd &&

"Plural missing expression end"

);

949

Argument = ExprEnd + 1;

950

ExprEnd =

ScanFormat

(Argument, ArgumentEnd,

'|'

);

957

Argument =

ScanFormat

(Argument, ArgumentEnd - 1,

'|'

) + 1;

966 case

tok::identifier:

967 return "identifier"

;

978 if

(StoredDiagMessage.has_value()) {

979

OutStr.append(StoredDiagMessage->begin(), StoredDiagMessage->end());

993

OutStr.reserve(OutStr.size() + Str.size());

994 auto

*

Begin

=

reinterpret_cast<const unsigned char

*

>

(Str.data());

995

llvm::raw_svector_ostream OutStream(OutStr);

996 const unsigned char

*End =

Begin

+ Str.size();

997 while

(

Begin

!= End) {

1000

OutStream << *

Begin

;

1004 if

(llvm::isLegalUTF8Sequence(

Begin

, End)) {

1005

llvm::UTF32 CodepointValue;

1006

llvm::UTF32 *CpPtr = &CodepointValue;

1007 const unsigned char

*CodepointBegin =

Begin

;

1008 const unsigned char

*CodepointEnd =

1010

llvm::ConversionResult Res = llvm::ConvertUTF8toUTF32(

1011

&

Begin

, CodepointEnd, &CpPtr, CpPtr + 1, llvm::strictConversion);

1014

llvm::conversionOK == Res &&

1015 "the sequence is legal UTF-8 but we couldn't convert it to UTF-32"

);

1016

assert(

Begin

== CodepointEnd &&

1017 "we must be further along in the string now"

);

1018 if

(llvm::sys::unicode::isPrintable(CodepointValue) ||

1019

llvm::sys::unicode::isFormatting(CodepointValue)) {

1020

OutStr.append(CodepointBegin, CodepointEnd);

1024

OutStream <<

"<U+"

<< llvm::format_hex_no_prefix(CodepointValue, 4,

true

)

1029

OutStream <<

"<"

<< llvm::format_hex_no_prefix(*

Begin

, 2,

true

) <<

">"

;

1040 if

(DiagEnd - DiagStr == 2 && StringRef(DiagStr, DiagEnd - DiagStr) ==

"%0"

&&

1058 for

(

unsigned

i = 0, e =

getNumArgs

(); i < e; ++i)

1062 while

(DiagStr != DiagEnd) {

1063 if

(DiagStr[0] !=

'%'

) {

1065 const char

*StrEnd = std::find(DiagStr, DiagEnd,

'%'

);

1066

OutStr.append(DiagStr, StrEnd);

1070

OutStr.push_back(DiagStr[1]);

1083 const char

*Modifier =

nullptr

, *Argument =

nullptr

;

1084 unsigned

ModifierLen = 0, ArgumentLen = 0;

1089 while

(DiagStr[0] ==

'-'

||

1090

(DiagStr[0] >=

'a'

&& DiagStr[0] <=

'z'

))

1092

ModifierLen = DiagStr-Modifier;

1095 if

(DiagStr[0] ==

'{'

) {

1099

DiagStr =

ScanFormat

(DiagStr, DiagEnd,

'}'

);

1100

assert(DiagStr != DiagEnd &&

"Mismatched {}'s in diagnostic string!"

);

1101

ArgumentLen = DiagStr-Argument;

1106

assert(

isDigit

(*DiagStr) &&

"Invalid format for argument in diagnostic"

);

1107 unsigned

ArgNo = *DiagStr++ -

'0'

;

1110 unsigned

ArgNo2 = ArgNo;

1113 if

(

ModifierIs

(Modifier, ModifierLen,

"diff"

)) {

1114

assert(*DiagStr ==

','

&&

isDigit

(*(DiagStr + 1)) &&

1115 "Invalid format for diff modifier"

);

1117

ArgNo2 = *DiagStr++ -

'0'

;

1128 const char

*ArgumentEnd = Argument + ArgumentLen;

1130

assert(

ScanFormat

(

Pipe

+ 1, ArgumentEnd,

'|'

) == ArgumentEnd &&

1131 "Found too many '|'s in a %diff modifier!"

);

1133 const char

*SecondDollar =

ScanFormat

(FirstDollar + 1,

Pipe

,

'$'

);

1134 const char

ArgStr1[] = {

'%'

,

static_cast<char>

(

'0'

+ ArgNo) };

1135 const char

ArgStr2[] = {

'%'

,

static_cast<char>

(

'0'

+ ArgNo2) };

1149

assert(ModifierLen == 0 &&

"No modifiers for strings yet"

);

1155

assert(ModifierLen == 0 &&

"No modifiers for strings yet"

);

1167 if

(

ModifierIs

(Modifier, ModifierLen,

"select"

)) {

1170

}

else if

(

ModifierIs

(Modifier, ModifierLen,

"s"

)) {

1172

}

else if

(

ModifierIs

(Modifier, ModifierLen,

"plural"

)) {

1175

}

else if

(

ModifierIs

(Modifier, ModifierLen,

"ordinal"

)) {

1177

}

else if

(

ModifierIs

(Modifier, ModifierLen,

"human"

)) {

1180

assert(ModifierLen == 0 &&

"Unknown integer modifier"

);

1181

llvm::raw_svector_ostream(OutStr) << Val;

1188 if

(

ModifierIs

(Modifier, ModifierLen,

"select"

)) {

1190

}

else if

(

ModifierIs

(Modifier, ModifierLen,

"s"

)) {

1192

}

else if

(

ModifierIs

(Modifier, ModifierLen,

"plural"

)) {

1195

}

else if

(

ModifierIs

(Modifier, ModifierLen,

"ordinal"

)) {

1197

}

else if

(

ModifierIs

(Modifier, ModifierLen,

"human"

)) {

1200

assert(ModifierLen == 0 &&

"Unknown integer modifier"

);

1201

llvm::raw_svector_ostream(OutStr) << Val;

1208

assert(ModifierLen == 0 &&

"No modifiers for token kinds yet"

);

1210

llvm::raw_svector_ostream Out(OutStr);

1213

Out <<

'\''

<< S <<

'\''

;

1222

Out <<

'<'

<< S <<

'>'

;

1230

assert(ModifierLen == 0 &&

"No modifiers for strings yet"

);

1234 const char

*S =

"(null)"

;

1235

OutStr.append(S, S + strlen(S));

1239

llvm::raw_svector_ostream(OutStr) <<

'\''

<< II->

getName

() <<

'\''

;

1251

StringRef(Modifier, ModifierLen),

1252

StringRef(Argument, ArgumentLen),

1254

OutStr, QualTypeVals);

1266 const char

*ArgumentEnd = Argument + ArgumentLen;

1271 if

(

getDiags

()->PrintTemplateTree &&

Tree

.empty()) {

1275

StringRef(Modifier, ModifierLen),

1276

StringRef(Argument, ArgumentLen),

1278 Tree

, QualTypeVals);

1280 if

(!

Tree

.empty()) {

1288 const char

*FirstDollar =

ScanFormat

(Argument, ArgumentEnd,

'$'

);

1289 const char

*SecondDollar =

ScanFormat

(FirstDollar + 1, ArgumentEnd,

'$'

);

1298

StringRef(Modifier, ModifierLen),

1299

StringRef(Argument, ArgumentLen),

1301

OutStr, QualTypeVals);

1312

StringRef(Modifier, ModifierLen),

1313

StringRef(Argument, ArgumentLen),

1315

OutStr, QualTypeVals);

1332

FormattedArgs.push_back(std::make_pair(Kind,

getRawArg

(ArgNo)));

1339

OutStr.append(

Tree

.begin(),

Tree

.end());

1344

: ID(ID), Level(Level), Message(Message) {}

1348

: ID(Info.getID()), Level(Level) {

1350 "Valid source location without setting a source manager for diagnostic"

);

1355

this->Message.assign(Message.begin(), Message.end());

1364

: ID(ID), Level(Level),

Loc

(

Loc

), Message(Message),

1365

Ranges(Ranges.begin(), Ranges.end()), FixIts(FixIts.begin(), FixIts.end())

1383void

IgnoringDiagConsumer::anchor() {}

1390 Target

.HandleDiagnostic(DiagLevel, Info);

1399 return Target

.IncludeInDiagnosticCounts();

1403 for

(

unsigned

I = 0; I != NumCached; ++I)

1404

FreeList[I] = Cached + I;

1405

NumFreeListEntries = NumCached;

1411

assert((NumFreeListEntries == NumCached ||

1412

llvm::CrashRecoveryContext::isRecoveringFromCrash()) &&

1413 "A partial is on the lam"

);

static const char * ScanFormat(const char *I, const char *E, char Target)

ScanForward - Scans forward, looking for the given character, skipping nested clauses and escaped cha...

static void HandlePluralModifier(const Diagnostic &DInfo, unsigned ValNo, const char *Argument, unsigned ArgumentLen, SmallVectorImpl< char > &OutStr)

HandlePluralModifier - Handle the integer 'plural' modifier.

static void HandleIntegerSModifier(unsigned ValNo, SmallVectorImpl< char > &OutStr)

HandleIntegerSModifier - Handle the integer 's' modifier.

static void DummyArgToStringFn(DiagnosticsEngine::ArgumentKind AK, intptr_t QT, StringRef Modifier, StringRef Argument, ArrayRef< DiagnosticsEngine::ArgumentValue > PrevArgs, SmallVectorImpl< char > &Output, void *Cookie, ArrayRef< intptr_t > QualTypeVals)

static bool EvalPluralExpr(unsigned ValNo, const char *Start, const char *End)

EvalPluralExpr - Actual expression evaluator for HandlePluralModifier.

static void HandleIntegerHumanModifier(int64_t ValNo, SmallVectorImpl< char > &OutStr)

static unsigned PluralNumber(const char *&Start, const char *End)

PluralNumber - Parse an unsigned integer and advance Start.

static void HandleSelectModifier(const Diagnostic &DInfo, unsigned ValNo, const char *Argument, unsigned ArgumentLen, SmallVectorImpl< char > &OutStr)

HandleSelectModifier - Handle the integer 'select' modifier.

static bool ModifierIs(const char *Modifier, unsigned ModifierLen, const char(&Str)[StrLen])

ModifierIs - Return true if the specified modifier matches specified string.

static bool TestPluralRange(unsigned Val, const char *&Start, const char *End)

TestPluralRange - Test if Val is in the parsed range. Modifies Start.

static void HandleOrdinalModifier(unsigned ValNo, SmallVectorImpl< char > &OutStr)

HandleOrdinalModifier - Handle the integer 'ord' modifier.

static const char * getTokenDescForDiagnostic(tok::TokenKind Kind)

Returns the friendly description for a token kind that will appear without quotes in diagnostic messa...

Defines the Diagnostic-related interfaces.

static llvm::GlobalValue::DLLStorageClassTypes getStorage(CodeGenModule &CGM, StringRef Name)

Defines the Diagnostic IDs-related interfaces.

Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.

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.

llvm::MachO::Target Target

Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream.

static std::string toString(const clang::SanitizerSet &Sanitizers)

Produce a string containing comma-separated names of sanitizers in Sanitizers set.

Defines the clang::SourceLocation class and associated facilities.

Defines the SourceManager interface.

Defines various enumerations that describe declaration and type specifiers.

Defines the clang::TokenKind enum and support functions.

A little helper class used to produce diagnostics.

Abstract interface, implemented by clients of the front-end, which formats and prints fully processed...

virtual ~DiagnosticConsumer()

virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info)

Handle this diagnostic, reporting it to the user or capturing it to a log as needed.

unsigned NumErrors

Number of errors reported.

unsigned NumWarnings

Number of warnings reported.

virtual bool IncludeInDiagnosticCounts() const

Indicates whether the diagnostics handled by this DiagnosticConsumer should be included in the number...

static StringRef getNearestOption(diag::Flavor Flavor, StringRef Group)

Get the diagnostic option with the closest edit distance to the given group name.

static bool IsCustomDiag(diag::kind Diag)

Level

The level of the diagnostic, after it has been through mapping.

static void getAllDiagnostics(diag::Flavor Flavor, std::vector< diag::kind > &Diags)

Get the set of all diagnostic IDs.

void setNoWarningAsError(bool Value)

void setSeverity(diag::Severity Value)

diag::Severity getSeverity() const

void setUpgradedFromWarning(bool Value)

void setNoErrorAsFatal(bool Value)

bool hasNoWarningAsError() const

A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine a...

Diagnostic(const DiagnosticsEngine *DO, const DiagnosticBuilder &DiagBuilder)

const SourceLocation & getLocation() const

const std::string & getArgStdStr(unsigned Idx) const

Return the provided argument string specified by Idx.

void FormatDiagnostic(SmallVectorImpl< char > &OutStr) const

Format this diagnostic into a string, substituting the formal arguments into the %0 slots.

uint64_t getRawArg(unsigned Idx) const

Return the specified non-string argument in an opaque form.

const char * getArgCStr(unsigned Idx) const

Return the specified C string argument.

const IdentifierInfo * getArgIdentifier(unsigned Idx) const

Return the specified IdentifierInfo argument.

SourceManager & getSourceManager() const

ArrayRef< FixItHint > getFixItHints() const

unsigned getNumArgs() const

bool hasSourceManager() const

DiagnosticsEngine::ArgumentKind getArgKind(unsigned Idx) const

Return the kind of the specified index.

int64_t getArgSInt(unsigned Idx) const

Return the specified signed integer argument.

uint64_t getArgUInt(unsigned Idx) const

Return the specified unsigned integer argument.

ArrayRef< CharSourceRange > getRanges() const

Return an array reference for this diagnostic's ranges.

const DiagnosticsEngine * getDiags() const

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 hasSourceManager() const

bool EmitDiagnostic(const DiagnosticBuilder &DB, bool Force=false)

Emit the diagnostic.

void setDiagSuppressionMapping(llvm::MemoryBuffer &Input)

Diagnostic suppression mappings can be used to suppress specific diagnostics in specific files.

bool isSuppressedViaMapping(diag::kind DiagId, SourceLocation DiagLoc) const

void setSeverityForAll(diag::Flavor Flavor, diag::Severity Map, SourceLocation Loc=SourceLocation())

Add the specified mapping to all diagnostics of the specified flavor.

LLVM_DUMP_METHOD void dump() const

void setClient(DiagnosticConsumer *client, bool ShouldOwnClient=true)

Set the diagnostic client associated with this diagnostic object.

SourceManager & getSourceManager() const

void pushMappings(SourceLocation Loc)

Copies the current DiagMappings and pushes the new copy onto the top of the stack.

void setSeverity(diag::kind Diag, diag::Severity Map, SourceLocation Loc)

This allows the client to specify that certain warnings are ignored.

Level

The level of the diagnostic, after it has been through mapping.

DiagnosticConsumer * getClient()

@ ak_nameddecl

NamedDecl *.

@ ak_declcontext

DeclContext *.

@ ak_addrspace

address space

@ ak_identifierinfo

IdentifierInfo.

@ ak_qualtype_pair

pair<QualType, QualType>

@ ak_c_string

const char *

@ ak_declarationname

DeclarationName.

@ ak_tokenkind

enum TokenKind : unsigned

@ ak_std_string

std::string

@ ak_nestednamespec

NestedNameSpecifier *.

Level getDiagnosticLevel(unsigned DiagID, SourceLocation Loc) const

Based on the way the client configured the DiagnosticsEngine object, classify the specified diagnosti...

DiagnosticsEngine(IntrusiveRefCntPtr< DiagnosticIDs > Diags, IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, DiagnosticConsumer *client=nullptr, bool ShouldOwnClient=true)

bool setDiagnosticGroupErrorAsFatal(StringRef Group, bool Enabled)

Set the error-as-fatal flag for the given diagnostic group.

bool setDiagnosticGroupWarningAsError(StringRef Group, bool Enabled)

Set the warning-as-error flag for the given diagnostic group.

void ConvertArgToString(ArgumentKind Kind, intptr_t Val, StringRef Modifier, StringRef Argument, ArrayRef< ArgumentValue > PrevArgs, SmallVectorImpl< char > &Output, ArrayRef< intptr_t > QualTypeVals) const

Converts a diagnostic argument (as an intptr_t) into the string that represents it.

bool setSeverityForGroup(diag::Flavor Flavor, StringRef Group, diag::Severity Map, SourceLocation Loc=SourceLocation())

Change an entire diagnostic group (e.g.

bool popMappings(SourceLocation Loc)

Pops the current DiagMappings off the top of the stack, causing the new top of the stack to be the ac...

const IntrusiveRefCntPtr< DiagnosticIDs > & getDiagnosticIDs() const

void Reset(bool soft=false)

Reset the state of the diagnostic object to its initial configuration.

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

bool IncludeInDiagnosticCounts() const override

Indicates whether the diagnostics handled by this DiagnosticConsumer should be included in the number...

~ForwardingDiagnosticConsumer() override

void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info) override

Handle this diagnostic, reporting it to the user or capturing it to a log as needed.

A SourceLocation and its associated SourceManager.

bool hasManager() const

Checks whether the SourceManager is present.

const SourceManager & getManager() const

One of these records is kept for each identifier that is lexed.

StringRef getName() const

Return the actual identifier string.

Represents an unpacked "presumed" location which can be presented to the user.

Encodes a location in the source.

std::string printToString(const SourceManager &SM) const

bool isValid() const

Return true if this is a valid SourceLocation object.

void print(raw_ostream &OS, const SourceManager &SM) const

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.

DiagnosticsEngine & getDiagnostics() const

llvm::MemoryBufferRef getBufferOrFake(FileID FID, SourceLocation Loc=SourceLocation()) const

Return the buffer for the specified FileID.

std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const

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

SourceLocation getLocForStartOfFile(FileID FID) const

Return the source location corresponding to the first byte of the specified file.

std::pair< FileID, unsigned > getDecomposedIncludedLoc(FileID FID) const

Returns the "included/expanded in" decomposed location of the given FileID.

Represents a diagnostic in a form that can be retained until its corresponding source manager is dest...

range_iterator range_begin() const

StoredDiagnostic()=default

DiagnosticsEngine::Level getLevel() const

fixit_iterator fixit_begin() const

const FullSourceLoc & getLocation() const

range_iterator range_end() const

StringRef getMessage() const

fixit_iterator fixit_end() const

The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.

DiagStorageAllocator * Allocator

Allocator used to allocate storage for this diagnostic.

DiagnosticStorage * DiagStorage

void AddString(StringRef V) const

Flavor

Flavors of diagnostics we can emit.

@ WarningOrError

A diagnostic that indicates a problem or potential problem.

Severity

Enum values that allow the client to map NOTEs, WARNINGs, and EXTENSIONs to either Ignore (nothing),...

@ Warning

Present this diagnostic as a warning.

@ Fatal

Present this diagnostic as a fatal error.

@ Error

Present this diagnostic as an error.

@ Remark

Present this diagnostic as a remark.

@ Ignored

Do not present this diagnostic, ignore it.

const char * getTokenName(TokenKind Kind) LLVM_READNONE

Determines the name of a token as used within the front end.

const char * getKeywordSpelling(TokenKind Kind) LLVM_READNONE

Determines the spelling of simple keyword and contextual keyword tokens like 'int' and 'dynamic_cast'...

TokenKind

Provides a simple uniform namespace for tokens from all C languages.

const char * getPunctuatorSpelling(TokenKind Kind) LLVM_READNONE

Determines the spelling of simple punctuation tokens like '!' or '', and returns NULL for literal and...

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

LLVM_READONLY bool isPrintable(unsigned char c)

Return true if this character is an ASCII printable character; that is, a character that should take ...

const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)

Insertion operator for diagnostics.

@ Result

The result type of a method or function.

llvm::StringRef getNullabilitySpelling(NullabilityKind kind, bool isContextSensitive=false)

Retrieve the spelling of the given nullability kind.

void EscapeStringForDiagnostic(StringRef Str, SmallVectorImpl< char > &OutStr)

EscapeStringForDiagnostic - Append Str to the diagnostic buffer, escaping non-printable characters an...

LLVM_READONLY bool isDigit(unsigned char c)

Return true if this character is an ASCII digit: [0-9].

LLVM_READONLY bool isWhitespace(unsigned char c)

Return true if this character is horizontal or vertical ASCII whitespace: ' ', '\t',...

std::pair< NullabilityKind, bool > DiagNullabilityKind

A nullability kind paired with a bit indicating whether it used a context-sensitive keyword.

LLVM_READONLY bool isPunctuation(unsigned char c)

Return true if this character is an ASCII punctuation character.

__INTPTR_TYPE__ intptr_t

A signed integer type with the property that any valid pointer to void can be converted to this type,...

SmallVector< CharSourceRange, 8 > DiagRanges

The list of ranges added to this diagnostic.

SmallVector< FixItHint, 6 > FixItHints

If valid, provides a hint with some code to insert, remove, or modify at a particular position.

unsigned TemplateDiffUsed


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4