Lines Matching +full:auto +full:- +full:range

1 //===-- HTMLLogger.cpp ----------------------------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
14 // so each output file is self-contained.
47 // (id or data-foo) that define what they should select.
51 // - sections <section data-selection="bb"> get shown
52 // - templates under such sections get re-rendered
53 // - elements with class/id "B2" get class "bb-select"
55 //===----------------------------------------------------------------------===//
108 for (const auto& Prop : V.properties()) in dump()
114 if (auto *B = llvm::dyn_cast<BoolValue>(&V)) { in dump()
115 JOS.attribute("formula", llvm::to_string(B->formula())); in dump()
116 JOS.attribute("truth", Env.proves(B->formula()) ? "true" in dump()
117 : Env.proves(Env.arena().makeNot(B->formula())) in dump()
128 if (!L.getType()->isRecordType()) in dump()
129 if (auto *V = Env.getValue(L)) in dump()
132 if (auto *RLoc = dyn_cast<RecordStorageLocation>(&L)) { in dump()
133 for (const auto &Child : RLoc->children()) in dump()
134 JOS.attributeObject("f:" + Child.first->getNameAsString(), [&] { in dump()
140 for (const auto &SyntheticField : RLoc->synthetic_fields()) in dump()
182 this->ACFG = &ACFG; in beginAnalysis()
187 const auto &D = ACFG.getDecl(); in beginAnalysis()
188 const auto &SM = A.getASTContext().getSourceManager(); in beginAnalysis()
190 if (const auto *ND = dyn_cast<NamedDecl>(&D)) in beginAnalysis()
191 *OS << ND->getNameAsString() << " at "; in beginAnalysis()
211 for (const auto &E : Iters) { in endAnalysis()
213 JOS.attribute("block", blockID(E.Block->getBlockID())); in endAnalysis()
221 for (const auto &E : BlockIters) in endAnalysis()
264 // - values associated with the current Stmt
265 // - values associated with its children
266 // - meaningful names for values
267 // - which boolean values are implied true/false by the flow condition
269 unsigned Block = Iters.back().Block->getBlockID(); in recordState()
278 // If this state immediately follows an Expr, show its built-in model. in recordState()
280 auto S = in recordState()
281 Iters.back().Block->Elements[ElementIndex - 1].getAs<CFGStmt>(); in recordState()
282 if (const Expr *E = S ? llvm::dyn_cast<Expr>(S->getStmt()) : nullptr) { in recordState()
283 if (E->isPRValue()) { in recordState()
284 if (!E->getType()->isRecordType()) in recordState()
285 if (auto *V = State.Env.getValue(*E)) in recordState()
289 if (auto *Loc = State.Env.getStorageLocation(*E)) in recordState()
309 BlockConverged[Iters.back().Block->getBlockID()] = true; in blockConverged()
334 for (const auto &Elt : B.Elements) { in writeBlock()
349 const auto &AST = ACFG->getDecl().getASTContext(); in writeCode()
353 // Pretty-printing from the AST would probably be nicer (no macros or in writeCode()
356 auto Range = clang::Lexer::makeFileCharRange( in writeCode() local
357 CharSourceRange::getTokenRange(ACFG->getDecl().getSourceRange()), in writeCode()
359 if (Range.isInvalid()) in writeCode()
362 Range, AST.getSourceManager(), AST.getLangOpts(), &Invalid); in writeCode()
368 enum : unsigned { Missing = static_cast<unsigned>(-1) }; in writeCode()
371 // This is the BB of the stmt with the smallest containing range. in writeCode()
374 // The most specific stmt this is part of (smallest range). in writeCode()
381 // RangeLen is the character length of the element's range, used to in writeCode()
384 // However "a" has a smaller range, so is more specific. Clicking on the in writeCode()
387 // A worse BB (larger range) => ignore. in writeCode()
388 if (this->BB != Missing && BB != this->BB && BBPriority <= RangeLen) in writeCode()
390 if (BB != this->BB) { in writeCode()
391 this->BB = BB; in writeCode()
397 if (this->Elt == Missing || EltPriority > RangeLen) in writeCode()
398 this->Elt = Elt; in writeCode()
414 OS << " data-elt='" << eltID(BB, Elt) << "'"; in writeCode()
416 OS << " data-bb='" << blockID(BB) << "'"; in writeCode()
423 for (const auto *Block : ACFG->getCFG()) { in writeCode()
425 for (const auto& Elt : *Block) { in writeCode()
427 if (const auto S = Elt.getAs<CFGStmt>()) { in writeCode()
428 auto EltRange = clang::Lexer::makeFileCharRange( in writeCode()
429 CharSourceRange::getTokenRange(S->getStmt()->getSourceRange()), in writeCode()
433 if (EltRange.getBegin() < Range.getBegin() || in writeCode()
434 EltRange.getEnd() >= Range.getEnd() || in writeCode()
435 EltRange.getEnd() < Range.getBegin() || in writeCode()
436 EltRange.getEnd() >= Range.getEnd()) in writeCode()
438 unsigned Off = EltRange.getBegin().getRawEncoding() - in writeCode()
439 Range.getBegin().getRawEncoding(); in writeCode()
440 unsigned Len = EltRange.getEnd().getRawEncoding() - in writeCode()
443 State[Off + I].assign(Block->getBlockID(), EltIndex, Len); in writeCode()
450 AST.getSourceManager().getSpellingLineNumber(Range.getBegin()); in writeCode()
451 *OS << "<template data-copy='code'>\n"; in writeCode()
455 AST.getSourceManager().getFilename(Range.getBegin())), in writeCode()
458 *OS << "<code class='line' data-line='" << Line++ << "'>"; in writeCode()
462 bool NeedOpen = I == 0 || !(State[I] == State[I-1]); in writeCode()
470 *OS << "</code>\n<code class='line' data-line='" << Line++ << "'>"; in writeCode()
483 *OS << "<template data-copy='cfg'>\n"; in writeCFG()
484 if (auto SVG = renderSVG(buildCFGDot(ACFG->getCFG()))) in writeCFG()
498 node[class=bb, shape=square, fontname="sans-serif", tooltip=" "] in buildCFGDot()
510 for (const auto *Block : CFG) { in buildCFGDot()
511 for (const auto &Succ : Block->succs()) { in buildCFGDot()
513 GraphS << " " << blockID(Block->getBlockID()) << " -> " in buildCFGDot()
514 << blockID(Succ.getReachableBlock()->getBlockID()) << "\n"; in buildCFGDot()
522 // Nothing interesting here, just subprocess/temp-file plumbing.
525 if (const auto *FromEnv = ::getenv("GRAPHVIZ_DOT")) in renderSVG()
528 auto FromPath = llvm::sys::findProgramByName("dot"); in renderSVG()
539 if (auto EC = llvm::sys::fs::createTemporaryFile("analysis", ".dot", InputFD, in renderSVG()
543 auto DeleteInput = in renderSVG()
545 if (auto EC = llvm::sys::fs::createTemporaryFile("analysis", ".svg", Output)) in renderSVG()
547 auto DeleteOutput = in renderSVG()
555 DotPath, {"dot", "-Tsvg"}, /*Env=*/std::nullopt, Redirects, in renderSVG()
564 auto Buf = llvm::MemoryBuffer::getFile(Output); in renderSVG()
569 llvm::StringRef Result = Buf.get()->getBuffer(); in renderSVG()
570 auto Pos = Result.find("<svg"); in renderSVG()