[llvm-bugs] [Bug 31814] New: MacroArgs getNumArguments() yields unexpected results: Twice the expected amount
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jan 31 05:44:13 PST 2017
https://llvm.org/bugs/show_bug.cgi?id=31814
Bug ID: 31814
Summary: MacroArgs getNumArguments() yields unexpected results:
Twice the expected amount
Product: clang
Version: 3.9
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: sebald.ziegler.maillist at ikolus.de
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Created attachment 17918
--> https://llvm.org/bugs/attachment.cgi?id=17918&action=edit
clang tool - which applied on the above example results in 4 instead of 2
Context: Writing a new clang tool
When using MacroArgs in this context:
void MacroExpands(const Token &MacroNameTok, const MacroDefinition &MD,
SourceRange Range, const MacroArgs *Args) {
...
}
to iterate over all macro arguments, Args->getNumArguments() yields twice the
expected amount of arguments. When trying to access the additional ones then
the program segfaults.
For this example:
#define MAX(x,y) ((x>y)?x:y)
int main(int argc, char** argv) {
int a=5;
int b=7;
return MAX(a,b);
}
Args->getNumArguments() is 4.
This does not seem to be intended behaviour. Or am I mistaken?
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170131/9810d84a/attachment.html>
More information about the llvm-bugs
mailing list