Author: Vitaly Buka Date: 2023-05-11T17:13:19-07:00 New Revision: ba566fffb205a338c0a6e382b64d84b3a1e21fb6
URL: https://github.com/llvm/llvm-project/commit/ba566fffb205a338c0a6e382b64d84b3a1e21fb6 DIFF: https://github.com/llvm/llvm-project/commit/ba566fffb205a338c0a6e382b64d84b3a1e21fb6.diff LOG: [NFC][AST] Return void from setUseQualifiedLookup It uses to initialize the class. If so, it returns uninitalized value. This is UB and msan with -fno-inline will complain. Added: Modified: clang/include/clang/AST/DeclBase.h clang/lib/Sema/SemaLookup.cpp Removed: ################################################################################ diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h index 65215dbf70551..f7d5b3a83141a 100644 --- a/clang/include/clang/AST/DeclBase.h +++ b/clang/include/clang/AST/DeclBase.h @@ -2540,10 +2540,8 @@ class DeclContext { D == LastDecl); } - bool setUseQualifiedLookup(bool use = true) const { - bool old_value = DeclContextBits.UseQualifiedLookup; + void setUseQualifiedLookup(bool use = true) const { DeclContextBits.UseQualifiedLookup = use; - return old_value; } bool shouldUseQualifiedLookup() const { diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 537c09723919d..5a2a3616d1136 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -2424,8 +2424,9 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool oldVal; DeclContext *Context; // Set flag in DeclContext informing debugger that we're looking for qualified name - QualifiedLookupInScope(DeclContext *ctx) : Context(ctx) { - oldVal = ctx->setUseQualifiedLookup(); + QualifiedLookupInScope(DeclContext *ctx) + : oldVal(ctx->shouldUseQualifiedLookup()), Context(ctx) { + ctx->setUseQualifiedLookup(); } ~QualifiedLookupInScope() { Context->setUseQualifiedLookup(oldVal); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits