[PATCH] D15470: Preserve source location in namespaced base ctor initializers

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 11 15:47:22 PST 2015


rsmith added a subscriber: rsmith.

================
Comment at: lib/Sema/SemaDeclCXX.cpp:2987
@@ +2986,3 @@
+        TInfo = Context.CreateTypeSourceInfo(BaseType);
+        ElaboratedTypeLoc TL = TInfo->getTypeLoc().castAs<ElaboratedTypeLoc>();
+        TL.setElaboratedKeywordLoc(IdLoc);
----------------
You also need to initialize the `TypeLoc` for the contained `TypeDeclType` (`TL.getNamedTypeLoc()`).

================
Comment at: lib/Sema/SemaDeclCXX.cpp:2988
@@ +2987,3 @@
+        ElaboratedTypeLoc TL = TInfo->getTypeLoc().castAs<ElaboratedTypeLoc>();
+        TL.setElaboratedKeywordLoc(IdLoc);
+        TL.setQualifierLoc(SS.getWithLocInContext(Context));
----------------
This should be initialized to `SourceLocation()`, since there is no elaborated type keyword (`struct`/`union`/`class`/`enum`) in this case.


http://reviews.llvm.org/D15470





More information about the cfe-commits mailing list