Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).
zaks.anna added inline comments. Comment at: test/Analysis/PR12421.c:11 @@ +10,2 @@ + +// CHECK: warning: Path diagnostic report is not generated. HTMLDiagnostics does not support diagnostics that cross file boundaries. We should use the name of the diagnostic consumer here - that will only be legible for the developers working on the attic analyzer core. Comment at: test/Analysis/PR12421.h:1 @@ +1,2 @@ +static void f() { + int *p = 0; Please. do not use the PR as a file name. Use the purpose of the test instead, https://reviews.llvm.org/D22494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).
ayartsev added inline comments. Comment at: test/Analysis/PR12421.c:11 @@ +10,2 @@ + +// CHECK: warning: Path diagnostic report is not generated. HTMLDiagnostics does not support diagnostics that cross file boundaries. zaks.anna wrote: > We should use the name of the diagnostic consumer here - that will only be > legible for the developers working on the attic analyzer core. Done. As for me the name of the diagnostic consumer also makes the warning more clear and helpful for an ordinary user. From the consumer name he can see what report format is talked about and maybe change the scan-build (which setups the '-analyzer-output' frontend option internally) options. Do you still want to remove the consumer name from the warning? https://reviews.llvm.org/D22494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).
ayartsev updated this revision to Diff 65519. ayartsev marked 2 inline comments as done. https://reviews.llvm.org/D22494 Files: lib/StaticAnalyzer/Core/PathDiagnostic.cpp test/Analysis/diagnostics/diag-cross-file-boundaries.c test/Analysis/diagnostics/diag-cross-file-boundaries.h Index: test/Analysis/diagnostics/diag-cross-file-boundaries.h === --- test/Analysis/diagnostics/diag-cross-file-boundaries.h +++ test/Analysis/diagnostics/diag-cross-file-boundaries.h @@ -0,0 +1,4 @@ +static void f() { + int *p = 0; + *p = 1; // expected-warning{{Dereference of null pointer}} +} Index: test/Analysis/diagnostics/diag-cross-file-boundaries.c === --- test/Analysis/diagnostics/diag-cross-file-boundaries.c +++ test/Analysis/diagnostics/diag-cross-file-boundaries.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-output=html -o PR12421.html %s 2>&1 | FileCheck %s + +// Test for PR12421 +#include "diag-cross-file-boundaries.h" + +int main(){ + f(); + return 0; +} + +// CHECK: warning: Path diagnostic report is not generated. Current output format does not support diagnostics that cross file boundaries. Index: lib/StaticAnalyzer/Core/PathDiagnostic.cpp === --- lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -211,6 +211,11 @@ const SourceManager &SMgr = D->path.front()->getLocation().getManager(); SmallVector WorkList; WorkList.push_back(&D->path); +SmallString<128> buf; +llvm::raw_svector_ostream warning(buf); +warning << "warning: Path diagnostic report is not generated. Current " +<< "output format does not support diagnostics that cross file " +<< "boundaries.\n"; while (!WorkList.empty()) { const PathPieces &path = *WorkList.pop_back_val(); @@ -222,19 +227,25 @@ if (FID.isInvalid()) { FID = SMgr.getFileID(L); -} else if (SMgr.getFileID(L) != FID) - return; // FIXME: Emit a warning? +} else if (SMgr.getFileID(L) != FID) { + llvm::errs() << warning.str(); + return; +} // Check the source ranges. ArrayRef Ranges = piece->getRanges(); for (ArrayRef::iterator I = Ranges.begin(), E = Ranges.end(); I != E; ++I) { SourceLocation L = SMgr.getExpansionLoc(I->getBegin()); - if (!L.isFileID() || SMgr.getFileID(L) != FID) -return; // FIXME: Emit a warning? + if (!L.isFileID() || SMgr.getFileID(L) != FID) { +llvm::errs() << warning.str(); +return; + } L = SMgr.getExpansionLoc(I->getEnd()); - if (!L.isFileID() || SMgr.getFileID(L) != FID) -return; // FIXME: Emit a warning? + if (!L.isFileID() || SMgr.getFileID(L) != FID) { +llvm::errs() << warning.str(); +return; + } } if (const PathDiagnosticCallPiece *call = Index: test/Analysis/diagnostics/diag-cross-file-boundaries.h === --- test/Analysis/diagnostics/diag-cross-file-boundaries.h +++ test/Analysis/diagnostics/diag-cross-file-boundaries.h @@ -0,0 +1,4 @@ +static void f() { + int *p = 0; + *p = 1; // expected-warning{{Dereference of null pointer}} +} Index: test/Analysis/diagnostics/diag-cross-file-boundaries.c === --- test/Analysis/diagnostics/diag-cross-file-boundaries.c +++ test/Analysis/diagnostics/diag-cross-file-boundaries.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-output=html -o PR12421.html %s 2>&1 | FileCheck %s + +// Test for PR12421 +#include "diag-cross-file-boundaries.h" + +int main(){ + f(); + return 0; +} + +// CHECK: warning: Path diagnostic report is not generated. Current output format does not support diagnostics that cross file boundaries. Index: lib/StaticAnalyzer/Core/PathDiagnostic.cpp === --- lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -211,6 +211,11 @@ const SourceManager &SMgr = D->path.front()->getLocation().getManager(); SmallVector WorkList; WorkList.push_back(&D->path); +SmallString<128> buf; +llvm::raw_svector_ostream warning(buf); +warning << "warning: Path diagnostic report is not generated. Current " +<< "output format does not support diagnostics that cross file " +<< "boundaries.\n"; while (!WorkList.empty()) { const
Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).
zaks.anna added inline comments. Comment at: test/Analysis/PR12421.c:11 @@ +10,2 @@ + +// CHECK: warning: Path diagnostic report is not generated. HTMLDiagnostics does not support diagnostics that cross file boundaries. ayartsev wrote: > zaks.anna wrote: > > We should use the name of the diagnostic consumer here - that will only be > > legible for the developers working on the attic analyzer core. > Done. As for me the name of the diagnostic consumer also makes the warning > more clear and helpful for an ordinary user. From the consumer name he can > see what report format is talked about and maybe change the scan-build (which > setups the '-analyzer-output' frontend option internally) options. Do you > still want to remove the consumer name from the warning? "HTMLDiagnostics" is not a name a user would be familiar with. You should use only familiar terms in diagnostics. Comment at: test/Analysis/PR12421.h:1 @@ +1,2 @@ +static void f() { + int *p = 0; zaks.anna wrote: > Please. do not use the PR as a file name. Use the purpose of the test instead, this does not seem to be done. https://reviews.llvm.org/D22494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).
ayartsev added inline comments. Comment at: test/Analysis/PR12421.c:11 @@ +10,2 @@ + +// CHECK: warning: Path diagnostic report is not generated. HTMLDiagnostics does not support diagnostics that cross file boundaries. zaks.anna wrote: > ayartsev wrote: > > zaks.anna wrote: > > > We should use the name of the diagnostic consumer here - that will only > > > be legible for the developers working on the attic analyzer core. > > Done. As for me the name of the diagnostic consumer also makes the warning > > more clear and helpful for an ordinary user. From the consumer name he can > > see what report format is talked about and maybe change the scan-build > > (which setups the '-analyzer-output' frontend option internally) options. > > Do you still want to remove the consumer name from the warning? > "HTMLDiagnostics" is not a name a user would be familiar with. You should use > only familiar terms in diagnostics. Ok. Comment at: test/Analysis/PR12421.h:1 @@ +1,2 @@ +static void f() { + int *p = 0; zaks.anna wrote: > zaks.anna wrote: > > Please. do not use the PR as a file name. Use the purpose of the test > > instead, > this does not seem to be done. Did you see an updated diff? Or I'm probably missing something. Maybe you mean something like this: check-diag-cross-file-boundaries-no-report.* ? https://reviews.llvm.org/D22494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).
zaks.anna added inline comments. Comment at: lib/StaticAnalyzer/Core/PathDiagnostic.cpp:216 @@ +215,3 @@ +llvm::raw_svector_ostream warning(buf); +warning << "warning: Path diagnostic report is not generated. Current " +<< "output format does not support diagnostics that cross file " Can/should we be specific about what the user-specified output format is? https://reviews.llvm.org/D22494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).
ayartsev added inline comments. Comment at: lib/StaticAnalyzer/Core/PathDiagnostic.cpp:216 @@ +215,3 @@ +llvm::raw_svector_ostream warning(buf); +warning << "warning: Path diagnostic report is not generated. Current " +<< "output format does not support diagnostics that cross file " zaks.anna wrote: > Can/should we be specific about what the user-specified output format is? It's unable to extract information about user-specified output format from the "PathDiagnosticConsumer" interface. And this class seem to be too generic to contain "AnalyzerOptions" member or to have e.g. "pure virtual getOutputFormatName()". So the only way I see to get info about output format is to use "PathDiagnosticConsumer::getName()". Maybe it makes sense just to add a hint to use "--analyzer-output" driver option to change output format. However this option is not documented at all and is not displayed in clang help. What do you think? https://reviews.llvm.org/D22494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).
ayartsev added a comment. Ping. https://reviews.llvm.org/D22494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).
ayartsev added a comment. Gentle ping. https://reviews.llvm.org/D22494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).
zaks.anna added inline comments. Comment at: lib/StaticAnalyzer/Core/PathDiagnostic.cpp:216 @@ +215,3 @@ +llvm::raw_svector_ostream warning(buf); +warning << "warning: Path diagnostic report is not generated. Current " +<< "output format does not support diagnostics that cross file " ayartsev wrote: > zaks.anna wrote: > > Can/should we be specific about what the user-specified output format is? > It's unable to extract information about user-specified output format from > the "PathDiagnosticConsumer" interface. And this class seem to be too generic > to contain "AnalyzerOptions" member or to have e.g. "pure virtual > getOutputFormatName()". > So the only way I see to get info about output format is to use > "PathDiagnosticConsumer::getName()". > Maybe it makes sense just to add a hint to use "--analyzer-output" driver > option to change output format. However this option is not documented at all > and is not displayed in clang help. What do you think? I think mentioning the option is the best option. What is that option called in scan-build? https://reviews.llvm.org/D22494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).
ayartsev added inline comments. Comment at: lib/StaticAnalyzer/Core/PathDiagnostic.cpp:216 @@ +215,3 @@ +llvm::raw_svector_ostream warning(buf); +warning << "warning: Path diagnostic report is not generated. Current " +<< "output format does not support diagnostics that cross file " zaks.anna wrote: > ayartsev wrote: > > zaks.anna wrote: > > > Can/should we be specific about what the user-specified output format is? > > It's unable to extract information about user-specified output format from > > the "PathDiagnosticConsumer" interface. And this class seem to be too > > generic to contain "AnalyzerOptions" member or to have e.g. "pure virtual > > getOutputFormatName()". > > So the only way I see to get info about output format is to use > > "PathDiagnosticConsumer::getName()". > > Maybe it makes sense just to add a hint to use "--analyzer-output" driver > > option to change output format. However this option is not documented at > > all and is not displayed in clang help. What do you think? > I think mentioning the option is the best option. What is that option called > in scan-build? scan-build (both perl and python versions) has two options: "-plist" and "-plist-html" that are translated to "-analyzer-output=plist" and "-analyzer-output=plist-html" frontend options respectively. https://reviews.llvm.org/D22494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).
zaks.anna added inline comments. Comment at: lib/StaticAnalyzer/Core/PathDiagnostic.cpp:216 @@ +215,3 @@ +llvm::raw_svector_ostream warning(buf); +warning << "warning: Path diagnostic report is not generated. Current " +<< "output format does not support diagnostics that cross file " ayartsev wrote: > ayartsev wrote: > > zaks.anna wrote: > > > ayartsev wrote: > > > > zaks.anna wrote: > > > > > Can/should we be specific about what the user-specified output format > > > > > is? > > > > It's unable to extract information about user-specified output format > > > > from the "PathDiagnosticConsumer" interface. And this class seem to be > > > > too generic to contain "AnalyzerOptions" member or to have e.g. "pure > > > > virtual getOutputFormatName()". > > > > So the only way I see to get info about output format is to use > > > > "PathDiagnosticConsumer::getName()". > > > > Maybe it makes sense just to add a hint to use "--analyzer-output" > > > > driver option to change output format. However this option is not > > > > documented at all and is not displayed in clang help. What do you think? > > > I think mentioning the option is the best option. What is that option > > > called in scan-build? > > scan-build (both perl and python versions) has two options: "-plist" and > > "-plist-html" that are translated to "-analyzer-output=plist" and > > "-analyzer-output=plist-html" frontend options respectively. > I suggest to document the "--analyzer-output" option and to mention this > option in the warning. That sounds good to me. https://reviews.llvm.org/D22494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).
ayartsev added inline comments. Comment at: lib/StaticAnalyzer/Core/PathDiagnostic.cpp:216 @@ +215,3 @@ +llvm::raw_svector_ostream warning(buf); +warning << "warning: Path diagnostic report is not generated. Current " +<< "output format does not support diagnostics that cross file " ayartsev wrote: > zaks.anna wrote: > > ayartsev wrote: > > > zaks.anna wrote: > > > > Can/should we be specific about what the user-specified output format > > > > is? > > > It's unable to extract information about user-specified output format > > > from the "PathDiagnosticConsumer" interface. And this class seem to be > > > too generic to contain "AnalyzerOptions" member or to have e.g. "pure > > > virtual getOutputFormatName()". > > > So the only way I see to get info about output format is to use > > > "PathDiagnosticConsumer::getName()". > > > Maybe it makes sense just to add a hint to use "--analyzer-output" driver > > > option to change output format. However this option is not documented at > > > all and is not displayed in clang help. What do you think? > > I think mentioning the option is the best option. What is that option > > called in scan-build? > scan-build (both perl and python versions) has two options: "-plist" and > "-plist-html" that are translated to "-analyzer-output=plist" and > "-analyzer-output=plist-html" frontend options respectively. I suggest to document the "--analyzer-output" option and to mention this option in the warning. https://reviews.llvm.org/D22494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).
ayartsev updated this revision to Diff 70772. ayartsev added a comment. Updated the patch, added help entry for the "--analyzer-output" driver option. Please review. https://reviews.llvm.org/D22494 Files: lib/StaticAnalyzer/Core/PathDiagnostic.cpp test/Analysis/diagnostics/diag-cross-file-boundaries.c test/Analysis/diagnostics/diag-cross-file-boundaries.h Index: test/Analysis/diagnostics/diag-cross-file-boundaries.h === --- test/Analysis/diagnostics/diag-cross-file-boundaries.h +++ test/Analysis/diagnostics/diag-cross-file-boundaries.h @@ -0,0 +1,4 @@ +static void f() { + int *p = 0; + *p = 1; // expected-warning{{Dereference of null pointer}} +} Index: test/Analysis/diagnostics/diag-cross-file-boundaries.c === --- test/Analysis/diagnostics/diag-cross-file-boundaries.c +++ test/Analysis/diagnostics/diag-cross-file-boundaries.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-output=html -o PR12421.html %s 2>&1 | FileCheck %s + +// Test for PR12421 +#include "diag-cross-file-boundaries.h" + +int main(){ + f(); + return 0; +} + +// CHECK: warning: Path diagnostic report is not generated. Index: lib/StaticAnalyzer/Core/PathDiagnostic.cpp === --- lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -211,6 +211,12 @@ const SourceManager &SMgr = D->path.front()->getLocation().getManager(); SmallVector WorkList; WorkList.push_back(&D->path); +SmallString<128> buf; +llvm::raw_svector_ostream warning(buf); +warning << "warning: Path diagnostic report is not generated. Current " +<< "output format does not support diagnostics that cross file " +<< "boundaries. Refer to --analyzer-output for valid output " + << "formats\n"; while (!WorkList.empty()) { const PathPieces &path = *WorkList.pop_back_val(); @@ -222,19 +228,25 @@ if (FID.isInvalid()) { FID = SMgr.getFileID(L); -} else if (SMgr.getFileID(L) != FID) - return; // FIXME: Emit a warning? +} else if (SMgr.getFileID(L) != FID) { + llvm::errs() << warning.str(); + return; +} // Check the source ranges. ArrayRef Ranges = piece->getRanges(); for (ArrayRef::iterator I = Ranges.begin(), E = Ranges.end(); I != E; ++I) { SourceLocation L = SMgr.getExpansionLoc(I->getBegin()); - if (!L.isFileID() || SMgr.getFileID(L) != FID) -return; // FIXME: Emit a warning? + if (!L.isFileID() || SMgr.getFileID(L) != FID) { +llvm::errs() << warning.str(); +return; + } L = SMgr.getExpansionLoc(I->getEnd()); - if (!L.isFileID() || SMgr.getFileID(L) != FID) -return; // FIXME: Emit a warning? + if (!L.isFileID() || SMgr.getFileID(L) != FID) { +llvm::errs() << warning.str(); +return; + } } if (const PathDiagnosticCallPiece *call = Index: test/Analysis/diagnostics/diag-cross-file-boundaries.h === --- test/Analysis/diagnostics/diag-cross-file-boundaries.h +++ test/Analysis/diagnostics/diag-cross-file-boundaries.h @@ -0,0 +1,4 @@ +static void f() { + int *p = 0; + *p = 1; // expected-warning{{Dereference of null pointer}} +} Index: test/Analysis/diagnostics/diag-cross-file-boundaries.c === --- test/Analysis/diagnostics/diag-cross-file-boundaries.c +++ test/Analysis/diagnostics/diag-cross-file-boundaries.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-output=html -o PR12421.html %s 2>&1 | FileCheck %s + +// Test for PR12421 +#include "diag-cross-file-boundaries.h" + +int main(){ + f(); + return 0; +} + +// CHECK: warning: Path diagnostic report is not generated. Index: lib/StaticAnalyzer/Core/PathDiagnostic.cpp === --- lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -211,6 +211,12 @@ const SourceManager &SMgr = D->path.front()->getLocation().getManager(); SmallVector WorkList; WorkList.push_back(&D->path); +SmallString<128> buf; +llvm::raw_svector_ostream warning(buf); +warning << "warning: Path diagnostic report is not generated. Current " +<< "output format does not support diagnostics that cross file " +<< "boundaries. Refer to --analyzer-output for valid output " +
Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).
ayartsev updated this revision to Diff 71056. ayartsev added a comment. Updated the patch. Important change in Options.td was missing in the last patch + indentation fixed. Still Ok to commit? https://reviews.llvm.org/D22494 Files: include/clang/Driver/Options.td lib/StaticAnalyzer/Core/PathDiagnostic.cpp test/Analysis/diagnostics/diag-cross-file-boundaries.c test/Analysis/diagnostics/diag-cross-file-boundaries.h Index: test/Analysis/diagnostics/diag-cross-file-boundaries.h === --- test/Analysis/diagnostics/diag-cross-file-boundaries.h +++ test/Analysis/diagnostics/diag-cross-file-boundaries.h @@ -0,0 +1,4 @@ +static void f() { + int *p = 0; + *p = 1; // expected-warning{{Dereference of null pointer}} +} Index: test/Analysis/diagnostics/diag-cross-file-boundaries.c === --- test/Analysis/diagnostics/diag-cross-file-boundaries.c +++ test/Analysis/diagnostics/diag-cross-file-boundaries.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-output=html -o PR12421.html %s 2>&1 | FileCheck %s + +// Test for PR12421 +#include "diag-cross-file-boundaries.h" + +int main(){ + f(); + return 0; +} + +// CHECK: warning: Path diagnostic report is not generated. Index: lib/StaticAnalyzer/Core/PathDiagnostic.cpp === --- lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -211,6 +211,12 @@ const SourceManager &SMgr = D->path.front()->getLocation().getManager(); SmallVector WorkList; WorkList.push_back(&D->path); +SmallString<128> buf; +llvm::raw_svector_ostream warning(buf); +warning << "warning: Path diagnostic report is not generated. Current " +<< "output format does not support diagnostics that cross file " +<< "boundaries. Refer to --analyzer-output for valid output " +<< "formats\n"; while (!WorkList.empty()) { const PathPieces &path = *WorkList.pop_back_val(); @@ -222,19 +228,25 @@ if (FID.isInvalid()) { FID = SMgr.getFileID(L); -} else if (SMgr.getFileID(L) != FID) - return; // FIXME: Emit a warning? +} else if (SMgr.getFileID(L) != FID) { + llvm::errs() << warning.str(); + return; +} // Check the source ranges. ArrayRef Ranges = piece->getRanges(); for (ArrayRef::iterator I = Ranges.begin(), E = Ranges.end(); I != E; ++I) { SourceLocation L = SMgr.getExpansionLoc(I->getBegin()); - if (!L.isFileID() || SMgr.getFileID(L) != FID) -return; // FIXME: Emit a warning? + if (!L.isFileID() || SMgr.getFileID(L) != FID) { +llvm::errs() << warning.str(); +return; + } L = SMgr.getExpansionLoc(I->getEnd()); - if (!L.isFileID() || SMgr.getFileID(L) != FID) -return; // FIXME: Emit a warning? + if (!L.isFileID() || SMgr.getFileID(L) != FID) { +llvm::errs() << warning.str(); +return; + } } if (const PathDiagnosticCallPiece *call = Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1969,7 +1969,8 @@ def _all_warnings : Flag<["--"], "all-warnings">, Alias; def _analyze_auto : Flag<["--"], "analyze-auto">, Flags<[DriverOption]>; def _analyzer_no_default_checks : Flag<["--"], "analyzer-no-default-checks">, Flags<[DriverOption]>; -def _analyzer_output : JoinedOrSeparate<["--"], "analyzer-output">, Flags<[DriverOption]>; +def _analyzer_output : JoinedOrSeparate<["--"], "analyzer-output">, Flags<[DriverOption]>, + HelpText<"Static analyzer report output format (html|plist|plist-multi-file|plist-html|text).">; def _analyze : Flag<["--"], "analyze">, Flags<[DriverOption, CoreOption]>, HelpText<"Run the static analyzer">; def _assemble : Flag<["--"], "assemble">, Alias; Index: test/Analysis/diagnostics/diag-cross-file-boundaries.h === --- test/Analysis/diagnostics/diag-cross-file-boundaries.h +++ test/Analysis/diagnostics/diag-cross-file-boundaries.h @@ -0,0 +1,4 @@ +static void f() { + int *p = 0; + *p = 1; // expected-warning{{Dereference of null pointer}} +} Index: test/Analysis/diagnostics/diag-cross-file-boundaries.c === --- test/Analysis/diagnostics/diag-cross-file-boundaries.c +++ test/Analysis/diagnostics/diag-cross-file-boundaries.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify %s +// RUN: %clang_cc
Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).
zaks.anna added a comment. LGTM. Thanks. https://reviews.llvm.org/D22494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits