-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from samanpa/optional_type
Improve support for locating declRefs that are used in a macro
- Loading branch information
Showing
6 changed files
with
125 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,32 @@ | ||
#include "paste.h" | ||
#include "macro.h" | ||
#include "global.h" | ||
#include "indirect.h" | ||
|
||
#define REFERENCE_GLOBAL1() GLOBAL1 | ||
|
||
int bar() | ||
{ | ||
return PASTE(GLO, BAL1) + PASTE(GL, OBAL2); | ||
return PASTE(GLO, BAL1) // 1st use of global.h | ||
+ PASTE(GL, OBAL2) // 2nd use of global.h | ||
+ REFERENCE_GLOBAL1() // 3rd use of global.h (no scratch space) | ||
; | ||
} | ||
|
||
int baz() | ||
{ | ||
return ANOTHER_PASTE(GL, OBAL4) + REFERENCE_GLOBAL3(); | ||
return ANOTHER_PASTE(GL, OBAL4) // 4th use of global.h | ||
+ REFERENCE_GLOBAL3() // not a use of global.h (no scratch space) | ||
; | ||
} | ||
|
||
int indirect() | ||
{ | ||
return INDIRECT_PASTE(GL, OBAL5); // 5th use of global.h | ||
} | ||
|
||
|
||
int indirect2() | ||
{ | ||
return INDIRECT_REFERENCE_GLOBAL6(); // 6th use of global.h | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,7 @@ int GLOBAL1; | |
int GLOBAL2; | ||
int GLOBAL3; | ||
int GLOBAL4; | ||
int GLOBAL5; | ||
int GLOBAL6; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include "paste.h" | ||
|
||
#define INDIRECT_PASTE(a, b) ( \ | ||
PASTE(a, b) \ | ||
) | ||
|
||
// Does not counts as an access to GLOBAL6 | ||
#define INDIRECT_REFERENCE_GLOBAL6() INDIRECT_PASTE(GLOB, AL6) |