r175895 - Streamify FormatASTNodeDiagnosticArgument.
Anna Zaks
ganna at apple.com
Fri Feb 22 10:49:36 PST 2013
Benjamin,
Your commits (175895, 175894, 175896) are breaking our internal MSVC build with errors like these:
279>CheckerRegistration.cpp
279>.\llvm\tools\clang\include\clang/AST/Decl.h(176) : error C2027: use of undefined type 'llvm::raw_ostream'
279> .\llvm\tools\clang\include\clang/Basic/LLVM.h(47) : see declaration of 'llvm::raw_ostream'
279>.\llvm\tools\clang\include\clang/AST/Decl.h(176) : error C2027: use of undefined type 'llvm::raw_ostream'
279> .\llvm\tools\clang\include\clang/Basic/LLVM.h(47) : see declaration of 'llvm::raw_ostream'
279>.\llvm\include\llvm/Support/raw_ostream.h(309) : error C2504: 'llvm::raw_ostream' : base class undefined
279>.\llvm\include\llvm/Support/raw_ostream.h(441) : error C2504: 'llvm::raw_ostream' : base class undefined
279>.\llvm\include\llvm/Support/raw_ostream.h(457) : error C3861: 'flush': identifier not found
279>.\llvm\include\llvm/Support/raw_ostream.h(465) : error C2504: 'llvm::raw_ostream' : base class undefined
279>.\llvm\include\llvm/Support/raw_ostream.h(493) : error C2504: 'llvm::raw_ostream' : base class undefined
275>Performing Pre-Link Event...
..
281>VariableNaming.cpp
279>.\llvm\include\llvm/Support/raw_ostream.h(309) : error C2504: 'llvm::raw_ostream' : base class undefined
279>.\llvm\include\llvm/Support/raw_ostream.h(441) : error C2504: 'llvm::raw_ostream' : base class undefined
279>.\llvm\include\llvm/Support/raw_ostream.h(457) : error C3861: 'flush': identifier not found
279>.\llvm\include\llvm/Support/raw_ostream.h(465) : error C2504: 'llvm::raw_ostream' : base class undefined
279>.\llvm\include\llvm/Support/raw_ostream.h(493) : error C2504: 'llvm::raw_ostream' : base class undefined
283>RemoveCStrCalls.cpp
279>..\..\..\..\..\..\tools\clang\lib\StaticAnalyzer\Frontend\AnalysisConsumer.cpp(96) : error C2678: binary '<<' : no operator found which takes a left-hand operand of type 'llvm::raw_svector_ostream' (or there is no acceptable conversion)
279> .\llvm\include\llvm/ADT/APInt.h(1576): could be 'llvm::raw_ostream &llvm::operator <<(llvm::raw_ostream &,const llvm::APInt &)' [found using argument-dependent lookup]
279> .\llvm\include\llvm/ADT/APSInt.h(305): or 'llvm::raw_ostream &llvm::operator <<(llvm::raw_ostream &,const llvm::APSInt &)' [found using argument-dependent lookup]
279> .\llvm\include\llvm/ADT/Twine.h(516): or 'llvm::raw_ostream &llvm::operator <<(llvm::raw_ostream &,const llvm::Twine &)' [found using argument-dependent lookup]
279> .\llvm\tools\clang\include\clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h(668): or 'llvm::raw_ostream &llvm::operator <<(llvm::raw_ostream &,const clang::ento::SymExpr *)' [found using argument-dependent lookup]
279> .\llvm\tools\clang\include\clang/StaticAnalyzer/Core/PathSensitive/SVals.h(539): or 'llvm::raw_ostream &llvm::operator <<(llvm::raw_ostream &,clang::ento::SVal)' [found using argument-dependent lookup]
279> .\llvm\tools\clang\include\clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h(1290): or 'llvm::raw_ostream &llvm::operator <<(llvm::raw_ostream &,const clang::ento::MemRegion *)' [found using argument-dependent lookup]
279> .\llvm\tools\clang\include\clang/Basic/Diagnostic.h(988): or 'const clang::DiagnosticBuilder &clang::operator <<(const clang::DiagnosticBuilder &,llvm::StringRef)'
279> .\llvm\tools\clang\include\clang/Basic/Diagnostic.h(994): or 'const clang::DiagnosticBuilder &clang::operator <<(const clang::DiagnosticBuilder &,const char *)'
279> .\llvm\tools\clang\include\clang/Basic/Diagnostic.h(1001): or 'const clang::DiagnosticBuilder &clang::operator <<(const clang::DiagnosticBuilder &,int)'
279> .\llvm\tools\clang\include\clang/Basic/Diagnostic.h(1006): or 'const clang::DiagnosticBuilder &clang::operator <<(const clang::DiagnosticBuilder &,bool)'
279> .\llvm\tools\clang\include\clang/Basic/Diagnostic.h(1011): or 'const clang::DiagnosticBuilder &clang::operator <<(const clang::DiagnosticBuilder &,unsigned int)'
279> .\llvm\tools\clang\include\clang/Basic/Diagnostic.h(1017): or 'const clang::DiagnosticBuilder &clang::operator <<(const clang::DiagnosticBuilder &,const clang::IdentifierInfo *)'
279> .\llvm\tools\clang\include\clang/Basic/Diagnostic.h(1038): or 'const clang::DiagnosticBuilder &clang::operator <<(const clang::DiagnosticBuilder &,const clang::SourceRange &)'
279> .\llvm\tools\clang\include\clang/Basic/Diagnostic.h(1044): or 'const clang::DiagnosticBuilder &clang::operator <<(const clang::DiagnosticBuilder &,const clang::CharSourceRange &)'
279> .\llvm\tools\clang\include\clang/Basic/Diagnostic.h(1050): or 'const clang::DiagnosticBuilder &clang::operator <<(const clang::DiagnosticBuilder &,const clang::FixItHint &)'
279> .\llvm\tools\clang\include\clang/Basic/PartialDiagnostic.h(390): or 'const clang::DiagnosticBuilder &clang::operator <<(const clang::DiagnosticBuilder &,const clang::PartialDiagnostic &)'
279> .\llvm\tools\clang\include\clang/AST/DeclarationName.h(537): or 'const clang::DiagnosticBuilder &clang::operator <<(const clang::DiagnosticBuilder &,clang::DeclarationName)'
279> .\llvm\tools\clang\include\clang/AST/DeclarationName.h(546): or 'const clang::PartialDiagnostic &clang::operator <<(const clang::PartialDiagnostic &,clang::DeclarationName)'
279> .\llvm\tools\clang\include\clang/AST/DeclarationName.h(553): or 'llvm::raw_ostream &clang::operator <<(llvm::raw_ostream &,clang::DeclarationNameInfo)'
279> .\llvm\tools\clang\include\clang/AST/NestedNameSpecifier.h(472): or 'const clang::DiagnosticBuilder &clang::operator <<(const clang::DiagnosticBuilder &,clang::NestedNameSpecifier *)'
279> .\llvm\tools\clang\include\clang/AST/TemplateName.h(333): or 'const clang::DiagnosticBuilder &clang::operator <<(const clang::DiagnosticBuilder &,clang::TemplateName)'
279> .\llvm\tools\clang\include\clang/AST/Type.h(5058): or 'const clang::DiagnosticBuilder &clang::operator <<(const clang::DiagnosticBuilder &,clang::QualType)'
279> .\llvm\tools\clang\include\clang/AST/Type.h(5067): or 'const clang::PartialDiagnostic &clang::operator <<(const clang::PartialDiagnostic &,clang::QualType)'
279> .\llvm\tools\clang\include\clang/AST/Decl.h(336): or 'llvm::raw_ostream &clang::operator <<(llvm::raw_ostream &,const clang::NamedDecl &)'
279> .\llvm\tools\clang\include\clang/AST/Decl.h(3304): or 'const clang::DiagnosticBuilder &clang::operator <<(const clang::DiagnosticBuilder &,const clang::NamedDecl *)'
279> .\llvm\tools\clang\include\clang/AST/Decl.h(3310): or 'const clang::PartialDiagnostic &clang::operator <<(const clang::PartialDiagnostic &,const clang::NamedDecl *)'
279> .\llvm\tools\clang\include\clang/AST/TemplateBase.h(625): or 'const clang::DiagnosticBuilder &clang::operator <<(const clang::DiagnosticBuilder &,const clang::TemplateArgument &)'
279> .\llvm\tools\clang\include\clang/AST/DeclCXX.h(2989): or 'const clang::DiagnosticBuilder &clang::operator <<(const clang::DiagnosticBuilder &,clang::AccessSpecifier)'
279> .\llvm\tools\clang\include\clang/AST/DeclCXX.h(2992): or 'const clang::PartialDiagnostic &clang::operator <<(const clang::PartialDiagnostic &,clang::AccessSpecifier)'
279> .\llvm\tools\clang\include\clang/AST/DeclObjC.h(1763): or 'llvm::raw_ostream &clang::operator <<(llvm::raw_ostream &,const clang::ObjCCategoryImplDecl &)'
279> .\llvm\tools\clang\include\clang/AST/DeclObjC.h(1917): or 'llvm::raw_ostream &clang::operator <<(llvm::raw_ostream &,const clang::ObjCImplementationDecl &)'
279> .\llvm\tools\clang\include\clang/Basic/VersionTuple.h(135): or 'llvm::raw_ostream &clang::operator <<(llvm::raw_ostream &,const clang::VersionTuple &)'
279> .\llvm\tools\clang\include\clang/Basic/ObjCRuntime.h(307): or 'llvm::raw_ostream &clang::operator <<(llvm::raw_ostream &,const clang::ObjCRuntime &)'
279> .\llvm\tools\clang\include\clang/AST/CanonicalType.h(205): or 'const clang::DiagnosticBuilder &clang::operator <<(const clang::DiagnosticBuilder &,clang::CanQualType)'
279> while trying to match the argument list '(llvm::raw_svector_ostream, const char [3])'
..
On Feb 22, 2013, at 7:46 AM, Benjamin Kramer <benny.kra at googlemail.com> wrote:
> Author: d0k
> Date: Fri Feb 22 09:46:08 2013
> New Revision: 175895
>
> URL: http://llvm.org/viewvc/llvm-project?rev=175895&view=rev
> Log:
> Streamify FormatASTNodeDiagnosticArgument.
>
> Modified:
> cfe/trunk/lib/AST/ASTDiagnostic.cpp
>
> Modified: cfe/trunk/lib/AST/ASTDiagnostic.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDiagnostic.cpp?rev=175895&r1=175894&r2=175895&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/ASTDiagnostic.cpp (original)
> +++ cfe/trunk/lib/AST/ASTDiagnostic.cpp Fri Feb 22 09:46:08 2013
> @@ -247,7 +247,8 @@ void clang::FormatASTNodeDiagnosticArgum
> ArrayRef<intptr_t> QualTypeVals) {
> ASTContext &Context = *static_cast<ASTContext*>(Cookie);
>
> - std::string S;
> + size_t OldEnd = Output.size();
> + llvm::raw_svector_ostream OS(Output);
> bool NeedQuotes = true;
>
> switch (Kind) {
> @@ -259,6 +260,7 @@ void clang::FormatASTNodeDiagnosticArgum
> QualType ToType =
> QualType::getFromOpaquePtr(reinterpret_cast<void*>(TDT.ToType));
>
> + std::string S;
> if (FormatTemplateTypeDiff(Context, FromType, ToType, TDT.PrintTree,
> TDT.PrintFromType, TDT.ElideType,
> TDT.ShowColors, S)) {
> @@ -266,13 +268,14 @@ void clang::FormatASTNodeDiagnosticArgum
> TDT.TemplateDiffUsed = true;
> break;
> }
> + OS << S;
>
> // Don't fall-back during tree printing. The caller will handle
> // this case.
> if (TDT.PrintTree)
> return;
>
> - // Attempting to do a templete diff on non-templates. Set the variables
> + // Attempting to do a template diff on non-templates. Set the variables
> // and continue with regular type printing of the appropriate type.
> Val = TDT.PrintFromType ? TDT.FromType : TDT.ToType;
> ModLen = 0;
> @@ -284,23 +287,23 @@ void clang::FormatASTNodeDiagnosticArgum
> "Invalid modifier for QualType argument");
>
> QualType Ty(QualType::getFromOpaquePtr(reinterpret_cast<void*>(Val)));
> - S = ConvertTypeToDiagnosticString(Context, Ty, PrevArgs, NumPrevArgs,
> - QualTypeVals);
> + OS << ConvertTypeToDiagnosticString(Context, Ty, PrevArgs, NumPrevArgs,
> + QualTypeVals);
> NeedQuotes = false;
> break;
> }
> case DiagnosticsEngine::ak_declarationname: {
> - DeclarationName N = DeclarationName::getFromOpaqueInteger(Val);
> - S = N.getAsString();
> -
> if (ModLen == 9 && !memcmp(Modifier, "objcclass", 9) && ArgLen == 0)
> - S = '+' + S;
> + OS << '+';
> else if (ModLen == 12 && !memcmp(Modifier, "objcinstance", 12)
> && ArgLen==0)
> - S = '-' + S;
> + OS << '-';
> else
> assert(ModLen == 0 && ArgLen == 0 &&
> "Invalid modifier for DeclarationName argument");
> +
> + DeclarationName N = DeclarationName::getFromOpaqueInteger(Val);
> + N.printName(OS);
> break;
> }
> case DiagnosticsEngine::ak_nameddecl: {
> @@ -313,14 +316,12 @@ void clang::FormatASTNodeDiagnosticArgum
> Qualified = false;
> }
> const NamedDecl *ND = reinterpret_cast<const NamedDecl*>(Val);
> - llvm::raw_string_ostream OS(S);
> ND->getNameForDiagnostic(OS, Context.getPrintingPolicy(), Qualified);
> break;
> }
> case DiagnosticsEngine::ak_nestednamespec: {
> - llvm::raw_string_ostream OS(S);
> - reinterpret_cast<NestedNameSpecifier*>(Val)->print(OS,
> - Context.getPrintingPolicy());
> + NestedNameSpecifier *NNS = reinterpret_cast<NestedNameSpecifier*>(Val);
> + NNS->print(OS, Context.getPrintingPolicy());
> NeedQuotes = false;
> break;
> }
> @@ -331,42 +332,39 @@ void clang::FormatASTNodeDiagnosticArgum
> if (DC->isTranslationUnit()) {
> // FIXME: Get these strings from some localized place
> if (Context.getLangOpts().CPlusPlus)
> - S = "the global namespace";
> + OS << "the global namespace";
> else
> - S = "the global scope";
> + OS << "the global scope";
> } else if (TypeDecl *Type = dyn_cast<TypeDecl>(DC)) {
> - S = ConvertTypeToDiagnosticString(Context,
> - Context.getTypeDeclType(Type),
> - PrevArgs, NumPrevArgs, QualTypeVals);
> + OS << ConvertTypeToDiagnosticString(Context,
> + Context.getTypeDeclType(Type),
> + PrevArgs, NumPrevArgs,
> + QualTypeVals);
> } else {
> // FIXME: Get these strings from some localized place
> NamedDecl *ND = cast<NamedDecl>(DC);
> if (isa<NamespaceDecl>(ND))
> - S += "namespace ";
> + OS << "namespace ";
> else if (isa<ObjCMethodDecl>(ND))
> - S += "method ";
> + OS << "method ";
> else if (isa<FunctionDecl>(ND))
> - S += "function ";
> -
> - S += "'";
> - {
> - llvm::raw_string_ostream OS(S);
> - ND->getNameForDiagnostic(OS, Context.getPrintingPolicy(), true);
> - }
> - S += "'";
> + OS << "function ";
> +
> + OS << '\'';
> + ND->getNameForDiagnostic(OS, Context.getPrintingPolicy(), true);
> + OS << '\'';
> }
> NeedQuotes = false;
> break;
> }
> }
> -
> - if (NeedQuotes)
> - Output.push_back('\'');
> -
> - Output.append(S.begin(), S.end());
> -
> - if (NeedQuotes)
> +
> + OS.flush();
> +
> + if (NeedQuotes) {
> + Output.insert(Output.begin()+OldEnd, '\'');
> Output.push_back('\'');
> + }
> }
>
> /// TemplateDiff - A class that constructs a pretty string for a pair of
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130222/4e63a014/attachment.html>
More information about the cfe-commits
mailing list