[clang] 477ee05 - [clang][dataflow] Add an `operator<<` for `OptionalTypeIdentifier`.

Martin Braenne via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 20 05:53:04 PDT 2023


Author: Martin Braenne
Date: 2023-07-20T12:52:53Z
New Revision: 477ee05f83c6cc4f11b45e61e606934b99e72290

URL: https://github.com/llvm/llvm-project/commit/477ee05f83c6cc4f11b45e61e606934b99e72290
DIFF: https://github.com/llvm/llvm-project/commit/477ee05f83c6cc4f11b45e61e606934b99e72290.diff

LOG: [clang][dataflow] Add an `operator<<` for `OptionalTypeIdentifier`.

When tests fail in UncheckedOptionalAccessModelTest.cpp, this prints the name of the optional type instead of a blob of hex.

Reviewed By: ymandel

Differential Revision: https://reviews.llvm.org/D155788

Added: 
    

Modified: 
    clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp b/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp
index a181f284370886..719ec271e134c4 100644
--- a/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp
+++ b/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp
@@ -1267,6 +1267,12 @@ struct OptionalTypeIdentifier {
   std::string TypeName;
 };
 
+static raw_ostream &operator<<(raw_ostream &OS,
+                               const OptionalTypeIdentifier &TypeId) {
+  OS << TypeId.NamespaceName << "::" << TypeId.TypeName;
+  return OS;
+}
+
 class UncheckedOptionalAccessTest
     : public ::testing::TestWithParam<OptionalTypeIdentifier> {
 protected:


        


More information about the cfe-commits mailing list