[flang-commits] [PATCH] D85862: [flang] Ensure Preprocessor::Define() saves macro names correctly

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Aug 12 16:23:48 PDT 2020


klausler created this revision.
klausler added reviewers: sscalpone, PeteSteinfeld.
klausler added a project: Flang.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: DavidTruby.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
klausler requested review of this revision.

This fixes problems with macros defined with -D on the command line
and predefined macros defined in the throwaway driver program.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85862

Files:
  flang/lib/Parser/preprocessor.cpp


Index: flang/lib/Parser/preprocessor.cpp
===================================================================
--- flang/lib/Parser/preprocessor.cpp
+++ flang/lib/Parser/preprocessor.cpp
@@ -212,7 +212,7 @@
 }
 
 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); }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85862.285206.patch
Type: text/x-patch
Size: 506 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20200812/dac6c5d7/attachment.bin>


More information about the flang-commits mailing list