================
@@ -1527,20 +1527,20 @@ struct DeclaratorChunk {
 
     /// Retrieve the location of the 'const' qualifier.
     SourceLocation getConstQualifierLoc() const {
-      assert(MethodQualifiers);
-      return MethodQualifiers->getConstSpecLoc();
+      return MethodQualifiers ? MethodQualifiers->getConstSpecLoc()
----------------
AaronBallman wrote:

`DeclSpec.h` is basically used only to gather information from the parser, and 
so from that perspective, I think the `assert` makes sense. If the caller is 
asking for the location of the `const` qualifier and one wasn't written in 
source, the caller is doing something out of the ordinary.

I think the fix-it code should be guarded by a call to 
`hasMethodTypeQualifiers()` instead.

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

Reply via email to