aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/Builtins.cpp
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2018-04-16 21:30:08 +0000
committerErich Keane <erich.keane@intel.com>2018-04-16 21:30:08 +0000
commit41af97137572ad6d4dafc872e7ecf6bbb08d4984 (patch)
tree6a9952a262412ea0162132171f385527633c29c7 /clang/lib/Basic/Builtins.cpp
parentd742dc20d9809b36a7eec6a1f64c48755e2e5778 (diff)
downloadllvm-41af97137572ad6d4dafc872e7ecf6bbb08d4984.zip
llvm-41af97137572ad6d4dafc872e7ecf6bbb08d4984.tar.gz
llvm-41af97137572ad6d4dafc872e7ecf6bbb08d4984.tar.bz2
Limit types of builtins that can be redeclared.
As reported here: https://bugs.llvm.org/show_bug.cgi?id=37033 Any usage of a builtin function that uses a va_list by reference will cause an assertion when redeclaring it. After discussion in the review, it was concluded that the correct way of accomplishing this fix is to make attempts to redeclare certain builtins an error. Unfortunately, doing this limitation for all builtins is likely a breaking change, so this commit simply limits it to types with custom type checking and those that take a reference. Two tests needed to be updated to make this work. Differential Revision: https://reviews.llvm.org/D45383 llvm-svn: 330160
Diffstat (limited to 'clang/lib/Basic/Builtins.cpp')
-rw-r--r--clang/lib/Basic/Builtins.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Basic/Builtins.cpp b/clang/lib/Basic/Builtins.cpp
index ed7f87c..bb04384 100644
--- a/clang/lib/Basic/Builtins.cpp
+++ b/clang/lib/Basic/Builtins.cpp
@@ -139,3 +139,10 @@ bool Builtin::Context::isScanfLike(unsigned ID, unsigned &FormatIdx,
bool &HasVAListArg) {
return isLike(ID, FormatIdx, HasVAListArg, "sS");
}
+
+bool Builtin::Context::canBeRedeclared(unsigned ID) const {
+ return ID == Builtin::NotBuiltin ||
+ ID == Builtin::BI__va_start ||
+ (!hasReferenceArgsOrResult(ID) &&
+ !hasCustomTypechecking(ID));
+}