[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings
Roman Lebedev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 31 04:42:56 PDT 2019
lebedev.ri requested changes to this revision.
lebedev.ri added a comment.
This revision now requires changes to proceed.
Thank you for working on this!
I'm guessing this doesn't have a `-Werror=` mode?
I still believe this should output a remark.
It will still be visible in the compiler console output,
but won't get buried there but will actually be recorded in the remarks file.
================
Comment at: clang/lib/CodeGen/MisExpect.cpp:1
+//===--- MisExpect.cpp - Emit LLVM Code from Statements -------------------===//
+//
----------------
Wrong comment
================
Comment at: clang/lib/CodeGen/MisExpect.cpp:36
+ if (!Call)
+ return Optional<int64_t>(None);
+
----------------
llvm::None
================
Comment at: clang/lib/CodeGen/MisExpect.cpp:40
+ if (!FD || FD->getBuiltinID() != Builtin::BI__builtin_expect) {
+ return Optional<int64_t>(None);
+ }
----------------
`llvm::None`
================
Comment at: clang/lib/CodeGen/MisExpect.cpp:50
+ if (!ExprResult.Val.hasValue())
+ return Optional<int64_t>(None);
+
----------------
llvm::None
================
Comment at: clang/lib/CodeGen/MisExpect.cpp:54
+ int64_t ExpectedVal = Into.getExtValue();
+ return Optional<int64_t>(ExpectedVal);
+}
----------------
return ExpectedVal;
should just work?
================
Comment at: clang/lib/CodeGen/MisExpect.cpp:140-146
+void EmitMisExpectWarning(const CallExpr *Call, CodeGenModule &CGM) {
+ SourceLocation ExprLoc = Call->getBeginLoc();
+ unsigned DiagID = CGM.getDiags().getCustomDiagID(
+ DiagnosticsEngine::Warning, "Current PGO counters disagree with "
+ "the use of __builtin_expect().");
+ CGM.getDiags().Report(ExprLoc, DiagID);
+}
----------------
This is rather undescriptive.
Can you output some more useful info?
================
Comment at: clang/lib/CodeGen/MisExpect.h:1
+//===--- MisExpect.h - Emit LLVM Code from Statements ---------------------===//
+//
----------------
Wrong comment
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65300/new/
https://reviews.llvm.org/D65300
More information about the cfe-commits
mailing list