aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Compiler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Compiler.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 5bcac39..6b74b5e 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -2038,7 +2038,12 @@ bool Compiler<Emitter>::visitCallArgs(ArrayRef<const Expr *> Args,
const FunctionDecl *FuncDecl,
bool Activate) {
assert(VarScope->getKind() == ScopeKind::Call);
- llvm::BitVector NonNullArgs = collectNonNullArgs(FuncDecl, Args);
+ bool HasNonNullAttr = false;
+ llvm::BitVector NonNullArgs;
+ if (FuncDecl && FuncDecl->hasAttr<NonNullAttr>()) {
+ HasNonNullAttr = true;
+ NonNullArgs = collectNonNullArgs(FuncDecl, Args);
+ }
unsigned ArgIndex = 0;
for (const Expr *Arg : Args) {
@@ -2064,7 +2069,7 @@ bool Compiler<Emitter>::visitCallArgs(ArrayRef<const Expr *> Args,
return false;
}
- if (FuncDecl && NonNullArgs[ArgIndex]) {
+ if (HasNonNullAttr && NonNullArgs[ArgIndex]) {
PrimType ArgT = classify(Arg).value_or(PT_Ptr);
if (ArgT == PT_Ptr) {
if (!this->emitCheckNonNullArg(ArgT, Arg))