aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/PreprocessingRecord.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-01-16 16:52:44 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-01-16 16:52:44 +0000
commit36845474e217b952c720f4f87923bc78059640c5 (patch)
tree342c9cde67198f871c8786c31ebbb0565aaf3854 /lib/Lex/PreprocessingRecord.cpp
parent1f2b07898f66524fd7fe1b177fb0d7c58016e93b (diff)
[preprocessor] Call the MacroUndefined callback even when the macro was not defined.
Patch by Enea Zaffanella! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172623 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/PreprocessingRecord.cpp')
-rw-r--r--lib/Lex/PreprocessingRecord.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Lex/PreprocessingRecord.cpp b/lib/Lex/PreprocessingRecord.cpp
index 8e8afeb4b7..d7ebeafdf9 100644
--- a/lib/Lex/PreprocessingRecord.cpp
+++ b/lib/Lex/PreprocessingRecord.cpp
@@ -416,7 +416,9 @@ void PreprocessingRecord::MacroDefined(const Token &Id,
void PreprocessingRecord::MacroUndefined(const Token &Id,
const MacroInfo *MI) {
- MacroDefinitions.erase(MI);
+ // Note: MI may be null (when #undef'ining an undefined macro).
+ if (MI)
+ MacroDefinitions.erase(MI);
}
void PreprocessingRecord::InclusionDirective(