[clang] [Clang] Initialize AtLeastAsSpecialized to prevent undefined behavior in Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs() (PR #95195)

2024-06-11 Thread via cfe-commits

https://github.com/smanna12 edited 
https://github.com/llvm/llvm-project/pull/95195
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang] Initialize AtLeastAsSpecialized to prevent undefined behavior in Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs() (PR #95195)

2024-06-11 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

There is no potential UB, this is a false positive: this lambda will always be 
executed before runWithSufficientStackSpace returns.

https://github.com/llvm/llvm-project/pull/95195
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang] Initialize AtLeastAsSpecialized to prevent undefined behavior in Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs() (PR #95195)

2024-06-11 Thread Matheus Izvekov via cfe-commits


@@ -6447,7 +6447,7 @@ bool 
Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs(
   if (Inst.isInvalid())
 return false;
 
-  bool AtLeastAsSpecialized;
+  bool AtLeastAsSpecialized = false;
   runWithSufficientStackSpace(Info.getLocation(), [&] {

mizvekov wrote:

runWithSufficientStackSpace is a small helper used to prevent stack exhaustion.

https://github.com/llvm/llvm-project/pull/95195
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang] Initialize AtLeastAsSpecialized to prevent undefined behavior in Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs() (PR #95195)

2024-06-11 Thread via cfe-commits

cor3ntin wrote:

as @mizvekov said, there is no UB here.
A better improvement would be to let `runWithSufficientStackSpace` return a 
value, so we can write

```cpp
bool AtLeastAsSpecialized =  runWithSufficientStackSpace(/*...*/);
```

https://github.com/llvm/llvm-project/pull/95195
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang] Initialize AtLeastAsSpecialized to prevent undefined behavior in Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs() (PR #95195)

2024-07-16 Thread via cfe-commits

https://github.com/smanna12 closed 
https://github.com/llvm/llvm-project/pull/95195
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits