================
@@ -270,8 +270,13 @@ classifyTokensBeforeFunctionName(const FunctionDecl &F, 
const ASTContext &Ctx,
 
       if (Info.hasMacroDefinition()) {
         const MacroInfo *MI = PP->getMacroInfo(&Info);
-        if (!MI || MI->isFunctionLike()) {
-          // Cannot handle function style macros.
+        if (!MI || MI->isFunctionLike() || MI->isBuiltinMacro()) {
+          // Cannot handle function-like macros or builtin macros.
+          // Builtin macros like __has_feature, __has_builtin, etc. are
+          // registered as object-like macros but expect function-like syntax
+          // (parenthesized arguments) when expanded. Feeding them to
+          // classifyToken() would cause the preprocessor to emit spurious
+          // "missing '(' after '...'" errors.
----------------
vbvictor wrote:

Since we already have explanation in tests, can we omit here and simply say
"// Cannot handle function style or builtin macros."

https://github.com/llvm/llvm-project/pull/184022
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to