[flang-commits] [flang] 51cfad3 - [flang] Ensure Preprocessor::Define saves macro names correctly
peter klausler via flang-commits
flang-commits at lists.llvm.org
Thu Aug 13 09:01:35 PDT 2020
Author: peter klausler
Date: 2020-08-13T09:00:48-07:00
New Revision: 51cfad3a1af6fcfba0b2fa2ef73c6860b4034e89
URL: https://github.com/llvm/llvm-project/commit/51cfad3a1af6fcfba0b2fa2ef73c6860b4034e89
DIFF: https://github.com/llvm/llvm-project/commit/51cfad3a1af6fcfba0b2fa2ef73c6860b4034e89.diff
LOG: [flang] Ensure Preprocessor::Define saves macro names correctly
This fixes problems with macros defined with -D on the command line
and predefined macros defined in the throwaway driver program.
Added:
Modified:
flang/lib/Parser/preprocessor.cpp
Removed:
################################################################################
diff --git a/flang/lib/Parser/preprocessor.cpp b/flang/lib/Parser/preprocessor.cpp
index 9c10cedfd53b..a1f07967d9b0 100644
--- a/flang/lib/Parser/preprocessor.cpp
+++ b/flang/lib/Parser/preprocessor.cpp
@@ -212,7 +212,7 @@ Preprocessor::Preprocessor(AllSources &allSources) : allSources_{allSources} {
}
void Preprocessor::Define(std::string macro, std::string value) {
- definitions_.emplace(macro, Definition{value, allSources_});
+ definitions_.emplace(SaveTokenAsName(macro), Definition{value, allSources_});
}
void Preprocessor::Undefine(std::string macro) { definitions_.erase(macro); }
More information about the flang-commits
mailing list