[PATCH] Add new 'let' command to bind arbitrary values into constants.

Peter Collingbourne peter at pcc.me.uk
Fri Apr 18 16:19:32 PDT 2014



================
Comment at: unittests/clang-query/QueryParserTest.cpp:123
@@ +122,3 @@
+  ASSERT_TRUE(isa<InvalidQuery>(Q));
+  EXPECT_EQ("expected variable name", cast<InvalidQuery>(Q)->ErrStr);
+}
----------------
Samuel Benzaquen wrote:
> Peter Collingbourne wrote:
> > Please also test that extra stuff after the unlet query causes an error.
> I'm sorry, but I don't know what extra stuff you are referring to.
Sorry if I wasn't clear. I meant that if for example the query was something like "unlet x foo" we should reject it because of the extra input "foo" at the end.

================
Comment at: clang-query/Query.cpp:131
@@ +130,3 @@
+  } else {
+    QS.NamedValues.erase(Name);
+  }
----------------
Samuel Benzaquen wrote:
> Peter Collingbourne wrote:
> > Sorry, one thing I forgot to mention before: is this the correct behavior if the value does not exist in the map? Should we be printing an error message in that case?
> I don't know.
> I would say it is not an error because the end state is the same as it would have been if it existed in the map.
That seems reasonable.


http://reviews.llvm.org/D3383






More information about the cfe-commits mailing list