njames93 created this revision.
njames93 added reviewers: rsmith, dblaikie, aaron.ballman.
Herald added a subscriber: martong.
Herald added a project: All.
njames93 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Under the hood this prints the same as `QualType::getAsString()` but cuts out
the middle-man when that string is sent to another raw_ostream.
Also cleaned up all the call sites where this occurs.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D123926
Files:
clang/include/clang/AST/Type.h
clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h
clang/lib/AST/RecordLayoutBuilder.cpp
clang/lib/AST/TypePrinter.cpp
clang/lib/AST/VTableBuilder.cpp
clang/lib/Analysis/AnalysisDeclContext.cpp
clang/lib/Analysis/CFG.cpp
clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
clang/lib/Sema/CodeCompleteConsumer.cpp
clang/lib/Sema/SemaInit.cpp
clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp
clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
clang/lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp
clang/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp
clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
clang/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp
clang/lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp
clang/lib/StaticAnalyzer/Checkers/ObjCContainersASTChecker.cpp
clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
clang/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp
clang/lib/StaticAnalyzer/Core/DynamicType.cpp
clang/lib/StaticAnalyzer/Core/MemRegion.cpp
clang/lib/StaticAnalyzer/Core/SVals.cpp
clang/lib/StaticAnalyzer/Core/SymbolManager.cpp
clang/unittests/AST/ASTTraverserTest.cpp
Index: clang/unittests/AST/ASTTraverserTest.cpp
===================================================================
--- clang/unittests/AST/ASTTraverserTest.cpp
+++ clang/unittests/AST/ASTTraverserTest.cpp
@@ -60,7 +60,7 @@
if (const auto *F = Init->getAnyMember()) {
OS << " '" << F->getNameAsString() << "'";
} else if (auto const *TSI = Init->getTypeSourceInfo()) {
- OS << " '" << TSI->getType().getAsString() << "'";
+ OS << " '" << TSI->getType() << "'";
}
}
@@ -81,7 +81,7 @@
OS << "TemplateArgument";
switch (A.getKind()) {
case TemplateArgument::Type: {
- OS << " type " << A.getAsType().getAsString();
+ OS << " type " << A.getAsType();
break;
}
default:
Index: clang/lib/StaticAnalyzer/Core/SymbolManager.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/SymbolManager.cpp
+++ clang/lib/StaticAnalyzer/Core/SymbolManager.cpp
@@ -65,14 +65,13 @@
}
void SymbolCast::dumpToStream(raw_ostream &os) const {
- os << '(' << ToTy.getAsString() << ") (";
+ os << '(' << ToTy << ") (";
Operand->dumpToStream(os);
os << ')';
}
void SymbolConjured::dumpToStream(raw_ostream &os) const {
- os << getKindStr() << getSymbolID() << '{' << T.getAsString() << ", LC"
- << LCtx->getID();
+ os << getKindStr() << getSymbolID() << '{' << T << ", LC" << LCtx->getID();
if (S)
os << ", S" << S->getID(LCtx->getDecl()->getASTContext());
else
@@ -90,15 +89,13 @@
}
void SymbolMetadata::dumpToStream(raw_ostream &os) const {
- os << getKindStr() << getSymbolID() << '{' << getRegion() << ','
- << T.getAsString() << '}';
+ os << getKindStr() << getSymbolID() << '{' << getRegion() << ',' << T << '}';
}
void SymbolData::anchor() {}
void SymbolRegionValue::dumpToStream(raw_ostream &os) const {
- os << getKindStr() << getSymbolID() << '<' << getType().getAsString() << ' '
- << R << '>';
+ os << getKindStr() << getSymbolID() << '<' << getType() << ' ' << R << '>';
}
bool SymExpr::symbol_iterator::operator==(const symbol_iterator &X) const {
Index: clang/lib/StaticAnalyzer/Core/SVals.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/SVals.cpp
+++ clang/lib/StaticAnalyzer/Core/SVals.cpp
@@ -401,7 +401,7 @@
else
os << ", ";
- os << (*I).getType().getAsString();
+ os << I->getType();
}
os << '}';
Index: clang/lib/StaticAnalyzer/Core/MemRegion.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/MemRegion.cpp
+++ clang/lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -480,7 +480,7 @@
}
void CXXTempObjectRegion::dumpToStream(raw_ostream &os) const {
- os << "temp_object{" << getValueType().getAsString() << ", "
+ os << "temp_object{" << getValueType() << ", "
<< "S" << Ex->getID(getContext()) << '}';
}
@@ -497,8 +497,8 @@
}
void ElementRegion::dumpToStream(raw_ostream &os) const {
- os << "Element{" << superRegion << ','
- << Index << ',' << getElementType().getAsString() << '}';
+ os << "Element{" << superRegion << ',' << Index << ',' << getElementType()
+ << '}';
}
void FieldRegion::dumpToStream(raw_ostream &os) const {
Index: clang/lib/StaticAnalyzer/Core/DynamicType.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/DynamicType.cpp
+++ clang/lib/StaticAnalyzer/Core/DynamicType.cpp
@@ -209,7 +209,7 @@
if (ToPrint->isAnyPointerType())
ToPrint = ToPrint->getPointeeType();
- Out << '\"' << ToPrint.getAsString() << "\", \"sub_classable\": "
+ Out << '\"' << ToPrint << "\", \"sub_classable\": "
<< (DTI.canBeASubClass() ? "true" : "false");
}
return Out;
@@ -217,9 +217,9 @@
static raw_ostream &printJson(const DynamicCastInfo &DCI, raw_ostream &Out,
const char *NL, unsigned int Space, bool IsDot) {
- return Out << "\"from\": \"" << DCI.from().getAsString() << "\", \"to\": \""
- << DCI.to().getAsString() << "\", \"kind\": \""
- << (DCI.succeeds() ? "success" : "fail") << "\"";
+ return Out << "\"from\": \"" << DCI.from() << "\", \"to\": \"" << DCI.to()
+ << "\", \"kind\": \"" << (DCI.succeeds() ? "success" : "fail")
+ << "\"";
}
template <class T, class U>
Index: clang/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp
@@ -145,7 +145,7 @@
OS << '\'' << I->getSExtValue() << "\', which is";
OS << " greater or equal to the width of type '"
- << B->getLHS()->getType().getAsString() << "'.";
+ << B->getLHS()->getType() << "'.";
} else if (B->getOpcode() == BinaryOperatorKind::BO_Shl &&
C.isNegative(B->getLHS())) {
OS << "The result of the left shift is undefined because the left "
@@ -162,8 +162,7 @@
OS << "The result of the left shift is undefined due to shifting \'"
<< LHS->getSExtValue() << "\' by \'" << RHS->getZExtValue()
<< "\', which is unrepresentable in the unsigned version of "
- << "the return type \'" << B->getLHS()->getType().getAsString()
- << "\'";
+ << "the return type \'" << B->getLHS()->getType() << "\'";
Ex = B->getLHS();
} else {
OS << "The result of the '"
Index: clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
+++ clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
@@ -261,14 +261,12 @@
}
if (CurrV.getObjKind() == ObjKind::CF) {
- os << "a Core Foundation object of type '"
- << Sym->getType().getAsString() << "' with a ";
+ os << "a Core Foundation object of type '" << Sym->getType() << "' with a ";
} else if (CurrV.getObjKind() == ObjKind::OS) {
os << "an OSObject of type '" << findAllocatedObjectName(S, Sym->getType())
<< "' with a ";
} else if (CurrV.getObjKind() == ObjKind::Generalized) {
- os << "an object of type '" << Sym->getType().getAsString()
- << "' with a ";
+ os << "an object of type '" << Sym->getType() << "' with a ";
} else {
assert(CurrV.getObjKind() == ObjKind::ObjC);
QualType T = Sym->getType();
@@ -276,8 +274,7 @@
os << "an Objective-C object with a ";
} else {
const ObjCObjectPointerType *PT = cast<ObjCObjectPointerType>(T);
- os << "an instance of " << PT->getPointeeType().getAsString()
- << " with a ";
+ os << "an instance of " << PT->getPointeeType() << " with a ";
}
}
Index: clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
@@ -45,7 +45,7 @@
void RefVal::print(raw_ostream &Out) const {
if (!T.isNull())
- Out << "Tracked " << T.getAsString() << " | ";
+ Out << "Tracked " << T << " | ";
switch (getKind()) {
default: llvm_unreachable("Invalid RefVal kind");
Index: clang/lib/StaticAnalyzer/Checkers/ObjCContainersASTChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/ObjCContainersASTChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/ObjCContainersASTChecker.cpp
@@ -135,9 +135,9 @@
llvm::raw_svector_ostream Os(Buf);
// Use "second" and "third" since users will expect 1-based indexing
// for parameter names when mentioned in prose.
- Os << " The "<< ((ArgNum == 1) ? "second" : "third") << " argument to '"
- << Name << "' must be a C array of pointer-sized values, not '"
- << Arg->getType().getAsString() << "'";
+ Os << " The " << ((ArgNum == 1) ? "second" : "third") << " argument to '"
+ << Name << "' must be a C array of pointer-sized values, not '"
+ << Arg->getType() << "'";
PathDiagnosticLocation CELoc =
PathDiagnosticLocation::createBegin(CE, BR.getSourceManager(), AC);
Index: clang/lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp
@@ -143,7 +143,7 @@
else
OS << "Converting ";
- OS << "a pointer value of type '" << ObjT.getAsString() << "' to a ";
+ OS << "a pointer value of type '" << ObjT << "' to a ";
std::string EuphemismForPlain = "primitive";
std::string SuggestedApi = IsObjC ? (IsInteger ? "" : "-boolValue")
Index: clang/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp
@@ -228,9 +228,9 @@
OS << '\'' << Callee->getIdentifier()->getName() << '\'';
else
OS << "call";
- OS << " is converted to a pointer of type '"
- << PointeeType.getAsString() << "', which is incompatible with "
- << "sizeof operand type '" << SizeofType.getAsString() << "'";
+ OS << " is converted to a pointer of type '" << PointeeType
+ << "', which is incompatible with "
+ << "sizeof operand type '" << SizeofType << "'";
SmallVector<SourceRange, 4> Ranges;
Ranges.push_back(i->AllocCall->getCallee()->getSourceRange());
Ranges.push_back(SFinder.Sizeofs[0]->getSourceRange());
Index: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -3445,7 +3445,7 @@
allocation_state::getContainerObjRegion(statePrev, Sym);
const auto *TypedRegion = cast<TypedValueRegion>(ObjRegion);
QualType ObjTy = TypedRegion->getValueType();
- OS << "Inner buffer of '" << ObjTy.getAsString() << "' ";
+ OS << "Inner buffer of '" << ObjTy << "' ";
if (N->getLocation().getKind() == ProgramPoint::PostImplicitCallKind) {
OS << "deallocated by call to destructor";
Index: clang/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp
@@ -273,7 +273,7 @@
os << (*I)->getName();
}
}
- os << " (type " << FieldChain.back()->getType().getAsString() << ")";
+ os << " (type " << FieldChain.back()->getType() << ")";
// Note that this will fire for every translation unit that uses this
// class. This is suboptimal, but at least scan-build will merge
Index: clang/lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp
@@ -320,8 +320,7 @@
SmallString<256> Buf;
llvm::raw_svector_ostream OS(Buf);
- OS << "Pointer to inner buffer of '" << ObjTy.getAsString()
- << "' obtained here";
+ OS << "Pointer to inner buffer of '" << ObjTy << "' obtained here";
PathDiagnosticLocation Pos(S, BRC.getSourceManager(),
N->getLocationContext());
return std::make_shared<PathDiagnosticEventPiece>(Pos, OS.str(), true);
Index: clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
+++ clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
@@ -325,7 +325,7 @@
llvm::raw_svector_ostream os(sbuf);
os << "Variable '" << drCond->getDecl()->getName()
- << "' with floating point type '" << drCond->getType().getAsString()
+ << "' with floating point type '" << drCond->getType()
<< "' should not be used as a loop counter";
ranges.push_back(drCond->getSourceRange());
Index: clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp
+++ clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp
@@ -55,13 +55,11 @@
<< *MethAncestor->getClassInterface()
<< "', defines the instance method '";
MethDerived->getSelector().print(os);
- os << "' whose return type is '"
- << ResDerived.getAsString()
+ os << "' whose return type is '" << ResDerived
<< "'. A method with the same name (same selector) is also defined in "
"class '"
- << *MethAncestor->getClassInterface()
- << "' and has a return type of '"
- << ResAncestor.getAsString()
+ << *MethAncestor->getClassInterface() << "' and has a return type of '"
+ << ResAncestor
<< "'. These two types are incompatible, and may result in undefined "
"behavior for clients of these classes.";
Index: clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
@@ -1046,23 +1046,20 @@
case MemRegion::CXXThisRegionKind:
case MemRegion::CXXTempObjectRegionKind:
os << "a C++ temp object of type "
- << cast<TypedValueRegion>(MR)->getValueType().getAsString();
+ << cast<TypedValueRegion>(MR)->getValueType();
return true;
case MemRegion::NonParamVarRegionKind:
- os << "a variable of type"
- << cast<TypedValueRegion>(MR)->getValueType().getAsString();
+ os << "a variable of type" << cast<TypedValueRegion>(MR)->getValueType();
return true;
case MemRegion::ParamVarRegionKind:
- os << "a parameter of type"
- << cast<TypedValueRegion>(MR)->getValueType().getAsString();
+ os << "a parameter of type" << cast<TypedValueRegion>(MR)->getValueType();
return true;
case MemRegion::FieldRegionKind:
- os << "a field of type "
- << cast<TypedValueRegion>(MR)->getValueType().getAsString();
+ os << "a field of type " << cast<TypedValueRegion>(MR)->getValueType();
return true;
case MemRegion::ObjCIvarRegionKind:
os << "an instance variable of type "
- << cast<TypedValueRegion>(MR)->getValueType().getAsString();
+ << cast<TypedValueRegion>(MR)->getValueType();
return true;
default:
return false;
Index: clang/lib/Sema/SemaInit.cpp
===================================================================
--- clang/lib/Sema/SemaInit.cpp
+++ clang/lib/Sema/SemaInit.cpp
@@ -3467,7 +3467,7 @@
D->printQualifiedName(OS);
}
- OS << " '" << getType().getAsString() << "'\n";
+ OS << " '" << getType() << "'\n";
return Depth + 1;
}
@@ -9796,7 +9796,7 @@
break;
}
- OS << " [" << S->Type.getAsString() << ']';
+ OS << " [" << S->Type << ']';
}
OS << '\n';
Index: clang/lib/Sema/CodeCompleteConsumer.cpp
===================================================================
--- clang/lib/Sema/CodeCompleteConsumer.cpp
+++ clang/lib/Sema/CodeCompleteConsumer.cpp
@@ -621,8 +621,7 @@
std::stable_sort(Results, Results + NumResults);
if (!Context.getPreferredType().isNull())
- OS << "PREFERRED-TYPE: " << Context.getPreferredType().getAsString()
- << "\n";
+ OS << "PREFERRED-TYPE: " << Context.getPreferredType() << '\n';
StringRef Filter = SemaRef.getPreprocessor().getCodeCompletionFilter();
// Print the completions.
Index: clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
===================================================================
--- clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
+++ clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
@@ -488,8 +488,8 @@
Value *Val = createValueUnlessSelfReferential(Type, Visited, /*Depth=*/0,
CreatedValuesCount);
if (CreatedValuesCount > MaxCompositeValueSize) {
- llvm::errs() << "Attempting to initialize a huge value of type: "
- << Type.getAsString() << "\n";
+ llvm::errs() << "Attempting to initialize a huge value of type: " << Type
+ << '\n';
}
return Val;
}
Index: clang/lib/Analysis/CFG.cpp
===================================================================
--- clang/lib/Analysis/CFG.cpp
+++ clang/lib/Analysis/CFG.cpp
@@ -5610,12 +5610,10 @@
if (Optional<CFGConstructor> CE = E.getAs<CFGConstructor>()) {
print_construction_context(OS, Helper, CE->getConstructionContext());
}
- OS << ", " << CCE->getType().getAsString() << ")";
+ OS << ", " << CCE->getType() << ")";
} else if (const CastExpr *CE = dyn_cast<CastExpr>(S)) {
- OS << " (" << CE->getStmtClassName() << ", "
- << CE->getCastKindName()
- << ", " << CE->getType().getAsString()
- << ")";
+ OS << " (" << CE->getStmtClassName() << ", " << CE->getCastKindName()
+ << ", " << CE->getType() << ")";
}
// Expressions need a newline.
Index: clang/lib/Analysis/AnalysisDeclContext.cpp
===================================================================
--- clang/lib/Analysis/AnalysisDeclContext.cpp
+++ clang/lib/Analysis/AnalysisDeclContext.cpp
@@ -352,7 +352,7 @@
for (const auto &P : FD->parameters()) {
if (P != *FD->param_begin())
OS << ", ";
- OS << P->getType().getAsString();
+ OS << P->getType();
}
OS << ')';
}
Index: clang/lib/AST/VTableBuilder.cpp
===================================================================
--- clang/lib/AST/VTableBuilder.cpp
+++ clang/lib/AST/VTableBuilder.cpp
@@ -3114,8 +3114,7 @@
if (!ContinueFirstLine)
Out << LinePrefix;
Out << "[return adjustment (to type '"
- << TI.Method->getReturnType().getCanonicalType().getAsString()
- << "'): ";
+ << TI.Method->getReturnType().getCanonicalType() << "'): ";
if (R.Virtual.Microsoft.VBPtrOffset)
Out << "vbptr at offset " << R.Virtual.Microsoft.VBPtrOffset << ", ";
if (R.Virtual.Microsoft.VBIndex)
Index: clang/lib/AST/TypePrinter.cpp
===================================================================
--- clang/lib/AST/TypePrinter.cpp
+++ clang/lib/AST/TypePrinter.cpp
@@ -2307,3 +2307,10 @@
std::string str = std::string(StrOS.str());
buffer.swap(str);
}
+
+llvm::raw_ostream &clang::operator<<(llvm::raw_ostream &OS,
+ const clang::QualType &QT) {
+ auto S = QT.split();
+ TypePrinter(LangOptions()).print(S.Ty, S.Quals, OS, "");
+ return OS;
+}
Index: clang/lib/AST/RecordLayoutBuilder.cpp
===================================================================
--- clang/lib/AST/RecordLayoutBuilder.cpp
+++ clang/lib/AST/RecordLayoutBuilder.cpp
@@ -3545,7 +3545,7 @@
auto CXXRD = dyn_cast<CXXRecordDecl>(RD);
PrintOffset(OS, Offset, IndentLevel);
- OS << C.getTypeDeclType(const_cast<RecordDecl*>(RD)).getAsString();
+ OS << C.getTypeDeclType(const_cast<RecordDecl *>(RD));
if (Description)
OS << ' ' << Description;
if (CXXRD && CXXRD->isEmpty())
@@ -3630,7 +3630,7 @@
const QualType &FieldType = C.getLangOpts().DumpRecordLayoutsCanonical
? Field.getType().getCanonicalType()
: Field.getType();
- OS << FieldType.getAsString() << ' ' << Field << '\n';
+ OS << FieldType << ' ' << Field << '\n';
}
// Dump virtual bases.
@@ -3696,7 +3696,7 @@
// in libFrontend.
const ASTRecordLayout &Info = getASTRecordLayout(RD);
- OS << "Type: " << getTypeDeclType(RD).getAsString() << "\n";
+ OS << "Type: " << getTypeDeclType(RD) << "\n";
OS << "\nLayout: ";
OS << "<ASTRecordLayout\n";
OS << " Size:" << toBits(Info.getSize()) << "\n";
Index: clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h
===================================================================
--- clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h
+++ clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h
@@ -169,8 +169,7 @@
std::string VisitElementRegion(const ElementRegion *R) {
std::string Str;
llvm::raw_string_ostream OS(Str);
- OS << "element of type '" << R->getElementType().getAsString()
- << "' with index ";
+ OS << "element of type '" << R->getElementType() << "' with index ";
// For concrete index: omit type of the index integer.
if (auto I = R->getIndex().getAs<nonloc::ConcreteInt>())
OS << I->getValue();
Index: clang/include/clang/AST/Type.h
===================================================================
--- clang/include/clang/AST/Type.h
+++ clang/include/clang/AST/Type.h
@@ -1316,6 +1316,8 @@
static bool hasNonTrivialToPrimitiveCopyCUnion(const RecordDecl *RD);
};
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const clang::QualType &QT);
+
} // namespace clang
namespace llvm {
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits