r345741 - [Lex] Make MacroDirective::findDirectiveAtLoc take const SourceManager

Kristof Umann via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 31 10:19:20 PDT 2018


Author: szelethus
Date: Wed Oct 31 10:19:20 2018
New Revision: 345741

URL: http://llvm.org/viewvc/llvm-project?rev=345741&view=rev
Log:
[Lex] Make MacroDirective::findDirectiveAtLoc take const SourceManager

I'm currently working on including macro expansions in the Static Analyzer's
plist output, where I can only access a const SourceManager.

Differential Revision: https://reviews.llvm.org/D53940

Modified:
    cfe/trunk/include/clang/Lex/MacroInfo.h
    cfe/trunk/lib/Lex/MacroInfo.cpp

Modified: cfe/trunk/include/clang/Lex/MacroInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/MacroInfo.h?rev=345741&r1=345740&r2=345741&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/MacroInfo.h (original)
+++ cfe/trunk/include/clang/Lex/MacroInfo.h Wed Oct 31 10:19:20 2018
@@ -395,7 +395,8 @@ public:
 
   /// Find macro definition active in the specified source location. If
   /// this macro was not defined there, return NULL.
-  const DefInfo findDirectiveAtLoc(SourceLocation L, SourceManager &SM) const;
+  const DefInfo findDirectiveAtLoc(SourceLocation L,
+                                   const SourceManager &SM) const;
 
   void dump() const;
 

Modified: cfe/trunk/lib/Lex/MacroInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/MacroInfo.cpp?rev=345741&r1=345740&r2=345741&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/MacroInfo.cpp (original)
+++ cfe/trunk/lib/Lex/MacroInfo.cpp Wed Oct 31 10:19:20 2018
@@ -200,7 +200,8 @@ MacroDirective::DefInfo MacroDirective::
 }
 
 const MacroDirective::DefInfo
-MacroDirective::findDirectiveAtLoc(SourceLocation L, SourceManager &SM) const {
+MacroDirective::findDirectiveAtLoc(SourceLocation L,
+                                   const SourceManager &SM) const {
   assert(L.isValid() && "SourceLocation is invalid.");
   for (DefInfo Def = getDefinition(); Def; Def = Def.getPreviousDefinition()) {
     if (Def.getLocation().isInvalid() ||  // For macros defined on the command line.




More information about the cfe-commits mailing list