Make our Function class keep a list of parameter offsets so we can simply get a parameter by index when evaluating builtin functions.
Details
Diff Detail
Event Timeline
clang/lib/AST/Interp/Function.h | ||
---|---|---|
166–168 | Nit: this interface should be taking llvm::SmallVectorImpl<Type> rather than the concrete small vector type. | |
clang/lib/AST/Interp/InterpBuiltin.cpp | ||
22–23 | Thought: it would be nice if we could hoist as much of this implementation as we can into a helper function so that we can share most of the guts with __builtin_memcmp() as well. Also, it would be good to generalize this so it works for __builtin_wcscmp() and __builtin_wmemcmp() as well. |
clang/lib/AST/Interp/InterpBuiltin.cpp | ||
---|---|---|
22–23 | Definitely, but I think it makes more sense to do that when we implement those functions. |
clang/lib/AST/Interp/InterpBuiltin.cpp | ||
---|---|---|
22–23 | I guess I was mostly wondering why we don't generalize that now given that we know the need exists. In fact, it seems like you could be handling __builtin_strncmp and others at the same time with one generalized implementation. |
clang/lib/AST/Interp/InterpBuiltin.cpp | ||
---|---|---|
22–23 | Because smaller patches get reviewed faster :) |
clang/test/AST/Interp/builtin-functions.cpp | ||
---|---|---|
9 | Both empty strings "" would be good as well. |
Nit: this interface should be taking llvm::SmallVectorImpl<Type> rather than the concrete small vector type.